UltipaDocs
Try Playground
  • Introduction
  • Terminologies
    • Reserved Words
    • Data Types
    • Alias
    • Operators
    • Expression
    • Filter
    • Prefix
    • Node and Edge Templates
    • Homologous and Heterologous Data
    • Clause Execution Times
    • Graphset
    • Schema
    • Property
    • Insert
    • Overwrite
    • Upsert
    • Update
    • Delete
    • Find Nodes
    • Find Edges
      • AB
      • Autonet
      • Spread
      • Path Template
      • K-Hop
      • K-Hop Template
    • Find Subgraphs
    • GROUP BY
    • ORDER BY
    • SKIP
    • LIMIT
    • WHERE
    • RETURN
    • WITH
    • UNCOLLECT
    • UNION
    • UNION ALL
    • CALL
    • BATCH
      • Schema Checker
      • Equal
      • Not Equal
      • Less Than
      • Greater Than
      • Less Than or Equal
      • Greater Than or Equal
      • Between
      • Between or Equal
      • Beong to
      • Not Belong To
      • CONTAINS | String
      • CONTAINS | Full-Text
      • Regular Match
      • IS NULL
      • IS NOT NULL
      • And
      • Or
      • Not
      • Exclusive OR
      • DISTINCT
      • toString()
      • toInteger()
      • toFloat()
      • toDouble()
      • toDecimal()
      • toSet()
      • castToRaw()
      • now()
      • dateAdd()
      • dateDiff()
      • year()
      • month()
      • day()
      • dayOfWeek()
      • dateFormat()
      • point()
      • distance()
      • pointInPolygon()
      • lower()
      • upper()
      • reverse()
      • startsWith()
      • endsWith()
      • JSON_decode()
      • JSON_merge()
      • trim()
      • ltrim()
      • rtrim()
      • left()
      • right()
      • substring()
      • replace()
      • split()
      • intersection()
      • difference()
      • listUnion()
      • size()
      • head()
      • reduce()
      • listContains()
      • append()
      • pi()
      • pow()
      • sqrt()
      • abs()
      • floor()
      • ceil()
      • round()
      • sin()
      • cos()
      • tan()
      • cot()
      • asin()
      • acos()
      • atan()
      • length()
      • pnodes()
      • pedges()
      • count()
      • sum()
      • max()
      • min()
      • avg()
      • stddev()
      • collect()
      • dedup()
      • CASE
      • table()
      • coalesce()
      • ifnull()
    • Acceleration
    • Index
    • Full-text
    • LTE
    • Real-time Process
    • Backend Task
    • Analytics Node
    • Server Statistics
    • Server Backup
    • Privilege
    • Policy
    • User
  • Trigger
  1. Docs
  2. /
  3. UQL
  4. /
  5. Conditional Operator

Belong to

  • Expression: <value> IN <list>
  • Left operand: string, number, time, list, point, NODE, EDGE
  • Right operand: list

Constant

Example: Judge whether 2 belongs to [1,2,3]

UQL
return 2 in [1,2,3]
Result
1

Function

Example: Judge whether 2 belongs to the intersection of [1,2,3] and [3,2,5]

UQL
return 2 in intersection([1,2,3], [3,2,5])
Result
1

Alias

Example: Judge each row of an alias whether it belongs to [0,1,3]

UQL
uncollect [1,2,3,2,2] as a
return a in [0,1,3]
Result
1
0
1
0
0

Sample graph: (to be used for the following examples)

Run below UQLs one by one in an empty graphset to create graph data: ```customlang___fold__lang_uql 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 belongs to [20,25,30,35]

UQL
find().nodes({age in [20,25,30,35]}) as n
return n{*} 
Result
|---------------- @student ---------------|
|  _id  | _uuid |  age  |       email     |
|-------|-------|-------|-----------------|
| S002  |   4   |  20   | [email protected]     |
| S003  |   5   |  25   | [email protected]  |

Example: Find nodes of @professor, whose age belongs to [20,25,30,35]

UQL
find().nodes({@professor.age in [20,25,30,35]}) as n
return n{*} 
Result
No return data

_uuid (Abbreviated)

When a filter only judges whether the _uuid of the current node/edge belongs to a list of integers, the filter can be abbreviated as below:

Standard Form
Abbreviated Form
Specification
({ _uuid in [1,2,3]})([1,2,3])
({ _uuid in intList})(intList)intList is the alias of an interger list
({ _uuid in [node1._uuid, node2._uuid, ...]})(nodeList)nodeList is the alias of [node1, node2, ...]
({ _uuid in [edge1._uuid, edge2._uuid, ...]})(edgeList)edgeList is the alias of [edge1, edge2, ...]

Example: Find node whose _uuid belongs to [2,3,5]

UQL
find().nodes([2,3,5]) as n
return n{*} 
Result
|---------------- @student ---------------|
|  _id  | _uuid |  age  |       email     |
|-------|-------|-------|-----------------|
| S001  |   3   |  27   | [email protected]   |
| S002  |   4   |  20   | [email protected]     |
| S003  |   5   |  25   | [email protected]  |