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) #832

Merged
merged 1 commit into from
Jan 11, 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
13 changes: 11 additions & 2 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 All @@ -114,9 +120,12 @@ label:new[Introduced in 5.13]

1.2+| xref::functions/scalar.adoc#functions-id[`id()`]
| `id(input :: NODE) :: INTEGER`
| label:deprecated[] Returns the id of a `NODE`. Replaced by `elementId()`
| label:deprecated[] Returns the id of a `NODE`.
Replaced by xref:functions/scalar.adoc#functions-elementid[`elementId()`].
| `id(input :: RELATIONSHIP) :: INTEGER`
| label:deprecated[] Returns the id of a `RELATIONSHIP`. Replaced by `elementId()`.
| label:deprecated[] Returns the id of a `RELATIONSHIP`.
Replaced by xref:functions/scalar.adoc#functions-elementid[`elementId()`].


1.1+| xref::functions/scalar.adoc#functions-last[`last()`]
| `last(list :: LIST<ANY>) :: ANY`
Expand Down
58 changes: 31 additions & 27 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 Expand Up @@ -459,8 +463,8 @@ Therefore, it is perfectly allowable for `id()` to return the same value for bot

[IMPORTANT]
====
The function `id` is deprecated.
Use the function `elementId` instead.
The function `id()` is deprecated.
Use the function xref:functions/scalar.adoc#functions-elementid[`elementId()`] instead.
====

[NOTE]
Expand Down
Loading