简体   繁体   English

Neo4j Cypher查询多个关系的属性

[英]Neo4j Cypher Query on multiple relationship's properties

I updated relationships with properties Expirydate . 我使用属性Expirydate更新了关系。 I want to exclude all expired relationship in my traversal path. 我想在遍历路径中排除所有过期的关系。 The query condition is to check Expirydate through all relationships in path. 查询条件是通过路径中的所有关系检查Expirydate I got the error: 我得到了错误:

==> SyntaxException: ==> ==> Think we should have better error message here? ==> SyntaxException:==> ==>认为我们应该在这里有更好的错误消息? Help us by sending this query to cypher@neo4j.org. 将此查询发送到cypher@neo4j.org,可以为我们提供帮助。

Here is the query: 这是查询:

START sNode=node(530) 
MATCH sNode-[r:hasRegisteredPlate|inHouseHoldWith*1..2]->eNode 
WHERE eNode.NodeType = "Plate" and (rel in r:(not has(rel.ExpiryDate) or 
    (has(rel.ExpiryDate) and (rel.ExpiryDate<>'' or rel.ExpiryDate >'2013-10-04')))) 
RETURN eNode LIMIT 20

Any help is much appreciated 任何帮助深表感谢

You could try using the predicate all . 您可以尝试使用谓词all

START sNode=node(530)
MATCH sNode-[r:hasRegisteredPlate|inHouseHoldWith*1..2]->eNode
WHERE eNode.NodeType = "Plate" and all(rel in r
  WHERE (not(has(rel.ExpiryDate)) or (has(rel.ExpiryDate) and (rel.ExpiryDate<>'' or rel.ExpiryDate>'2013-10-04')))
)
RETURN eNode LIMIT 20

You could also try the inverse 您也可以尝试反向

WHERE eNode.NodeType = "Plate" and none(rel in r
  WHERE (has(rel.ExpiryDate) and rel.ExpiryDate<'2013-10-04')
)

Note that I haven't tried these, if they don't work perhaps you could setup a sample graph in the neo4j console . 请注意,我还没有尝试过这些,如果它们不起作用,也许您可​​以在neo4j控制台中设置示例图。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM