The following examples run against this graph:

Returns the cardinality of a path, a list, or a record.
| Syntax | cardinality(<expr>) | ||
| Arguments | Name | Type | Description |
<expr> | PATH, LIST, RECORD | The input expression | |
| Return Type | UINT | ||
GQLMATCH p = ()->{1,3}() RETURN p, cardinality(p)
Result:
| p | cardinality(p) |
|---|---|
![]() | 5 |
![]() | 3 |
![]() | 3 |
GQLLET myList = [1, 2, null, 3] RETURN cardinality(myList)
Result:
| cardinality(myList) |
|---|
| 4 |
GQLLET rec = RECORD{no: 1, value: "tennis"} RETURN cardinality(rec)
Result:
| cardinality(rec) |
|---|
| 2 |
Specifies a data conversion.
| Syntax | cast(<value> AS <type>) | ||
| Arguments | Name | Type | Description |
<value> | / | Value expression | |
<type> | / | A material value type | |
| Return Type | As specified by <type> | ||
GQLRETURN cast(1 AS String)
Result:
| cast(1 AS String) |
|---|
| 1 |
Gets the unique identifier _uuid of a graph element.
| Syntax | element_id(<elemVar>) | ||
| Arguments | Name | Type | Description |
<elemVar> | NODE, EDGE | Element variable reference | |
| Return Type | UINT64 | ||
GQLMATCH (n)-[e]->() RETURN element_id(n), element_id(e)
Result:
| element_id(n) | element_id(e) |
|---|---|
| 8718971077612535810 | 1 |
| 8791028671650463745 | 2 |
Gets the label of a graph element.
| Syntax | labels(<elemVar>) | ||
| Arguments | Name | Type | Description |
<elemVar> | NODE, EDGE | Element variable reference | |
| Return Type | STRING | ||
GQLMATCH (n)-[e]->() RETURN labels(n), labels(e)
Result:
| labels(n) | labels(e) |
|---|---|
| Paper | Cites |
| Paper | Cites |