neo4j 多节点标签下,StartNode固定,查询最近的所有同标签endNode
红色节点都是人, 以红框人物为条件,查询所有有关系的一级人物 目前使用的是UNION拼接,还有其他方案么,求助
MATCH (a:People{name:‘何成’})-[r]-(b:People) RETURN a.name as 目标A,b.name as 名字,type® as 关系 UNION MATCH (a:People{name:‘何成’})-[r]-()-[]-(b:People) RETURN a.name as 目标A,b.name as 名字,type® as 关系 UNION MATCH (a:People{name:‘何成’})-[]-()-[r]-()-[]-(b:People) RETURN a.name as 目标A,b.name as 名字,type® as 关系
1 回复
根据路径查,比如查3度关联以内的: match p=(:People{name:‘何成’})-[*…3]-(m:People) with m.name as name,relationships§ as rels return name,rels