在现有节点上创建关系neo4jrestclient

时间:2017-02-07 18:19:20

标签: python neo4j neo4jrestclient

我正在尝试使用neo4jrestclient并尝试在现有节点上创建关系

movie = db.labels.get('Movie')
u1 = db.nodes.create(title="titanic")
movie.add(u1)
person = db.labels.get('person')
person.get(name ='abc').relationships.create("ACTS_IN", u1)

AttributeError:' Iterable'对象没有属性'关系'

使用退出代码1完成处理

1 个答案:

答案 0 :(得分:0)

http://neo4j-rest-client.readthedocs.io/en/latest/labels.html我所知,person.get(name ='abc')正在返回一个列表(或其他类似列表的内容)。

如果您知道只有一个人名为'abc',您可以

person.get(name='abc')[0].relationships.create("ACTS_IN",u1)

如果可能有更多(或可能为零),例如:

for p in person.get(name='abc'):
   p.relationships.create("ACTS_IN",u1)

应该有效

相关问题