Schema functions¶
NebulaGraph supports the following schema functions.
For nGQL statements¶
Note
- The following functions are only available in the YIELD clauses.
- The following functions are unavailable in the WHERE clauses.
Function | Description |
---|---|
id(vertex) | Returns the ID of a vertex. The data type of the result is the same as the vertex ID. |
map properties(vertex) | Returns the properties of a vertex. |
map properties(edge) | Returns the properties of an edge. |
string type(edge) | Returns the edge type of an edge. |
src(edge) | Returns the source vertex ID of an edge. The data type of the result is the same as the vertex ID. |
dst(edge) | Returns the destination vertex ID of an edge. The data type of the result is the same as the vertex ID. |
int rank(edge) | Returns the rank value of an edge. |
For statements compatible with openCypher¶
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 Tag of a vertex, which serves the same purpose as labels(). |
list labels(<vertex>) | Returns the Tag of a vertex, which serves the same purpose as tags(). This function is used for compatibility with openCypher syntax. |
map properties(<vertex_or_edge>) | Returns the properties of a vertex or an edge. |
string type(<edge>) | Returns the edge type of an edge. |
src(<edge>) | Returns the source vertex ID of an edge. The data type of the result is the same as the vertex ID. |
dst(<edge>) | Returns the destination vertex ID of an edge. The data type of the result is the same as the vertex ID. |
vertex startNode(<path>) | Visits an edge or a path and returns its source vertex ID. |
string endNode(<path>) | Visits an edge or a path and returns its destination vertex ID. |
int rank(<edge>) | Returns the rank value of an edge. |
Examples¶
nebula> GO FROM "player100" OVER follow REVERSELY \
YIELD src(edge) AS destination;
+-------------+
| destination |
+-------------+
| "player101" |
| "player102" |
+-------------+
nebula> LOOKUP ON player WHERE player.age > 45 YIELD id(vertex);
+-------------+-------------+
| VertexID | id(VERTEX) |
+-------------+-------------+
| "player144" | "player144" |
| "player140" | "player140" |
+-------------+-------------+
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 13, 2023