You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: modules/ROOT/pages/clauses/use.adoc
+8-9Lines changed: 8 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,31 +18,30 @@ USE <graph reference>
18
18
19
19
A graph reference can be described using:
20
20
21
-
* direct graph references: `USE db1`
22
-
* the graph function xref:functions/graph.adoc#functions-graph-by-elementid[`graph.byElementId()`], to access a graph of a given element: `USE graph.byName(<element-id-string>)`
21
+
* Direct graph references: `USE db1`.
22
+
* The graph function xref:functions/graph.adoc#functions-graph-by-elementid[`graph.byElementId()`], to access a graph of a given element: `USE graph.byName(<element-id-string>)`.
23
23
24
24
When connected to a composite database, a graph reference may additionally be passed with:
25
25
26
-
* the graph function xref:functions/graph.adoc#functions-graph-byname[`graph.byName()`], which allows the graph reference to be resolved dynamically: `USE graph.byName(<string-expression>)`
26
+
* The graph function xref:functions/graph.adoc#functions-graph-byname[`graph.byName()`], which allows the graph reference to be resolved dynamically: `USE graph.byName(<string-expression>)`.
27
27
28
28
A more detailed description of how and when a graph references needs to be quoted and/or escaped is defined xref::queries/expressions.adoc#graphreferences[here].
29
29
30
30
== USE clause when connected to a standard or system database
31
-
=== Allowed graph reference targets
32
31
33
-
All databases except composite databases can be targeted. It is not possible to target more than one database. This is only possible when connected to a composite database.
32
+
All databases are valid graph reference targets except composite databases.
33
+
Targeting multiple databases is not allowed, unless connected to a composite database.
34
34
35
35
=== Position of use clauses
36
36
When connected to a non-composite database, the `USE` clause can only appear as the prefix of schema commands, or as the first clause of queries. There may be multiple `USE` clauses as long as they target the same database.
37
37
38
38
== USE clause when connected to a composite database
39
-
=== Allowed graph reference targets
40
-
When executing queries against a composite database, the `USE` clause must only refer to graphs that are part of the current composite database. The constituents can be listed either with `RETURN graph.names()` when connected to the composite database or `SHOW DATABASES YIELD name, constituents RETURN *`.
39
+
When executing queries against a link:{neo4j-docs-base-uri}/operations-manual/current/database-administration/composite-databases/concepts/[composite database], the `USE` clause must only refer to graphs that are part of the current composite database. The constituents can be listed either with `RETURN graph.names()` when connected to the composite database or `SHOW DATABASES YIELD name, constituents RETURN *`.
41
40
42
41
=== Position of use clauses
43
-
When running queries against a link:{neo4j-docs-base-uri}/operations-manual/current/database-administration/composite-databases/concepts/[composite database], the `USE` clause can appear as the first clause of:
42
+
When running queries against a composite database, the `USE` clause can appear as the first clause of:
44
43
45
-
* a query (as when connected to a non-composite database)
44
+
* A query (similar to how it is used when connected to a non-composite database).
Copy file name to clipboardExpand all lines: modules/ROOT/pages/queries/expressions.adoc
+9-5Lines changed: 9 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -85,18 +85,22 @@ String literals can contain the following escape sequences:
85
85
86
86
[[graphreferences]]
87
87
== Graph references
88
-
* static graph references: `USE <symbolic-name>` (for standard and system databases), `USE <symbolic-name>.<symbolic-name>` (for composite databases)
89
-
* dynamic graph reference with the xref:functions/graph.adoc#functions-graph-byname[`graph.byName`] function, to access a graph of a given name: `USE graph.byName(<string-expression>)`
90
-
* dynamic graph reference with the xref:functions/graph.adoc#functions-graph-by-elementid[`graph.byElementId`] function, to access a graph of a given node or relationship: `USE graph.byName(<element-id-string>)`
88
+
* Static graph references: `USE <symbolic-name>` (for link:{neo4j-docs-base-uri}/operations-manual/current/database-administration/[standard and system databases]), `USE <symbolic-name>.<symbolic-name>` (for link:{neo4j-docs-base-uri}/operations-manual/current/database-administration/composite-databases/concepts/[composite databases]).
89
+
* Dynamic graph reference with the xref:functions/graph.adoc#functions-graph-byname[`graph.byName`] function, to access a graph of a given name: `USE graph.byName(<string-expression>)`.
90
+
* Dynamic graph references with the xref:functions/graph.adoc#functions-graph-by-elementid[`graph.byElementId`] function, to access a graph of a given node or relationship: `USE graph.byName(<element-id-string>)`.
91
91
92
92
Rules on string expressions for graph references when using identifiers (static graph references, administration commands) or a string (graph.byName function):
93
93
94
94
* Unquoted dots are separators between a composite database and its constituent. For example, `composite.db1` represents the constituent composite.db1 in the composite database composite. To refer to a database with a dot in its name, quote the graph reference instead: `+`composite.db1`+`
95
-
* When resolving a graph reference within a graph function, the string argument is parsed the same as a static graph reference before resolving it. This means that for most arguments, `USE graph.byName(<graph-reference>)` is equal to `USE <graph-reference>`. However, escaping rules for xref::syntax/naming.adoc#symbolic-names-escaping-rules[symbolic names] are applied to the argument. When passing in a string literal, this means both the escaping rules for xref:queries/expressions.adoc#expressions-string-literals[string literals] (when parsing the query) as well as the escaping rules for xref::syntax/naming.adoc#symbolic-names-escaping-rules[symbolic names] (when evaluating the graph reference) are applied. For example, the graph reference in `USE graph.byName('+composite.1\\u0041+')` will resolve to the constituent `composite.1a` of the composite database `composite`.
95
+
* When resolving a graph reference within a graph function, the string argument is parsed like a static graph reference.
96
+
Thus, `USE graph.byName(<graph-reference>)` is typically equivalent to `USE <graph-reference>`.
97
+
However, escaping rules for xref::syntax/naming.adoc#symbolic-names-escaping-rules[symbolic names] are applied to the argument.
98
+
For string literals, both the escaping rules for xref:queries/expressions.adoc#expressions-string-literals[string literals] (during query parsing) and xref::syntax/naming.adoc#symbolic-names-escaping-rules[symbolic names] (during graph reference evaluation) are applied.
99
+
For example, the graph reference in `USE graph.byName('+composite.1\\u0041+')` resolves to the constituent `composite.1a` of the composite database `composite`.
96
100
97
101
Graph references are used within:
98
102
99
103
* xref:clauses/use.adoc[`USE clauses`]
100
-
* database and alias names when managing databases and aliases, see link:{neo4j-docs-base-uri}/operations-manual/current/database-administration/[Database administration]
104
+
* Database and alias names when managing link:{neo4j-docs-base-uri}/operations-manual/current/database-administration/[databases and aliases].
0 commit comments