- 表达式:
<value>
<=> [<lower>
,<upper>
] - 操作数:数字、时间、字符串
判断常量
示例:判断 abc 是否位于闭区间 ["123", "abc"] 内
return "abc" <=> ["123", "abc"]
1
判断函数值
示例:判断 PI 是否位于闭区间 [3.14, 3.15] 内
with [3.14, 3.15] as a
return pi() <=> [a[0], a[1]]
1
判断别名
示例:判断一个别名中的每一行是否位于闭区间 [2, 4] 内
uncollect [1,2,3,2,2] as a
return a <=> [2, 4]
0
1
1
1
1
示例图集:(以下示例将在本图基础上运行)
在空图集中依次运行以下各行代码以创建该图数据: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:"test@yahoo.cn"},{_id:"P002",_uuid:2,age:27,email:"test@ultipa.com"}])
insert().into(@student).nodes([{_id:"S001",_uuid:3,age:27,email:"test@yeah.net"},{_id:"S002",_uuid:4,age:20,email:"test@w3.org"},{_id:"S003",_uuid:5,age:25,email:"test@gmail.com"}])
过滤属性值
示例:获取 age 在闭区间 [25, 35] 内的节点
find().nodes({age <=> [25, 35]}) as n
return n{*}
|--------------- @professor --------------|
| _id | _uuid | age | email |
|-------|-------|-------|-----------------|
| P002 | 2 | 27 | test@ultipa.com |
|---------------- @student ---------------|
| _id | _uuid | age | email |
|-------|-------|-------|-----------------|
| S001 | 3 | 27 | test@yeah.net |
| S003 | 5 | 25 | test@gmail.com |
示例:获取 age 在闭区间 [25, 35] 内的 @professor 点
find().nodes({@professor.age <=> [25, 35]}) as n
return n{*}
|--------------- @professor --------------|
| _id | _uuid | age | email |
|-------|-------|-------|-----------------|
| P002 | 2 | 27 | test@ultipa.com |