如何用py2n匹配从a到B的节点

2024-05-15 14:31:13 发布

您现在位置:Python中文网/ 问答频道 /正文

我有这个密码

MATCH(qs:Persons)<-[r0:CONNECTED_TO]-(qi0:Documents)-[r1:LOCATED_IN]->(qe:Locations) return qs

我想在DSL py2neo中创建相同的结果。你知道吗

到现在为止我还有这个

graph = py2neo.Graph("bolt://localhost:7687", auth=("neo4j", "neo4j"))
matcher = py2neo.NodeMatcher(graph)

qs = matcher.match("Persons",name = "Jhon").first()
qi = matcher.match("Documents")
print list(     graph.relationships.match( (qs, qi), "CONNECTED_TO"   )  )

但该代码引发了以下例外。你知道吗

ValueError("Node %r does not belong to this graph" % n)

如何用py2neo创建相同的密码?你知道吗


Tags: to密码matchmatcherdocumentsgraphneo4jpy2neo