Property reference¶
You can refer to the properties of a vertex or an edge in WHERE
and YIELD
syntax.
Note
This function applies to native nGQL only.
Property reference for vertex¶
For source vertex¶
$^.<tag_name>.<prop_name>
Parameter | Description |
---|---|
$^ |
is used to get the property of the source vertex. |
tag_name |
is the tag name of the vertex. |
prop_name |
specifies the property name. |
For destination vertex¶
$$.<tag_name>.<prop_name>
Parameter | Description |
---|---|
$$ |
is used to get the property of the destination vertex. |
tag_name |
is the tag name of the vertex. |
prop_name |
specifies the property name. |
Property reference for edge¶
For user-defined edge property¶
<edge_type>.<prop_name>
Parameter | Description |
---|---|
edge_type |
is the edge type of the edge. |
prop_name |
specifies the property name of the edge type. |
For built-in properties¶
Apart from the user-defined edge property, there are four built-in properties in each edge:
Parameter | Description |
---|---|
_src |
source vertex ID of the edge |
_dst |
destination vertex ID of the edge |
_type |
edge type |
_rank |
the rank value for the edge |
Examples¶
The following query returns the name
property of the player
tag on the source vertex and the age
property of the player
tag on the destination vertex.
nebula> GO FROM "player100" OVER follow YIELD $^.player.name AS startName, $$.player.age AS endAge;
+--------------+--------+
| startName | endAge |
+--------------+--------+
| "Tim Duncan" | 36 |
+--------------+--------+
| "Tim Duncan" | 33 |
+--------------+--------+
The following query returns the degree
property of the edge type follow
.
nebula> GO FROM "player100" OVER follow YIELD follow.degree;
+---------------+
| follow.degree |
+---------------+
| 95 |
+---------------+
| 90 |
+---------------+
The following query returns the source vertex, the destination vertex, the edge type, and the edge rank value of the edge type follow
.
nebula> GO FROM "player100" OVER follow YIELD follow._src, follow._dst, follow._type, follow._rank;
+-------------+-------------+--------------+--------------+
| follow._src | follow._dst | follow._type | follow._rank |
+-------------+-------------+--------------+--------------+
| "player100" | "player101" | 136 | 0 |
+-------------+-------------+--------------+--------------+
| "player100" | "player102" | 136 | 0 |
+-------------+-------------+--------------+--------------+
Last update: August 27, 2021