【发布时间】:2016-07-06 07:55:02
【问题描述】:
因此,对于一个空数据库MERGE (N1:A {name:"A"})-[:r]->(N2:B {name:"B"}) 将创建两个节点N1 和N2,它们之间有一条边r。但是,以下 python 代码 not 不会这样做...但是为什么呢?不应该吗?
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 合并行为?
【问题讨论】:
标签: python merge neo4j cypher py2neo