简体   繁体   English

获取所有有关系的节点

[英]Get all nodes with relationships

Tree structure树状结构

I want a query in which if I send Name: "Johnson" it should all nodes that are directly and indirectly connected in a data format shown in the image.我想要一个查询,如果我发送 Name: "Johnson" 它应该所有以图像中显示的数据格式直接和间接连接的节点。 How would I query to get all connected nodes in data format with relationship between primary node and related node?我将如何查询以数据格式获取所有连接节点以及主节点和相关节点之间的关系?

You can use a variable-length relationship pattern.您可以使用变长关系模式。

For example, to get the desired paths from a person named 'Johnson' (which I presume is unique) to each relative:例如,要从名为“Johnson”的人(我认为是独一无二的)到每个亲戚的所需路径:

MATCH path = (p:Person)-[:Father|Mother|Son|daughter|Wife *]-(:Person)
WHERE p.name = 'Johnson'
RETURN path

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

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