我有一个简单的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 。 你能告诉我我做错了吗?
谢谢!