[英]When doing a match with the traverse function with all equals
In Orient DB, I understand a query like this: 在Orient DB中,我了解如下查询:
match
{class: someNode, as: someNode, where: (id='123')}
.out() {class: someNode as: relatedNode, while:(true), where:(relevance = true)}
return
someNode
Will return someNode with ID 123 if any outnodes has relevance = true. 如果有任何外节点具有相关性= true,则将返回ID 123的someNode。 However, what if i want ALL outgoing nodes to be relevance = true connected to someNode? 但是,如果我希望所有传出节点都关联= true连接到someNode怎么办? Can I still do a match starting at someNode 123 going out where all = true? 我是否仍可以从someNode 123开始进行匹配,其中all = true?
You can try the following: 您可以尝试以下方法:
match
{class: someNode, as: someNode,
where: (id='123' AND out()[relevance != true).size() = 0}
return someNode
[edit] [编辑]
If you need also connected nodes with the same features, you can do the following: 如果还需要具有相同功能的连接节点,则可以执行以下操作:
match
{class: someNode, as: someNode,
where: (id='123' AND out()[relevance != true).size() = 0}
.out(){class: someNode, as: anotherNode,
while: (relevance = true AND out()[relevance != true).size() = 0)
where: (relevance = true AND out()[relevance != true).size() = 0}
return someNode
You can change the WHILE and WHERE conditions to slightly change the behavior regarding which nodes you want to include/exclude based on relevance flag 您可以更改WHILE和WHERE条件,以根据相关性标记略微更改有关要包含/排除的节点的行为
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.