So, for an empty database MERGE (N1:A {name:"A"})-[:r]->(N2:B {name:"B"})
will create two nodes N1
and N2
with an edge r
between them. The following python code however does not do that... but why? Should it 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")))
Running that script results in a still empty database. Why is that and how can I get the Cypher merge behaviour from py2neo without using graph.cypher.execute("MERGE ...")
?