I am attempting to use two separate lists to create nodes/relationships in cypher.
My current solution is:
MERGE (t:Test)
WITH t
UNWIND ["a","b"] AS name // first list
MERGE (t)-[:FOO_REL]->(a:Foo { name: name })
WITH DISTINCT t
...
I honestly ain't sure what you're asking, but you certainly don't need to use UNWIND just because you're using MATCH. Here's an example for the movie recommendation dataset that comes with Neo4J:
MATCH (m:Movie {title:"Toy Story"})
FOREACH (usr in [{...
I ended up using FOREACH instead of UNWIND . Since this uses parentheses around the inner query, they are clearly delimited from eachother:
MERGE (t:Test)
FOREACH (name in ["a","b"] |
MERGE (t)-[:FOO_REL]->(a:Foo { name: name })
)
FOREACH (id in ...