在 Py2Neo 中创建具有多个标签的节点

Create Node with Multiple Labels in Py2Neo

使用 py2Neo 在 Neo4J 中创建和保存节点。我们有。

tx = graph.begin():
node = Node('Label', property='A'})
tx.create(node) 

就创建具有多个标签的节点而言。文档似乎很安静。 有什么可能吗?

tx = graph.begin()
node = Node(*labels, **properties)
tx.create(node)   # possible

或者我们必须求助于 cyper.run 才能使用原始密码。

谢谢。

您可以只提供标签作为额外参数:

from py2neo import Graph, Node
graph = Graph(password="password")

tx = graph.begin()
node = Node("Label1", "Label2", property="A")
tx.create(node)
tx.commit()