我有一个简单的 Neo4J 数据库,有 6 个节点和以下关系:
(n0:A {my_id:1})-[:A]->(n1)
(n1)-[:B]->(n2)
(n2)-[:C]->(n3)
(n3)-[:B]->(n4)
(n4)-[:A]->(n5:A)
运行以下 apoc 查询不会返回任何内容:
match(n {my_id:1})
with (n)
call apoc.path.expandConfig(n,{relationshipFilter: "A|B|C",
labelFilter: "/A",
uniqueness: 'RELATIONSHIP_GLOBAL',
minLevel:1, maxLevel: 20,
filterStartNode:false}) yield path as path
return path
运行以下 apoc 查询时,会返回从 n0 到 n5 的路径:
match(n {my_id:1})
with (n)
call apoc.path.expandConfig(n,{relationshipFilter: "",
labelFilter: "/A",
uniqueness: 'RELATIONSHIP_GLOBAL',
minLevel:1, maxLevel: 20,
filterStartNode:false}) yield path as path
return path
唯一的区别在于 relationshipFilter。你能告诉我我做错了什么吗?
谢谢 !