我想在 py2neo v3 中创建两个不同类型的现有节点之间的关系,这只能使用 Cypher 执行来完成还是有一个函数(也许是合并)应该这样做?
例如
from py2neo import Graph, Path, authenticate, GraphObject
from py2neo import Node, Relationship
from py2neo.ogm import *
a = Node("type1",name = "alice")
graph.create(a)
b = Node("type2",name = "bob")
graph.create(b)
#now I want to make a relationship of these nodes without using a, b or Relationship
#Hence something like:
graph.merge(Node("type1",name = "alice"),"FRIENDS_WITH",Node("type2",name = "bob"))
Run Code Online (Sandbox Code Playgroud)
关键是如果 alice 有很多朋友,我提前把他们都做了,因为他们在我想要的字典中有各种其他属性已经循环并制作了节点,我如何将 alice 与这些朋友联系起来而不创建额外的爱丽丝?我认为合并会起作用,但我不明白它的语法。