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" | 41 |
+--------------+--------+
The following query returns the degree
property of the edge type follow
.
nebula> GO FROM "player100" OVER follow YIELD follow.degree;
+---------------+
| follow.degree |
+---------------+
| 95 |
+---------------+
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" | 17 | 0 |
| "player100" | "player125" | 17 | 0 |
+-------------+-------------+--------------+--------------+
Legacy version compatibility
NebulaGraph 2.6.0 and later versions support the new Schema-related functions. Similar statements as the above examples are written as follows in 3.4.0.
GO FROM "player100" OVER follow YIELD properties($^).name AS startName, properties($$).age AS endAge;
GO FROM "player100" OVER follow YIELD properties(edge).degree;
GO FROM "player100" OVER follow YIELD src(edge), dst(edge), type(edge), rank(edge);
In 3.4.0, NebulaGraph is still compatible with the old syntax.