Skip to content

Commit 9b5336c

Browse files
Fix remaining examples of CALL subqueries without variable scope clause (#1074)
1 parent ab6d78a commit 9b5336c

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

modules/ROOT/pages/clauses/union.adoc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,15 @@ The combined result is returned, without duplicates.
131131
The `UNION` clause can be used within a xref:subqueries/call-subquery.adoc[`CALL` subquery] to further process the combined results before a final output is returned.
132132
For example, the below query xref:functions/aggregating.adoc#functions-count[counts] the occurrences of each `name` property returned after the `UNION ALL` within the `CALL` subquery.
133133

134+
[NOTE]
135+
The below query uses an empty xref:subqueries/call-subquery.adoc#variable-scope-clause[variable scope clause]: `CALL () { ... }` (introduced in Neo4j 5.23).
136+
If you are using an older version of Neo4j, use `CALL { ... }` instead.
137+
For more information, see xref:subqueries/call-subquery.adoc#import-variables[CALL subqueries -> Importing variables].
138+
134139
.Query
135140
[source, cypher]
136141
----
137-
CALL {
142+
CALL () {
138143
MATCH (a:Actor)
139144
RETURN a.name AS name
140145
UNION ALL

modules/ROOT/pages/clauses/use.adoc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,14 @@ USE <graph>
4141
+
4242
[source, syntax, role="noheader"]
4343
----
44-
CALL {
44+
CALL () {
4545
USE <graph>
4646
<other clauses>
4747
}
4848
----
4949
+
50-
In subqueries, a `USE` clause may appear as the second clause, if directly following an xref::subqueries/call-subquery.adoc#call-importing-variables[importing `WITH` clause].
50+
In subqueries, a `USE` clause may appear directly following the xref:subqueries/call-subquery.adoc#variable-scope-clause[variable scope clause]: `CALL () { ... }` (introduced in Neo4j 5.23).
51+
Or, if you are using an older version of Neo4j, directly following an xref::subqueries/call-subquery.adoc#importing-with[importing `WITH` clause].
5152

5253
When executing queries against a composite database, the `USE` clause must only refer to graphs that are part of the current composite database.
5354

modules/ROOT/pages/functions/graph.adoc

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ Properties for all graphs on the current composite database are returned.
117117
UNWIND graph.names() AS name
118118
WITH name, graph.propertiesByName(name) AS props
119119
WHERE "A" IN props.tags
120-
CALL {
120+
CALL () {
121121
USE graph.byName(name)
122122
MATCH (n)
123123
RETURN n
@@ -127,6 +127,11 @@ RETURN n
127127
128128
Returns all nodes from a subset of graphs that have a `tags` property containing `"A"`.
129129
130+
[NOTE]
131+
The above query uses an empty xref:subqueries/call-subquery.adoc#variable-scope-clause[variable scope clause]: `CALL () { ... }` (introduced in Neo4j 5.23).
132+
If you are using an older version of Neo4j, use `CALL { ... }` instead.
133+
For more information, see xref:subqueries/call-subquery.adoc#import-variables[CALL subqueries -> Importing variables].
134+
130135
======
131136

132137
[[functions-graph-byname]]
@@ -148,7 +153,7 @@ Returns all nodes from a subset of graphs that have a `tags` property containing
148153
[source, cypher, indent=0]
149154
----
150155
UNWIND graph.names() AS graphName
151-
CALL {
156+
CALL () {
152157
USE graph.byName(graphName)
153158
MATCH (n)
154159
RETURN n
@@ -158,6 +163,11 @@ RETURN n
158163
159164
Returns all nodes from all graphs on the current composite database.
160165
166+
[NOTE]
167+
The above query uses an empty xref:subqueries/call-subquery.adoc#variable-scope-clause[variable scope clause]: `CALL () { ... }` (introduced in Neo4j 5.23).
168+
If you are using an older version of Neo4j, use `CALL { ... }` instead.
169+
For more information, see xref:subqueries/call-subquery.adoc#import-variables[CALL subqueries -> Importing variables].
170+
161171
======
162172

163173
[role=label--new-5.13]

0 commit comments

Comments
 (0)