这是我第一次在创建节点和关系时,一切都很顺利。
// This is the first run
MERGE (Kunal:PERSON)
ON CREATE SET
Kunal.name = 'Kunal',
Kunal.type = 'Person',
Kunal.created = timestamp()
ON MATCH SET
Kunal.lastUpdated = timestamp()
MERGE (Bangalore: LOC)
ON CREATE SET
Bangalore.name = 'Bangalore',
Bangalore.type = 'Location',
Bangalore.created = timestamp()
ON MATCH SET
Bangalore.lastUpdated = timestamp()
MERGE (Kunal)-[r1:LIVES_IN]->(Bangalore)
RETURN *
这里我添加了一个节点
(节点)生活在(关系)中的人
(节点)。第一次一切都很好。
// Next time
MERGE (John:PERSON)
ON CREATE SET
John.name = 'John',
John.type = 'Person',
John.created = timestamp()
ON MATCH SET
John.lastUpdated = timestamp()
MERGE (Bangalore: LOC)
ON CREATE SET
Bangalore.name = 'Bangalore',
Bangalore.type = 'Location',
Bangalore.created = timestamp()
ON MATCH SET
Bangalore.lastUpdated = timestamp()
MERGE (John)-[r1:LIVES_IN]->(Bangalore)
RETURN *
约翰
谁住在(rel)
但这里的问题是,它再次从前面的merge语句中获取相同的节点值。
有人能解释一下吗?
另外,如果我们使用Python驱动程序在循环中运行上述合并查询,那么解决方案是什么。
Can't find anything on this tho