为什么我不能在合并中使用唯一的创建? Neo4j返回"未知错误"
Merge (o:Ot {name:"md2"} )
MERGE (pd:PD { p:"23"})
MERGE (tg:Ot {name:"XXX"})
MERGE (pi:PI { id:"123"})
WITH o,pi,target,pd
Create UNIQUE (o)-->(pi)-->(pd) , (pi)-->(tg)
RETURN o,pi,pd,tg
答案 0 :(得分:2)
target
条款中有WITH
。它应该是tg
。CREATE
两个节点之间的关系时,你必须至少指定关系类型。例如,此查询将起作用:
MERGE (o:Ot {name:"md2"})
MERGE (pd:PD { p:"23"})
MERGE (tg:Ot {name:"XXX"})
MERGE (pi:PI { id:"123"})
WITH o,pi,tg,pd
CREATE UNIQUE (o)-[:x]->(pi)-[:y]->(pd), (pi)-[:z]->(tg)
RETURN o,pi,pd,tg