Skip to content

Reference operators

NGQL provides reference operators to represent a property in a WHERE or YIELD clause, or the output of the statement before the pipe symbol in a composite query.

OpenCypher compatibility

This page applies to nGQL extensions only.

Reference operator List

Reference operator Description
$^ Refers to a source vertex property. For more information, see Property reference.
$$ Refers to a destination vertex property. For more information, see Property reference.
$- Refers to the output of the statement before the pipe symbol in a composite query. For more information, see Pipe.

Examples

The following example returns the age of the source vertex and the destination vertex.

nebula> GO FROM "player100" OVER follow \
        YIELD $^.player.age AS SrcAge, $$.player.age AS DestAge;
+--------+---------+
| SrcAge | DestAge |
+--------+---------+
| 42     | 36      |
+--------+---------+
| 42     | 41      |
+--------+---------+

The following example returns the name and team of the players that "player100" follows.

nebula> GO FROM "player100" OVER follow \
        YIELD follow._dst AS id | \
        GO FROM $-.id OVER serve \
        YIELD $^.player.name AS Player, $$.team.name AS Team;
+-----------------+-----------+
| Player          | Team      |
+-----------------+-----------+
| "Tony Parker"   | "Spurs"   |
+-----------------+-----------+
| "Tony Parker"   | "Hornets" |
+-----------------+-----------+
| "Manu Ginobili" | "Spurs"   |
+-----------------+-----------+

Last update: March 23, 2021