Skip to content

Commit 6db2bbe

Browse files
Merge branch 'operator_playground' of https://github.com/JPryce-Aklundh/docs-cypher into operator_playground
2 parents 7c2045c + a4ae323 commit 6db2bbe

File tree

8 files changed

+75
-10
lines changed

8 files changed

+75
-10
lines changed

modules/ROOT/pages/appendix/gql-conformance/additional-cypher.adoc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,10 @@ REMOVE n:$($label)
206206
| Description
207207

208208
| xref:functions/graph.adoc#functions-graph-by-elementid[`graph.byElementId()`]
209-
| Returns the graph reference with the given element id. It is only supported in the `USE` clause, on composite databases.
209+
| Returns the graph reference with the given element id.
210+
It is only supported in the xref:clauses/use.adoc[`USE`] clause.
211+
As of Neo4j 5.26, it is supported on both link:{neo4j-docs-base-uri}/operations-manual/{page-version}/database-administration/[standard and composite databases].
212+
On earlier versions, it is only supported on composite databases.
210213

211214
| xref:functions/graph.adoc#functions-graph-byname[`graph.byName()`]
212215
| Returns the graph reference of the given name. It is only supported in the `USE` clause, on composite databases.

modules/ROOT/pages/clauses/create.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ This is because a relationship can only have exactly one type.
235235
----
236236

237237
.Create nodes and relationships using dynamic node labels and relationship types
238+
// tag::clauses_create_dynamic_create[]
238239
[source, cypher]
239240
----
240241
CREATE (greta:$($nodeLabels) {name: 'Greta Gerwig'})
@@ -243,6 +244,7 @@ UNWIND $movies AS movieTitle
243244
CREATE (greta)-[rel:$($relType)]->(m:Movie {title: movieTitle})
244245
RETURN greta.name AS name, labels(greta) AS labels, type(rel) AS relType, collect(m.title) AS movies
245246
----
247+
// end::clauses_create_dynamic_create[]
246248

247249
.Result
248250
[role="queryresult",options="footer",cols="4*<m"]

modules/ROOT/pages/clauses/load-csv.adoc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ It also mitigates the risk of Cypher injection.
309309
(For more information about Cypher injection, see link:https://neo4j.com/developer/kb/protecting-against-cypher-injection/[Neo4j Knowledge Base -> Protecting against Cypher injection]).
310310

311311
.bands-with-headers.csv
312-
[source, csv, filename="artists-with-headers.csv"]
312+
[source, csv, filename="bands-with-headers.csv"]
313313
----
314314
Id,Label,Name
315315
1,Band,The Beatles
@@ -319,12 +319,14 @@ Id,Label,Name
319319
----
320320

321321
.Query
322-
[source, cypher, role=test-skip]
322+
// tag::clauses_load_csv_dynamic_columns[]
323+
[source, cypher]
323324
----
324325
LOAD CSV WITH HEADERS FROM 'file:///bands-with-headers.csv' AS line
325326
MERGE (n:$(line.Label) {name: line.Name})
326327
RETURN n AS bandNodes
327328
----
329+
// end::clauses_load_csv_dynamic_columns[]
328330

329331
.Result
330332
[role="queryresult",options="header,footer",cols="1*<m"]

modules/ROOT/pages/clauses/match.adoc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ RETURN directors
546546
1+d|Rows: 2
547547
|===
548548

549-
.Match nodes dynamically using the `any()` function
549+
.Match nodes dynamically using `any()`
550550
[source, cypher]
551551
----
552552
MATCH (n:$any(["Movie", "Actor"]))
@@ -577,11 +577,14 @@ RETURN n AS nodes
577577
----
578578

579579
.Match nodes dynamically using a parameter
580+
// tag::clauses_match_dynamic_match_parameter[]
580581
[source, cypher]
581582
----
582583
MATCH (movie:$($label))
583584
RETURN movie.title AS movieTitle
584585
----
586+
// end::clauses_match_dynamic_match_parameter[]
587+
585588

586589
.Result
587590
[role="queryresult",options="header,footer",cols="1*<m"]
@@ -596,13 +599,16 @@ RETURN movie.title AS movieTitle
596599

597600

598601
.Match relationships dynamically using a variable
602+
// tag::clauses_match_dynamic_match_variable[]
599603
[source, cypher]
600604
----
601605
CALL db.relationshipTypes()
602606
YIELD relationshipType
603607
MATCH ()-[r:$(relationshipType)]->()
604608
RETURN relationshipType, count(r) AS relationshipCount
605609
----
610+
// end::clauses_match_dynamic_match_variable[]
611+
606612

607613
.Result
608614
[role="queryresult",options="header,footer",cols="2*<m"]

modules/ROOT/pages/clauses/merge.adoc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -718,6 +718,7 @@ This is because the xref:planning-and-tuning/execution-plans.adoc[Cypher planner
718718
----
719719

720720
.Merge nodes and relationships using dynamic node labels and relationship types
721+
// tag::clauses_merge_dynamic_merge[]
721722
[source, cypher]
722723
----
723724
MERGE (greta:$($nodeLabels) {name: 'Greta Gerwig'})
@@ -726,6 +727,7 @@ UNWIND $movies AS movieTitle
726727
MERGE (greta)-[rel:$($relType)]->(m:Movie {title: movieTitle})
727728
RETURN greta.name AS name, labels(greta) AS labels, type(rel) AS relType, collect(m.title) AS movies
728729
----
730+
// end::clauses_merge_dynamic_merge[]
729731

730732
.Result
731733
[role="queryresult",options="footer",cols="3*<m"]

modules/ROOT/pages/clauses/use.adoc

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ MATCH (n) RETURN n
9393
[[query-use-examples-query-composite-database-constituent-graph-dynamically]]
9494
=== Query a composite database constituent graph dynamically
9595

96-
The built-in function `graph.byName()` can be used in the `USE` clause to resolve a constituent graph from a `STRING` value containing the qualified name of a constituent.
96+
The xref:functions/graph.adoc#functions-graph-byname[`graph.byName()`] function can be used in the `USE` clause to resolve a constituent graph from a `STRING` value containing the qualified name of a constituent.
9797

9898
This example uses a composite database named `myComposite` that includes an alias named `myConstituent`:
9999

@@ -114,12 +114,18 @@ USE graph.byName($graphName)
114114
MATCH (n) RETURN n
115115
----
116116

117+
[role=label--new-5.13]
117118
[[query-use-examples-query-composite-database-by-element-id]]
118119
=== Query a composite database constituent using elementId
119120

120-
The `graph.byElementId()` function (introduced in Neo4j 5.13), can be used in the `USE` clause to resolve a constituent graph to which a given element id belongs.
121-
In the below example, it is assumed that the DBMS contains a composite database constituent, which contains the element id `4:c0a65d96-4993-4b0c-b036-e7ebd9174905:0`.
122-
If the constituent database is not a standard database in the DBMS an error will be thrown:
121+
The xref:functions/graph.adoc#functions-graph-by-elementid[`graph.byElementId()`] function can be used in the `USE` clause to resolve a constituent graph to which a given xref:functions/scalar.adoc#functions-elementid[element id] belongs.
122+
As of Neo4j 5.26, it is supported on both standard and composite databases (on previous versions it is only available on composite databases).
123+
124+
[NOTE]
125+
On a standard database, a `USE` clause with `graph.byElementId()` cannot be combined with other `USE` clauses unless the subsequent `USE` clauses reference the same element id.
126+
127+
In the below example, it is assumed that the DBMS contains the database corresponding to the given element id. If you are connected to a composite database it needs to be a element id to a constituent database, which is a standard database in the DBMS.
128+
123129
.Query
124130
[source, cypher, role=test-skip]
125131
----

modules/ROOT/pages/deprecations-additions-removals-compatibility.adoc

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,18 @@ For more information on the deprecation of these formats, see link:{neo4j-docs-b
160160
| Feature
161161
| Details
162162

163+
a|
164+
label:functionality[]
165+
label:updated[]
166+
[source, cypher, role="noheader"]
167+
----
168+
USE graph.byElementId("4:c0a65d96-4993-4b0c-b036-e7ebd9174905:0")
169+
MATCH (n) RETURN n
170+
----
171+
172+
| xref:functions/graph.adoc#functions-graph-by-elementid[`graph.byElementId()`] can now be used on both link:{neo4j-docs-base-uri}/operations-manual/{page-version}/database-administration/[standard and composite databases].
173+
Previously it could only be used on composite databases.
174+
163175
a|
164176
label:functionality[]
165177
label:updated[]
@@ -181,6 +193,28 @@ label:updated[]
181193
GRANT READ {*} ON GRAPH * FOR (n) WHERE n.createdAt > date('2024-10-25') TO regularUsers
182194
----
183195
| link:{neo4j-docs-base-uri}/operations-manual/{page-version}/authentication-authorization/property-based-access-control/[Property-based access control] now supports xref:values-and-types/spatial.adoc[spatial] and xref:values-and-types/temporal.adoc[temporal] values.
196+
197+
198+
a|
199+
label:functionality[]
200+
label:updated[]
201+
[source, cypher, role="noheader"]
202+
----
203+
RETURN 'val' as one, 'val' as two
204+
UNION
205+
RETURN 'val' as two, 'val' as one
206+
----
207+
208+
[source, cypher, role="noheader"]
209+
----
210+
RETURN 'val' as one, 'val' as two
211+
UNION ALL
212+
RETURN 'val' as two, 'val' as one
213+
----
214+
a|
215+
216+
Using differently ordered return items in a `UNION [ALL]` clause has been un-deprecated.
217+
184218
|===
185219

186220

modules/ROOT/pages/functions/graph.adoc

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,18 @@ For more information, see xref:subqueries/call-subquery.adoc#import-variables[CA
144144
.Details
145145
|===
146146
| *Syntax* 3+| `graph.byName(name)`
147-
| *Description* 3+| Returns the graph reference of the given name. It is only supported in the `USE` clause, on composite databases.
147+
| *Description* 3+| Returns the graph reference of the given name.
148148
.2+| *Arguments* | *Name* | *Type* | *Description*
149149
| `name` | `STRING` | The name of the graph to be resolved.
150150
| *Returns* 3+| `GRAPH`
151151
|===
152152

153+
154+
.Considerations
155+
|===
156+
| `graph.byName()` is only supported in the xref:clauses/use.adoc[`USE`] clause, on composite databases.
157+
|===
158+
153159
.+graph.byName()+
154160
======
155161
@@ -183,7 +189,7 @@ For more information, see xref:subqueries/call-subquery.adoc#import-variables[CA
183189
.Details
184190
|===
185191
| *Syntax* 3+| `graph.byElementId(elementId)`
186-
| *Description* 3+| Returns the graph reference with the given element id. It is only supported in the `USE` clause, on composite databases.
192+
| *Description* 3+| Returns the graph reference with the given element id.
187193
.2+| *Arguments* | *Name* | *Type* | *Description*
188194
| `elementId` | `STRING` | An element id of a node or relationship.
189195
| *Returns* 3+| `GRAPH`
@@ -192,6 +198,10 @@ For more information, see xref:subqueries/call-subquery.adoc#import-variables[CA
192198
.Considerations
193199
|===
194200
| If the constituent database is not a standard database in the DBMS, an error will be thrown.
201+
| `graph.byElementId()` is only supported in the xref:clauses/use.adoc[`USE`] clause.
202+
| As of Neo4j 5.26, `graph.byElementId()` is supported on both link:{neo4j-docs-base-uri}/operations-manual/{page-version}/database-administration/[standard and composite databases].
203+
On earlier versions, it is only supported on composite databases.
204+
| On a standard database, a `USE` clause with `graph.byElementId()` cannot be combined with other `USE` clauses unless the subsequent `USE` clauses reference the same element id.
195205
|===
196206

197207
.+graph.byElementId()+

0 commit comments

Comments
 (0)