diff --git a/modules/ROOT/pages/clauses/union.adoc b/modules/ROOT/pages/clauses/union.adoc index 85b261d97..2df4687aa 100644 --- a/modules/ROOT/pages/clauses/union.adoc +++ b/modules/ROOT/pages/clauses/union.adoc @@ -131,10 +131,15 @@ The combined result is returned, without duplicates. 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. 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. +[NOTE] +The below query uses an empty xref:subqueries/call-subquery.adoc#variable-scope-clause[variable scope clause]: `CALL () { ... }` (introduced in Neo4j 5.23). +If you are using an older version of Neo4j, use `CALL { ... }` instead. +For more information, see xref:subqueries/call-subquery.adoc#import-variables[CALL subqueries -> Importing variables]. + .Query [source, cypher] ---- -CALL { +CALL () { MATCH (a:Actor) RETURN a.name AS name UNION ALL diff --git a/modules/ROOT/pages/clauses/use.adoc b/modules/ROOT/pages/clauses/use.adoc index 20df616ca..29c744c72 100644 --- a/modules/ROOT/pages/clauses/use.adoc +++ b/modules/ROOT/pages/clauses/use.adoc @@ -41,13 +41,14 @@ USE + [source, syntax, role="noheader"] ---- -CALL { +CALL () { USE } ---- + -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]. +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). +Or, if you are using an older version of Neo4j, directly following an xref::subqueries/call-subquery.adoc#importing-with[importing `WITH` clause]. When executing queries against a composite database, the `USE` clause must only refer to graphs that are part of the current composite database. diff --git a/modules/ROOT/pages/functions/graph.adoc b/modules/ROOT/pages/functions/graph.adoc index 8ac1fcd0e..9404b48f5 100644 --- a/modules/ROOT/pages/functions/graph.adoc +++ b/modules/ROOT/pages/functions/graph.adoc @@ -117,7 +117,7 @@ Properties for all graphs on the current composite database are returned. UNWIND graph.names() AS name WITH name, graph.propertiesByName(name) AS props WHERE "A" IN props.tags -CALL { +CALL () { USE graph.byName(name) MATCH (n) RETURN n @@ -127,6 +127,11 @@ RETURN n Returns all nodes from a subset of graphs that have a `tags` property containing `"A"`. +[NOTE] +The above query uses an empty xref:subqueries/call-subquery.adoc#variable-scope-clause[variable scope clause]: `CALL () { ... }` (introduced in Neo4j 5.23). +If you are using an older version of Neo4j, use `CALL { ... }` instead. +For more information, see xref:subqueries/call-subquery.adoc#import-variables[CALL subqueries -> Importing variables]. + ====== [[functions-graph-byname]] @@ -148,7 +153,7 @@ Returns all nodes from a subset of graphs that have a `tags` property containing [source, cypher, indent=0] ---- UNWIND graph.names() AS graphName -CALL { +CALL () { USE graph.byName(graphName) MATCH (n) RETURN n @@ -158,6 +163,11 @@ RETURN n Returns all nodes from all graphs on the current composite database. +[NOTE] +The above query uses an empty xref:subqueries/call-subquery.adoc#variable-scope-clause[variable scope clause]: `CALL () { ... }` (introduced in Neo4j 5.23). +If you are using an older version of Neo4j, use `CALL { ... }` instead. +For more information, see xref:subqueries/call-subquery.adoc#import-variables[CALL subqueries -> Importing variables]. + ====== [role=label--new-5.13]