- Expression:
<value1>
==<value2>
- Operand: number, time, string
Constant
Example: Judge whether "Ultipa" equals "U1tipa"
return "Ultipa" == "U1tipa"
0
Function
Example: Judge whether PI equals 3
return pi() == 3
0
Alias
Example: Judge each row of an alias whether it equals 2
uncollect [1,2,3,2,2] as a
return a == 2
0
1
0
1
1
Sample graph: (to be used for the following examples)
Run below UQLs one by one in an empty graphset to create graph data:create().node_schema("professor").node_schema("student")
create().node_property(@*, "age", int32).node_property(@*, "email", string)
insert().into(@professor).nodes([{_id:"P001",_uuid:1,age:53,email:"[email protected]"},{_id:"P002",_uuid:2,age:27,email:"[email protected]"}])
insert().into(@student).nodes([{_id:"S001",_uuid:3,age:27,email:"[email protected]"},{_id:"S002",_uuid:4,age:20,email:"[email protected]"},{_id:"S003",_uuid:5,age:25,email:"[email protected]"}])
Property
Example: Find nodes whose age is 27
find().nodes({age == 27}) as n
return n{*}
|--------------- @professor --------------|
| _id | _uuid | age | email |
|-------|-------|-------|-----------------|
| P002 | 2 | 27 | [email protected] |
|---------------- @student ---------------|
| _id | _uuid | age | email |
|-------|-------|-------|-----------------|
| S001 | 3 | 27 | [email protected] |
Example: Find nodes of @professor, whose age is 27
find().nodes({@professor.age == 27}) as n
return n{*}
|--------------- @professor --------------|
| _id | _uuid | age | email |
|-------|-------|-------|-----------------|
| P002 | 2 | 27 | [email protected] |
_uuid (Abbreviated)
When a filter only judges whether the _uuid
of the current node/edge equals an integer, the filter can be abbreviated as below:
Standard Form | Abbreviated Form | Description |
---|---|---|
({ _uuid == 10}) | (10) | |
({ _uuid == int }) |
(int ) |
int is the alias of an integer |
({ _uuid == node ._uuid}) |
(node ) |
node is the alias of a node |
({ _uuid == edge ._uuid}) |
(edge ) |
edge is the alias of an edge |
Example: Find node with _uuid
1
find().nodes(1) as n
return n{*}
|--------------- @professor --------------|
| _id | _uuid | age | email |
|-------|-------|-------|-----------------|
| P001 | 1 | 53 | [email protected] |