0
votes

I am using py2neo REST API to connect to neo4j version 1.9.5 via a Mac. I have successfully created three nodes: a, b and c using graph_db.create(). Then I successfully created a relationship "MANAGES" between a and b using: rel, = graph_db.create(rel((a, "MANAGES",b))). However, when I try to create a "MANAGES" relationship between a and c, using rel2, = graph_db.create(rel((a, "MANAGES",c))), I get the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'Relationship' object is not callable

I have not created any indexes for the nodes or relationships. Could that be the problem? Presumably there is no problem assuming a data model where a node may have many relationships of the same type with other nodes.

Thanks.

1

1 Answers

0
votes

What you've accidentally done there is to override the py2neo function rel with you own relationship variable:

rel, = graph_db.create(rel((a, "MANAGES",b)))
 ^                      ^
 |                      |
this             overwrites this

So the easy fix is to pick another name:

ab, = graph_db.create(rel((a, "MANAGES",b)))

After that, your subsequent call should work.