Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion modules/ROOT/pages/clauses/union.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions modules/ROOT/pages/clauses/use.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,14 @@ USE <graph>
+
[source, syntax, role="noheader"]
----
CALL {
CALL () {
USE <graph>
<other clauses>
}
----
+
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.

Expand Down
14 changes: 12 additions & 2 deletions modules/ROOT/pages/functions/graph.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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]]
Expand All @@ -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
Expand All @@ -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]
Expand Down
Loading