Skip to content

Property reference

This page applies to nGQL extensions only.

You can refer to the properties of a vertex or an edge in WHERE or YIELD syntax.

Property reference for vertex

For source vertex

$^.tag_name.prop_name

$^ is used to get the property of the source vertex, tag_name is the tag of the vertex, and prop_name specifies the property name.

For destination vertex

$$.tag_name.prop_name

$$ is used to get the property of the destination vertex, tag_name is the tag of the vertex, and prop_name specifies the property name.

Property reference for edge

For property

Use the following syntax to get the property of an edge.

edge_type.prop_name

edge_type is the edge type of the edge, and prop_name specifies the property name.

For built-in properties

There are four built-in properties in each edge:

  • _src: source vertex ID of the edge
  • _dst: destination vertex ID of the edge
  • _type: edge type
  • _rank: the rank value for the edge

You can use _src and _dst to get the starting and ending vertices' ID, and they are very commonly used to show a graph path.

Examples

nebula> GO FROM "player100" OVER follow YIELD $^.player.name AS startName, $$.player.age AS endAge;
+--------------+--------+
| startName    | endAge |
+--------------+--------+
| "Tim Duncan" | 36     |
+--------------+--------+
| "Tim Duncan" | 33     |
+--------------+--------+

The preceding query returns the name property of the source vertex and the age property of the destination vertex.

nebula> GO FROM "player100" OVER follow YIELD follow.degree;
+---------------+
| follow.degree |
+---------------+
| 95            |
+---------------+
| 90            |
+---------------+

The preceding query returns the degree property of the edge.

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            |
+-------------+-------------+--------------+--------------+

The preceding query returns all the neighbors of vertex "player100" over the follow edges, by referencing follow._src as the source vertex ID (which is "player100") and follow._dst as the destination vertex ID.


Last update: March 23, 2021
Back to top