I'm having problems using foreach to create unique and set the new nodes.
Here's a simplified example of what I'm trying to do:
query:
START movie = node(0)
FOREACH(a in {ACTORS} :
CREATE UNIQUE movie-[:CAST {characters: HEAD(a)}]->(actor HEAD(TAIL(a)))
params = {
ACTORS : [["Neo", {name: "Keanu"}, 1234]]
}
In the foreach statement I can do the create unique part just fine, but I also want to set an
actor.id if it doesn't exist. The problem is that SET doesn't seem to recognize actor. Is this because multi part commands inside a foreach aren't allowed or is it something else? Splitting this into multiple foreach statements isn't practical because there's no good way to sync the
actor.id paramater with the right node (maybe with a WHERE, but that'd be really messy).
Also, the foreach documentation is missing SET in it's list of approved commands.
Thanks,
-Mat