因此,对于空数据库,MERGE (N1:A {name:"A"})-[:r]->(N2:B {name:"B"})
将创建两个节点N1
和{
from py2neo import Graph, authenticate, rel, Node
graph = Graph()
# set up authentication parameters
authenticate("localhost:7474", <user>, <password>)
# clear the data base
graph.delete_all()
graph.merge(rel(Node("A" , name="A"), "r", Node("B" , name="B")))
运行该脚本会导致数据库仍然为空。为什么是这样?我如何才能在不使用graph.cypher.execute("MERGE ...")
的情况下从py2neo获得Cypher合并行为?在
在Py2neo中,^{} 通过标签和(可选)属性匹配或创建一个节点,您希望在其中合并整个模式(节点、关系、其他节点)。在
Cypher
MERGE
语句使用的模式似乎在Cypher之外的Py2neo中不受支持。在下面是一个关于如何合并两个节点的关系的示例。在
结果是:
相关问题 更多 >
编程相关推荐