Skip to content

Schema functions

Nebula Graph supports the following built-in schema functions:

Function Description
id(vertex) Returns the id of a vertex. The data type of the result is the same as the vertex ID.
list tags(vertex) Returns the tags of a vertex.
list labels(vertex) Returns the tags of a vertex.
map properties(vertex_or_edge) Takes in a vertex or an edge and returns its properties.
string type(edge) Returns the edge type of an edge.
vertex startNode(path) Takes in an edge or a path and returns its source vertex ID.
string endNode(path) Takes in an edge or a path and returns its destination vertex ID.
int rank(edge) Returns the rank value of an edge.

Examples

nebula> MATCH (a:player) WHERE id(a) == "player100" RETURN tags(a), labels(a), properties(a)
+------------+------------+-------------------------------+
| tags(a)    | labels(a)  | properties(a)                 |
+------------+------------+-------------------------------+
| ["player"] | ["player"] | {age: 42, name: "Tim Duncan"} |
+------------+------------+-------------------------------+

nebula> MATCH p = (a :player {name : "Tim Duncan"})-[r:serve]-(t) RETURN type(r), rank(r)
+---------+---------+
| type(r) | rank(r) |
+---------+---------+
| "serve" | 0       |
+---------+---------+

nebula> MATCH p = (a :player {name : "Tim Duncan"})-[r:serve]-(t) RETURN startNode(p), endNode(p)
+----------------------------------------------------+----------------------------------+
| startNode(p)                                       | endNode(p)                       |
+----------------------------------------------------+----------------------------------+
| ("player100" :player{age: 42, name: "Tim Duncan"}) | ("team204" :team{name: "Spurs"}) |
+----------------------------------------------------+----------------------------------+

Last update: March 25, 2021
Back to top