Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如何构建一个 Neo4J 查询:
1) 将返回任意深度子图中的所有节点,其中节点由给定的一组关系连接?
例如在类似 Cypher 的语法中:
MATCH (*)-[r1:FRIEND_OF AND r2:COLLEAGUE_WITH]->(*) RETURN *
正如您在问题中所述,此查询将仅返回节点:
MATCH (n)-[:FRIEND_OF|COLLEAGUE_WITH*]->(m) RETURN n, m;
如果您还想要关系:
MATCH (n)-[r:FRIEND_OF|COLLEAGUE_WITH*]->(m) RETURN n, r, m;