Expression, Operand
==
judges whether the given value equals another value.
Syntax:
- Expression:
<value1>
==<value2>
- Operand: ATTR (number, time, string)
- Abbreviated form: when judging whether the UUID of the current node/edge equals an integer or the UUID of a certain node/edge alias, the filter can be abbreviated as the integer or the node/edge alias without the curly bracket
Standard Form | Abbreviated Form | Description |
---|---|---|
({ _uuid == 10}) | (10) | |
({ _uuid == num }) |
(num ) |
num is the alias of an integer |
({ _uuid == n ._uuid}) |
(n ) |
n is the alias of a node |
({ _uuid == e ._uuid}) |
(e ) |
e is the alias of an edge |
Constant
Example: judge whether "Ultipa" equals "Ultipa"
return "Ultipa" == "U1tipa"
Function
Example: judge whether PI equals 3
return pi() == 3
Alias
Example: find nodes whose levels are 1, return 10 nodes with all properties
find().nodes() as n
where n.level == 1
limit 10
return n{*}
Property
Example: Find information of 10 bank cards
find().nodes({@ == "card"}) as n
limit 10
return n{*}
Analysis: we can also use another expression {@card}
, see Conditional Operators @
.
Example: Find 10 nodes at level 1
find().nodes({@card.level == 1}) as n
limit 10
return n{*}
Example: Find 10 bank cards at level 1
find().nodes({@card.level == 1})
return nodes{*} limit 10
UUID (Abbreviated)
Example: Find 1-hop neighbors of node whose UUID is 1, then find 1-hop neighbors of these neighbors, return deduplicated results
khop().src({_uuid == 1}).depth(1) as neighbor1
khop().src({_uuid == neighbor1._uuid}).depth(1) as neighbor2
return distinct(neighbor2)