如何在一个请求中创建多个关系? 以下示例请求导致以下错误:Neo.ClientError.Statement.InvalidSyntax"," message":"在CREATE UNIQUE和MATCH之间需要WITH(第1行,第281列) 终点: 事务性Cypher HTTP端点 http://localhost:7474/db/data/transaction/commit
请求:
{"statements":[{"statement":"
MATCH (nA0:Test{name:'Test B'}), (nB0:Test{name:'Test A'})
CREATE UNIQUE (nA0)-[r:has_parent]->(nB0)
MATCH(nA1:Test{name:'Test C'}), (nB1:Test{name:'Test A'})
CREATE UNIQUE (nA1)-[r:has_parent]->(nB1)"}]}
如果我只提交一个MATCH ... CREATE UNIQUE语句,是否需要特定的分隔符?
非常感谢!
编辑: 将语句分组为单个MATCH和CREATE UNIQUE是可行的,但语句的分离将更适合我的目的。
{"statements":[{"statement":" MATCH(nSrc0:Test{name:'Test B'}),(nTrgt0:Test{name:'Test A'}),(nSrc1:Test{name:'Test C'}),(nTrgt1:Test{name:'Test A'}) CREATE UNIQUE (nSrc0)-[r0:has_parent]->(nTrgt0), (nSrc1)-[r1:has_parent]->(nTrgt1)"}]}
答案 0 :(得分:1)
因为错误说你必须在CREATE UNIQUE和下一个MATCH之间添加一个WITH来将写入与read子句分开。
请参阅:
{"statements":[
{"statement":
"MATCH (a:Test{name:{name_a}}), (b:Test{name:{name_b}}) MERGE (a)-[:has_parent]->(b)",
"parameters":{"name_a":"Test B","name_b":"Test A"}},
{"statement":
"MATCH (a:Test{name:{name_a}}), (b:Test{name:{name_b}}) MERGE (a)-[:has_parent]->(b)",
"parameters":{"name_a":"Test C","name_b":"Test A"}},
...
]}