Skip to content

Instantly share code, notes, and snippets.

@vladbatushkov
Last active May 5, 2019 08:26
Show Gist options
  • Save vladbatushkov/b95f9a46c72d433f1a6b5e7454bdb6be to your computer and use it in GitHub Desktop.
Save vladbatushkov/b95f9a46c72d433f1a6b5e7454bdb6be to your computer and use it in GitHub Desktop.
Connect vehicels nd starships with films they are appeared in.
WITH "https://vbatushkov.bitbucket.io/swapi.json" AS url
CALL apoc.load.json(url) YIELD value
UNWIND value.films as film
UNWIND film.starships as starship_url
MATCH (f:Film { url: film.url })
MATCH (s:Starship { url: starship_url })
MERGE (s)-[:APPEARED_IN]->(f);
WITH "https://vbatushkov.bitbucket.io/swapi.json" AS url
CALL apoc.load.json(url) YIELD value
UNWIND value.films as film
UNWIND film.vehicles as vehicle_url
MATCH (f:Film { url: film.url })
MATCH (v:Vehicle { url: vehicle_url })
MERGE (v)-[:APPEARED_IN]->(f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment