Skip to content
Blog

Node & relationship functions

The following functions are used to get information about nodes and relationships.

FunctionDescriptionAlias
IDreturns the internal ID of node/rel
LABELreturns the label name of node/relationshipLABELS
OFFSETreturns the offset of the internal ID
PROPERTIESreturns 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 typeOutput type
NODEID (Internal database ID)
RELID (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 typeOutput type
NODESTRING
RELSTRING
MATCH (a) RETURN LABEL(a) AS LABEL LIMIT 1;
┌────────┐
│ LABEL │
│ STRING │
├────────┤
│ User │
└────────┘

OFFSET

Returns the offset of the internal ID.

Input typeOutput type
IDINT64
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 typeOutput type
NODESTRUCT
RELSTRUCT
MATCH (a:User {name: 'Alice'}) RETURN PROPERTIES(a) AS props;
┌───────────────────────────────────────────┐
│ props │
│ STRUCT(name STRING, age INT64) │
├───────────────────────────────────────────┤
│ {name: Alice, age: 30} │
└───────────────────────────────────────────┘