Neo4j 是否可以在一个密码脚本中使用 2 CALL apoc.merge.relationship 调用?
Neo4j Is it possible to use 2 CALL apoc.merge.relationship calls in one cypher script?
如果您有 3 个节点和两个关系,是否可以在一个密码脚本中使用 2 个 CALL apoc.merge.relationship
调用?
例如,您有 3 个合并调用来从 csv 中获取数据:
MERGE (a:Sender { name: row.From})
MERGE (b:Url { name: row.Url_Sub_Fld})
MERGE (c:Recipient { name: row.To})
然后是:
WITH a,b,c,row
然后 2 apoc.merge.relationship(
次调用
CALL apoc.merge.relationship(a, row.Outcome, {}, {}, b)
CALL apoc.merge.relationship(b, row.Outcome, {}, {}, c)
是的,但您确实需要在每次调用中包含至少一个 YIELDed 变量。由于这是被调用的相同过程,因此您需要为生成的变量设置别名,以免发生冲突。
...
CALL apoc.merge.relationship(a, row.Outcome, {}, {}, b) YIELD rel as rel1
CALL apoc.merge.relationship(b, row.Outcome, {}, {}, c) YIELD rel as rel2
如果您有 3 个节点和两个关系,是否可以在一个密码脚本中使用 2 个 CALL apoc.merge.relationship
调用?
例如,您有 3 个合并调用来从 csv 中获取数据:
MERGE (a:Sender { name: row.From})
MERGE (b:Url { name: row.Url_Sub_Fld})
MERGE (c:Recipient { name: row.To})
然后是:
WITH a,b,c,row
然后 2 apoc.merge.relationship(
次调用
CALL apoc.merge.relationship(a, row.Outcome, {}, {}, b)
CALL apoc.merge.relationship(b, row.Outcome, {}, {}, c)
是的,但您确实需要在每次调用中包含至少一个 YIELDed 变量。由于这是被调用的相同过程,因此您需要为生成的变量设置别名,以免发生冲突。
...
CALL apoc.merge.relationship(a, row.Outcome, {}, {}, b) YIELD rel as rel1
CALL apoc.merge.relationship(b, row.Outcome, {}, {}, c) YIELD rel as rel2