我如何使用python,py2neo.ogm避免对neo4j中的关系过分了解

时间:2019-04-04 12:30:55

标签: python python-3.x graph neo4j py2neo

所以我已经定义了一个数组,并且想在数组对象和已经使用python py2neo模型创建的节点之间创建关系(我正在使用loop),但是我无法这样做。结果是关系不断被覆盖,最后只有最后一个迭代对象及其关系存在

y = ['D','E']
b= ['C1','C2']
for x in y:
    for a in b:
        tx1=graph.begin()
        tempnode = D()
        tempnode.cluster = True
        tempnode.name=str(x)
        host_node_to_point_to1=C.match(graph,str(a)).first()
        tempnode.linkedto.update(host_node_to_point_to1)
        tx1.merge(tempnode)
        tx1.commit()

期望和实际的输出Output Expected and Actual

0 个答案:

没有答案