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

Update elementId() #831

Merged
merged 3 commits into from
Jan 11, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
6 changes: 6 additions & 0 deletions modules/ROOT/pages/functions/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,12 @@ label:new[Introduced in 5.13]
| `coalesce(input :: ANY) :: ANY`
| Returns the first non-null value in a list of expressions.

1.2+| xref::functions/scalar.adoc#functions-elementid[`elementId()`]
| `elementId(input :: NODE) :: STRING`
| Returns a node identifier, unique within a specific transaction and DBMS.
| `elementId(input :: RELATIONSHIP) :: STRING`
| Returns a relationship identifier, unique within a specific transaction and DBMS.

1.1+| xref::functions/scalar.adoc#functions-endnode[`endNode()`]
| `endNode(input :: RELATIONSHIP) :: NODE`
| Returns the end `NODE` of a `RELATIONSHIP`.
Expand Down
54 changes: 29 additions & 25 deletions modules/ROOT/pages/functions/scalar.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -282,46 +282,50 @@ elementId(expression)
|===


.+elementId()+
.+elementId() for nodes+
======

////
CREATE
(alice:Developer {name:'Alice', age: 38, eyes: 'brown'}),
(bob {name: 'Bob', age: 25, eyes: 'blue'}),
(charlie {name: 'Charlie', age: 53, eyes: 'green'}),
(daniel {name: 'Daniel', age: 54, eyes: 'brown'}),
(eskil {name: 'Eskil', age: 41, eyes: 'blue', liked_colors: ['pink', 'yellow', 'black']}),
(alice)-[:KNOWS]->(bob),
(alice)-[:KNOWS]->(charlie),
(bob)-[:KNOWS]->(daniel),
(charlie)-[:KNOWS]->(daniel),
(bob)-[:MARRIED]->(eskil)
////

.Query
[source, cypher]
----
MATCH (a)
RETURN elementId(a)
MATCH (n:Developer)
RETURN elementId(n)
----

The node identifier for each of the nodes is returned.
The identifier for each `Developer` node is returned.

.Result
[role="queryresult",options="header,footer",cols="1*<m"]
|===
| +elementId(a)+
| +"4:c0a65d96-4993-4b0c-b036-e7ebd9174905:0"+
| +"4:c0a65d96-4993-4b0c-b036-e7ebd9174905:1"+
| +"4:c0a65d96-4993-4b0c-b036-e7ebd9174905:2"+
| +"4:c0a65d96-4993-4b0c-b036-e7ebd9174905:3"+
| +"4:c0a65d96-4993-4b0c-b036-e7ebd9174905:4"+
1+d|Rows: 5
| +elementId(n)+
| "4:d8d172ec-96d8-4364-8f5d-9353d776aeb3:0"
1+d|Rows: 1
|===

======

.+elementId() for relationships+
======

.Query
[source, cypher]
----
MATCH (:Developer)-[r]-()
RETURN elementId(r)
----

The identifier for each relationship connected to a `Developer` node is returned.

.Result
[role="queryresult",options="header,footer",cols="1*<m"]
|===
| +elementId(r)+
| "5:d8d172ec-96d8-4364-8f5d-9353d776aeb3:0"
| "5:d8d172ec-96d8-4364-8f5d-9353d776aeb3:1"
1+d|Rows: 2
|===

======

[[functions-endnode]]
== endNode()
Expand Down