Hi,
I have a CSV which has data about multiple types of nodes and the type of relationship between the nodes. Here I have to create a dynamic relationship between the nodes, which I got the ans. Since there are data about multiple types of nodes and their relationship I am not able to call multiple apoc.create.relationship in a single query like
I am getting an error as
I know I can go with multiple queries, but I am curious to know if I can do it in one query.
Thanks in advance.
You can do it together, you need an intermediate WITH
though. Something like this:
CALL apoc.create.relationship(m, rele_1, {}, m) yield rel
WITH rel, m, rele_2, o
CALL apoc.create.relationship(m, rele_2, {}, o) yield rel
return rel;
1 Like
Hie, Thanks a lot for the response, it worked. Well we don't need "rel" in "WITH" as throws error.
1 Like
I've been writing cypher for years and I frequently forget to "carry through the right variables" in my WITH clauses to ensure the clause beneath has what it needs. ;) Some fiddling is expected -- you've got the right idea
1 Like