Example Graph
The following examples run against this graph:
cardinality()
Returns the number of elements in a collection. This function applies to values of constructed types.
Syntax | cardinality(<expr>) |
||
Arguments | Name | Type | Description |
<expr> |
PATH , LIST , Record |
The input expression | |
Return Type | UINT |
MATCH p = ()->{1,3}()
RETURN p, cardinality(p)
Result:
p | cardinality(p) |
---|---|
(:Paper {_id: "P1", score: 6, title: "Efficient Graph Search", author: "Alex"})-[:Cites {weight: 2}]->(:Paper {_id: "P2", score: 9, title: "Optimizing Queries", author: "Alex"})-[:Cites {weight: 1]->(:Paper {_id: "P3", score: 7, title: "Path Patterns", author: "Zack"}) | 5 |
(:Paper {_id: "P1", score: 6, title: "Efficient Graph Search", author: "Alex"})-[:Cites {weight: 2]->(:Paper {_id: "P2", score: 9, title: "Optimizing Queries", author: "Alex"}) | 3 |
(:Paper {_id: "P2", score: 9, title: "Optimizing Queries", author: "Alex"})-[:Cites {weight: 1]->(:Paper {_id: "P3", score: 7, title: "Path Patterns", author: "Zack"}) | 3 |
LET myList = [1, 2, null, 3]
RETURN cardinality(myList)
Result:
cardinality(myList) |
---|
4 |
LET rec = RECORD{no: 1, value: "tennis"}
RETURN cardinality(rec)
Result:
cardinality(rec) |
---|
2 |
element_id()
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 |
MATCH (n)-[e]->()
RETURN element_id(n), element_id(e)
Result:
element_id(n) | element_id(e) |
---|---|
8718971077612535810 | 1 |
8791028671650463745 | 2 |
labels()
Gets the label of a graph element.
Syntax | labels(<elemVar>) |
||
Arguments | Name | Type | Description |
<elemVar> |
NODE , EDGE |
Element variable reference | |
Return Type | STRING |
MATCH (n)-[e]->()
RETURN labels(n), labels(e)
Result:
labels(n) | labels(e) |
---|---|
Paper | Cites |
Paper | Cites |