简体   繁体   English

neo4j Cypher查询

[英]neo4j Cypher Query

i have a following graph in neo4j graph database and by using the cypher query language, i want to retrieve the whole data with is connected to root node and their child node. 我在neo4j图数据库中有一个以下图表,通过使用密码查询语言,我想检索连接到根节点及其子节点的整个数据。

For example : 例如 :

kindly find the below graph image. 请找到下面的图形图像。

[As per the image, node 1 has two child and their child also have too many child with the same relationship. [根据图像,节点1有两个孩子,他们的孩子也有太多的孩子有相同的关系。 now what i want, using Cypher, i hit the node 1 and it should response with the whole data of child node and there child node and so on, relationship between nodes are "Parent_of" relationship.] 现在我想要的是,使用Cypher,我点击节点1,它应该响应子节点的整个数据和子节点等,节点之间的关系是“Parent_of”关系。

在此输入图像描述

can anyone help me on this. 谁可以帮我这个事。

start n=node(1) // use the id, or find it using an index
match n-[:parent_of*0..]->m
return m

will get you all the graph nodes in m. 将以m为单位获取所有图形节点。 You could also take m.some_property instead of m if you don't want the node itself, but some property that is stored in your nodes. 如果您不想要节点本身,也可以使用m.some_property而不是m ,但是某些属性存储在节点中。

Careful though, as the path has no limit, this query could become pretty huge in a large graph. 但是要小心,因为路径没有限制,这个查询在大图中可能变得相当大。

您可以在此处查看*0..的示例: http//gist.neo4j.org/?6608600

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

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