Graph Data Modeling Fundamentals Adding a role node

helpp, im stuck at this question. can anybody help? it is the learning module in neo4j

Write and run refactor code to:

  1. Find an actor that acted in a Movie ( MATCH (a:Actor)-[r:ACTED_IN]-(m:Movie) )
  2. Create (using MERGE ) a Role node setting it’s name to the role in the ACTED_IN relationship.
  3. Create (using MERGE ) the PLAYED relationship between the Actor and the Role nodes.
  4. Create (using MERGE ) the IN_MOVIE relationship between the Role and the Movie nodes.
  5. Remove the role property from the ACTED_IN relationship (set it to null)

MATCH (a:Actor)-[r:ACTED_IN]-(m:Movie) MERGE (x:Role {name: r.role}) MERGE (a)-[:PLAYED]→(x) MERGE (x)-[:IN_MOVIE]→(m) SET r.role = null
This is given as the solution code but it's not working. I Updated it as below, still not working. Can somebody help?
MATCH (a:Actor)-[r:ACTED_IN]-(m:Movie) WHERE r.role is NOT NULL MERGE (x:Role {name: r.role}) MERGE (a)-[:PLAYED]-(x) MERGE (x)-[:IN_MOVIE]-(m) SET r.role = null

Hello @prabhitha3 and welcome to the Neo4j Community!

What error are you getting when you run the solution code?

It is possible that your graph has been refactored to a state that is not expected in the challenge.
I recommend that you do the following:

  1. Go to the sandbox.neo4j.com site and terminate your blank sandbox used for this course.
  2. Re-enter the challenge which will re-create the sandbox and reset the database to what it should be before you start the challenge.
  3. Attempt the challenge again.

Elaine