首页 > 其他 > 详细

Neo4j/Cypher: All paths between two nodes with a relationship property filter

时间:2019-10-11 10:09:30      阅读:90      评论:0      收藏:0      [点我收藏+]

解决方案一

I am trying to perform a query to retrieve all paths between two nodes a and b in which all the paths there is a relationship property fulfilled.

I have tried in many ways but I am not able to success.

MATCH p=(o{value:"a"})-[r*]-(x{value:"b"}) where has(r.property) and r.property="foo" return p

relationship part i have changed to [r*..] and many other options but not working

The function shortestpath does not help me because I want not only the shortest but all the possibilities.

Can someone help me or tell me which is the error in the query?

Thank you in advance.

解决方案二

What you‘re looking for is the ALL predicate on the relationships collection of the path :

MATCH p=(o{value:"a"})-[r*]-(x{value:"b"})
WHERE ALL(x IN rels(p) WHERE x.property = "foo")
RETURN p

And please use labels !

原文地址:https://stackoverflow.com/questions/39287874/neo4j-cypher-all-paths-between-two-nodes-with-a-relationship-property-filter?rq=1

Neo4j/Cypher: All paths between two nodes with a relationship property filter

原文:https://www.cnblogs.com/jpfss/p/11652209.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!