Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

graph.byElemendId #1121

Merged
merged 1 commit into from
Nov 26, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@ REMOVE n:$($label)
| Description

| xref:functions/graph.adoc#functions-graph-by-elementid[`graph.byElementId()`]
| Returns the graph reference with the given element id. It is only supported in the `USE` clause, on composite databases.
| Returns the graph reference with the given element id.
It is only supported in the xref:clauses/use.adoc[`USE`] clause.

| xref:functions/graph.adoc#functions-graph-byname[`graph.byName()`]
| Returns the graph reference of the given name. It is only supported in the `USE` clause, on composite databases.
Expand Down
12 changes: 8 additions & 4 deletions modules/ROOT/pages/clauses/use.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ MATCH (n) RETURN n
[[query-use-examples-query-composite-database-constituent-graph-dynamically]]
=== Query a composite database constituent graph dynamically

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.
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.

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

Expand All @@ -116,9 +116,13 @@ MATCH (n) RETURN n
[[query-use-examples-query-composite-database-by-element-id]]
=== Query a composite database constituent using elementId

The `graph.byElementId()` function, can be used in the `USE` clause to resolve a constituent graph to which a given element id belongs.
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`.
If the constituent database is not a standard database in the DBMS an error will be thrown:
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.

[NOTE]
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.

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.

.Query
[source, cypher, role=test-skip]
----
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,18 @@ For more information on the deprecation of these formats, see link:{neo4j-docs-b
| Feature
| Details

a|
label:functionality[]
label:updated[]
[source, cypher, role="noheader"]
----
USE graph.byElementId("4:c0a65d96-4993-4b0c-b036-e7ebd9174905:0")
MATCH (n) RETURN n
----

| 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].
Previously it could only be used on composite databases.

a|
label:functionality[]
label:updated[]
Expand Down
13 changes: 11 additions & 2 deletions modules/ROOT/pages/functions/graph.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,18 @@ For more information, see xref:subqueries/call-subquery.adoc#import-variables[CA
.Details
|===
| *Syntax* 3+| `graph.byName(name)`
| *Description* 3+| Returns the graph reference of the given name. It is only supported in the `USE` clause, on composite databases.
| *Description* 3+| Returns the graph reference of the given name.
.2+| *Arguments* | *Name* | *Type* | *Description*
| `name` | `STRING` | The name of the graph to be resolved.
| *Returns* 3+| `GRAPH`
|===


.Considerations
|===
| `graph.byName()` is only supported in the xref:clauses/use.adoc[`USE`] clause, on composite databases.
|===

.+graph.byName()+
======

Expand Down Expand Up @@ -178,7 +184,7 @@ Returns all nodes from all graphs on the current composite database.
.Details
|===
| *Syntax* 3+| `graph.byElementId(elementId)`
| *Description* 3+| Returns the graph reference with the given element id. It is only supported in the `USE` clause, on composite databases.
| *Description* 3+| Returns the graph reference with the given element id.
.2+| *Arguments* | *Name* | *Type* | *Description*
| `elementId` | `STRING` | An element id of a node or relationship.
| *Returns* 3+| `GRAPH`
Expand All @@ -187,6 +193,9 @@ Returns all nodes from all graphs on the current composite database.
.Considerations
|===
| If the constituent database is not a standard database in the DBMS, an error will be thrown.
| `graph.byElementId()` is only supported in the xref:clauses/use.adoc[`USE`] clause.
| `graph.byElementId()` is supported on both link:{neo4j-docs-base-uri}/operations-manual/{page-version}/database-administration/[standard and composite databases].
| 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.
|===

.+graph.byElementId()+
Expand Down