I am currently doing this Cypher Graph Modelling Course Adding a Role Node | GraphAcademy (neo4j.com)
I was wondering why don't we need the with keyword in the example shown?
// Find an actor that acted in a Movie
MATCH (a:Actor)-[r:ACTED_IN]->(m:Movie)
// Create a Role node
MERGE (x:Role {name: r.role})
// Create the PLAYED relationship
// relationship between the Actor and the Role nodes.
MERGE (a)-[:PLAYED]->(x)
// Create the IN_MOVIE relationship between
// the Role and the Movie nodes.
MERGE (x)-[:IN_MOVIE]->(m)
I thought it should look something like:
WITH r.role as role
MERGE (x:Role {name: role})
Why is it that the variables: a, r, m, x are available in the later clauses without using the WITH keyword?
I remember in other examples in the tutorial, the WITH keyword was used.