- 表达式:@
<schema>
- 操作数:字符串常量
与属性判断联合使用时,即将
@<schema> && <property> == 123
简写为@<schema>.<property> == 123
时,<property>
不能为 _id 或 _uuid
过滤器中的
@<schema>
、@<schema>.<property>
表示对元数据的 schema、属性进行过滤,不同于在其他一些链式语句参数中使用@<schema>
、@<schema>.<property>
对图模型中的 schema、属性进行过滤,请与《图集|模式|属性》-《模式》、《图集|模式|属性》-《属性》中关于符号 @ 的使用加以区分。
示例图集:(以下示例将在本图基础上运行)
在空图集中依次运行以下各行代码以创建该图数据: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"}])
过滤 Schema
示例:获取 @student 点
find().nodes({@student}) as n
return n{*}
|---------------- @student ---------------|
| _id | _uuid | age | email |
|-------|-------|-------|-----------------|
| S001 | 3 | 27 | test@yeah.net |
| S002 | 4 | 20 | test@w3.org |
| S003 | 5 | 25 | test@gmail.com |
分析:该过滤器等效于 {this.@ == "student"}
过滤 Schema 与属性值
示例:获取 age 为 27 的 @student 点
find().nodes({@student.age == 27}) as n
return n{*}
|---------------- @student ---------------|
| _id | _uuid | age | email |
|-------|-------|-------|-----------------|
| S001 | 3 | 27 | test@yeah.net |
分析:该过滤器等效于 {@student && age == 27}
。