Skip to content

Commit 81a695c

Browse files
Apply suggestions from code review
Co-authored-by: Jens Pryce-Åklundh <[email protected]>
1 parent 524f4db commit 81a695c

File tree

2 files changed

+17
-14
lines changed

2 files changed

+17
-14
lines changed

modules/ROOT/pages/clauses/use.adoc

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,31 +18,30 @@ USE <graph reference>
1818

1919
A graph reference can be described using:
2020

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>)`.
2323

2424
When connected to a composite database, a graph reference may additionally be passed with:
2525

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>)`.
2727

2828
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].
2929

3030
== USE clause when connected to a standard or system database
31-
=== Allowed graph reference targets
3231

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.
3434

3535
=== Position of use clauses
3636
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.
3737

3838
== 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 *`.
4140

4241
=== 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:
4443

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).
4645
* Union parts:
4746
+
4847
[source, syntax, role="noheader"]

modules/ROOT/pages/queries/expressions.adoc

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,18 +85,22 @@ String literals can contain the following escape sequences:
8585

8686
[[graphreferences]]
8787
== 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>)`.
9191

9292
Rules on string expressions for graph references when using identifiers (static graph references, administration commands) or a string (graph.byName function):
9393

9494
* 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`.
96100

97101
Graph references are used within:
98102

99103
* 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].
101105

102106

0 commit comments

Comments
 (0)