我正在通过py2neo模块学习neo4j。修改示例时,我对为什么会在此处出现错误感到困惑。如果我想删除所有
这会导致以下错误:
Person
类型的节点,为什么不能遍历图形并删除与我的条件匹配的节点?如果节点之间的关系被删除,代码就可以正常运行。from py2neo import Node, Relationship, Graph
g = Graph("http://neo4j:test@localhost:7474/db/data/")
g.delete_all()
alice = Node("Person", name="Alice")
bob = Node("Person", name="Bob")
g.create(Relationship(alice, "KNOWS", bob)) # Works if this is not present
for x in g.find("Person"):
print x
g.delete(x)
这会导致以下错误:
File "start.py", line 12, in <module>
g.delete(x)
...
py2neo.error.TransactionFailureException: Transaction was marked as successful, but unable to commit transaction so rolled back.