- Expression: !
<exp>
- Operand: expression (true, false)
<exp> | Result |
---|---|
0 | 1 |
1 | 0 |
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]"}])
Common Usage
Example: Find nodes of @student, whose age is not 27
find().nodes({@student && !(age==27)}) as n
return n{*}
|---------------- @student ---------------|
| _id | _uuid | age | email |
|-------|-------|-------|-----------------|
| S002 | 4 | 20 | [email protected] |
| S003 | 5 | 25 | [email protected] |
Analysis: This filter cannot be composed as {!(@student.age == 27)}
, which is equivalent to {!@student || !(age == 27)}
and outputs:
|--------------- @professor --------------|
| _id | _uuid | age | email |
|-------|-------|-------|-----------------|
| P001 | 1 | 53 | [email protected] |
| P002 | 2 | 27 | [email protected] |
|---------------- @student ---------------|
| _id | _uuid | age | email |
|-------|-------|-------|-----------------|
| S002 | 4 | 20 | [email protected] |
| S003 | 5 | 25 | [email protected] |