![](/img/trans.png)
[英]Neo4j, py2neo, Neomodel - Cypher Shortest Path giving error - TypeError: 'NotImplementedType' object is not callable
[英]py2neo Relationship not callable error
我正在使用py2neo REST API通過Mac連接到neo4j 1.9.5版。 我已經使用graph_db.create()
成功創建了三個節點:a,b和c。 然后,我成功使用以下方法在a和b之間創建了一個關系“ MANAGES”: rel, = graph_db.create(rel((a, "MANAGES",b)))
。 但是,當我嘗試使用rel2, = graph_db.create(rel((a, "MANAGES",c)))
在a和c之間創建“ MANAGES”關系時,出現以下錯誤:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: 'Relationship' object is not callable
我尚未為節點或關系創建任何索引。 這可能是問題嗎? 假設一個節點可能與其他節點具有許多相同類型的關系的數據模型,大概沒有問題。
謝謝。
您不小心所做的就是使用您自己的關系變量覆蓋py2neo函數rel
:
rel, = graph_db.create(rel((a, "MANAGES",b)))
^ ^
| |
this overwrites this
因此,簡單的解決方法是選擇另一個名稱:
ab, = graph_db.create(rel((a, "MANAGES",b)))
在那之后,您的后續呼叫應該起作用。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.