[英]Cypher Query to get connected nodes from two relations
I'm newbie to Neo4j/GraphDB and have created following simple graph 我是Neo4j / GraphDB的新手,并创建了以下简单图形
node[1]user1 which is 'friend' with node[2]user2 and node[3]user3 and all 3 above user have 'post' nodes connected to them as well.. 与node [2] user2和node [3] user3成为“朋友”的node [1] user1以及上面的所有3个用户也具有与它们连接的“发布”节点。
question is how to get user1's connected friend and their post as well? 问题是如何获得user1的联系朋友及其帖子?
following query returns friends of user1 and his post only... 以下查询仅返回user1的朋友和他的帖子...
START user1=node(2) MATCH user1-->all_node RETURN all_node
Depending on the relationship types you have chosen, something like this should work: 根据您选择的关系类型,类似这样的方法应该起作用:
START user1=node(2)
MATCH user1-[:FRIEND]->friend-[:POST]->post
RETURN friend,post
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.