neo4j - Get all nodes with relationships
问题描述
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. How would I query to get all connected nodes in data format with relationship between primary node and related node?
解决方案
您可以使用可变长度的关系模式。
例如,要从名为“Johnson”的人(我认为它是唯一的)到每个亲戚获取所需的路径:
MATCH path = (p:Person)-[:Father|Mother|Son|daughter|Wife *]-(:Person)
WHERE p.name = 'Johnson'
RETURN path
推荐阅读
- minikube - minikube 间歇性 ErrImageNeverPull
- c++ - 复制构造函数在这段代码中是如何工作的?
- javascript - 阻止用户在基于画布的游戏运行时使用箭头键滚动
- javascript - Javascript函数不是由asp.net的按钮点击触发的
- linux - 通过最重要的或手术刀恢复 kubelet.conf
- faunadb - 使用日期和 JavaScript 的首选方式是什么?
- sql-server - 如何将 SSIS 目录从一台服务器移动到另一台服务器
- c++ - c++ 不同类同名的全局变量
- php - 调用未定义函数 curl_init() php 7.2.34
- angular - Angular + Bazel + Socket.IO:TypeError:decodePacket 不是函数