Node & relationship functions
The following functions are used to get information about nodes and relationships.
| Function | Description | Alias |
|---|---|---|
ID | returns the internal ID of node/rel | |
LABEL | returns the label name of node/relationship | LABELS |
OFFSET | returns the offset of the internal ID | |
PROPERTIES | returns a struct of all user-defined properties of node/rel |
See below for more details on each of these functions.
ID
Returns the internal ID of node/rel.
| Input type | Output type |
|---|---|
NODE | ID (Internal database ID) |
REL | ID (Internal database ID) |
MATCH (a:User) RETURN ID(a) AS ID LIMIT 1;┌─────────────┐│ ID ││ INTERNAL_ID │├─────────────┤│ 0:0 │└─────────────┘LABEL
Returns the label name of node/rel. The alias LABELS can also be used.
| Input type | Output type |
|---|---|
NODE | STRING |
REL | STRING |
MATCH (a) RETURN LABEL(a) AS LABEL LIMIT 1;┌────────┐│ LABEL ││ STRING │├────────┤│ User │└────────┘OFFSET
Returns the offset of the internal ID.
| Input type | Output type |
|---|---|
ID | INT64 |
MATCH (a) RETURN OFFSET(ID(a)) AS OFFSET LIMIT 1;┌────────┐│ OFFSET ││ INT64 │├────────┤│ 0 │└────────┘PROPERTIES
Returns a STRUCT containing all user-defined properties of a node or relationship, omitting internal metadata columns (_ID, _LABEL, _SRC, _DST).
| Input type | Output type |
|---|---|
NODE | STRUCT |
REL | STRUCT |
MATCH (a:User {name: 'Alice'}) RETURN PROPERTIES(a) AS props;┌───────────────────────────────────────────┐│ props ││ STRUCT(name STRING, age INT64) │├───────────────────────────────────────────┤│ {name: Alice, age: 30} │└───────────────────────────────────────────┘