与遍历函数匹配时,所有等于

时间:2018-01-09 14:33:06

标签: orientdb orientdb-2.1

在Orient DB中,我理解如下查询:

match 
  {class: someNode, as: someNode, where: (id='123')}
  .out() {class: someNode as: relatedNode, while:(true), where:(relevance = true)}
return
  someNode

如果任何outnodes具有相关性= true,则返回ID为123的someNode。但是,如果我希望所有传出节点都是相关性= true连接到someNode怎么办?我是否仍然可以在someNode 123开始进行匹配,其中all = true?

1 个答案:

答案 0 :(得分:0)

您可以尝试以下操作:

match 
  {class: someNode, as: someNode, 
   where: (id='123' AND out()[relevance != true).size() = 0}
return someNode

[编辑]

如果您还需要具有相同功能的已连接节点,则可以执行以下操作:

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

您可以更改WHILE和WHERE条件,以根据相关性标记略微更改要包含/排除哪些节点的行为