表达式
<value1>
CONTAINS <value2>
- 操作数:字符串
- 含义:判断一个字符串是否包含另一个字符串
示例
判断常量
本例判断Graph Database是否包含graph:
return "Graph Database@d134" contains "graph"
0
判断函数值
本例判断Graph Database转为小写后是否包含graph:
return lower("Graph Database@d134") contains "graph"
1
判断别名
本例判断一个别名的每行是否包含graph:
uncollect ["Graph", "grAph", "graph"] as a
return a contains "graph"
0
0
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"}])
本例查询有email属性且该属性值包含ultipa的节点:
find().nodes({email contains "ultipa"}) as n
return n{*}
|--------------- @professor --------------|
| _id | _uuid | age | email |
|-------|-------|-------|-----------------|
| P002 | 2 | 27 | test@ultipa.com |
本例查询email属性值包含ultipa的@professor点:
find().nodes({@professor.email contains "ultipa"}) as n
return n{*}
|--------------- @professor --------------|
| _id | _uuid | age | email |
|-------|-------|-------|-----------------|
| P002 | 2 | 27 | test@ultipa.com |