Skip to content

Commit b74d23f

Browse files
Add graph.byElementId function (#752)
Co-authored-by: linneaandersson <[email protected]>
1 parent 5ef0b53 commit b74d23f

File tree

4 files changed

+50
-2
lines changed

4 files changed

+50
-2
lines changed

modules/ROOT/pages/clauses/use.adoc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,3 +115,16 @@ The argument can be any expression that evaluates to the name of a constituent g
115115
USE graph.byName($graphName)
116116
MATCH (n) RETURN n
117117
----
118+
119+
[[query-use-examples-query-composite-database-by-element-id]]
120+
=== Query a composite database constituent using elementId
121+
122+
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.
123+
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`.
124+
If the constituent database is not a standard database in the DBMS an error will be thrown:
125+
.Query
126+
[source, cypher, role=test-skip]
127+
----
128+
USE graph.byElementId("4:c0a65d96-4993-4b0c-b036-e7ebd9174905:0")
129+
MATCH (n) RETURN n
130+
----

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,16 @@ GRANT LOAD ON ALL DATA TO `role`
9797
| New privilege that controls a user's ability to load data.
9898
Unlike other privileges, these are not granted, denied, or revoked on graphs, databases, or the DBMS, but instead on `ALL DATA`.
9999

100+
a|
101+
label:functionality[]
102+
label:new[]
103+
104+
[source, cypher, role=noheader]
105+
----
106+
USE graph.byElementId(elementId :: STRING)
107+
----
108+
109+
| New graph function, xref:functions/graph.adoc#functions-graph-by-elementid[graph.byElementId()], that resolves the constituent graph to which a given element id belongs.
100110
|===
101111

102112
[[cypher-deprecations-additions-removals-5.12]]

modules/ROOT/pages/functions/graph.adoc

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,4 +132,26 @@ RETURN n
132132
133133
Returns all nodes from all graphs on the current composite database.
134134
135-
======
135+
======
136+
137+
[[functions-graph-by-elementid]]
138+
== graph.byElementId()
139+
140+
_This feature was introduced in Neo4j 5.13._
141+
142+
The `graph.byElementId()` function is used in the xref:clauses/use.adoc[] clause to resolve a constituent graph to which a given element id belongs.
143+
If the constituent database is not a standard database in the DBMS, an error will be thrown.
144+
145+
.+graph.byElementId()+
146+
======
147+
148+
In this example, it is assumed that the DBMS contains a composite database constituent, which contains the element id `4:c0a65d96-4993-4b0c-b036-e7ebd9174905:0`.
149+
150+
.Query
151+
[source, cypher, role=test-skip]
152+
----
153+
USE graph.byElementId("4:c0a65d96-4993-4b0c-b036-e7ebd9174905:0")
154+
MATCH (n) RETURN n
155+
----
156+
157+
======

modules/ROOT/pages/functions/index.adoc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -753,9 +753,11 @@ Graph functions provide information about the constituent graphs in composite da
753753
[options="header"]
754754
|===
755755
| Function | Signature | Description
756+
1.1+| xref:functions/graph.adoc#functions-graph-by-elementid[`graph.byElementId()`] | `USE graph.byElementId(elementId :: STRING)` | Resolves the constituent graph to which a given element id belongs.
757+
label:new[Introduced in Neo4j 5.13]
758+
1.1+| xref:functions/graph.adoc#functions-graph-byname[`graph.byName()`] | `USE graph.byName(name :: STRING)` | Resolves a constituent graph by name.
756759
1.1+| xref:functions/graph.adoc#functions-graph-names[`graph.names()`] | `graph.names() :: LIST<STRING>` | Returns a list containing the names of all graphs in the current composite database.
757760
1.1+| xref:functions/graph.adoc#functions-graph-names[`graph.propertiesByName()`] | `graph.propertiesByName(name :: STRING) :: MAP` | Returns a map containing the properties associated with the given graph.
758-
1.1+| xref:functions/graph.adoc#functions-graph-byname[`graph.byName()`] | `USE graph.byName(name :: STRING)` | Resolves a constituent graph by name.
759761
|===
760762

761763
[[header-query-functions-database]]
@@ -767,6 +769,7 @@ Database functions provide information about databases.
767769
|===
768770
| Function | Signature | Description
769771
1.1+| xref:functions/database.adoc#functions-database-nameFromElementId[`db.nameFromElementId()`] | `db.nameFromElementId(name :: STRING) :: STRING` | Resolves the database name from the given element id.
772+
label:new[Introduced in 5.12]
770773
|===
771774

772775
[[header-query-functions-user-defined]]

0 commit comments

Comments
 (0)