Last active
May 5, 2019 08:33
-
-
Save vladbatushkov/29cb36b8860065237751c8706ce2ce53 to your computer and use it in GitHub Desktop.
Connect characters, planets and scecies with films they are appeared in.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WITH "https://vbatushkov.bitbucket.io/swapi.json" AS url | |
CALL apoc.load.json(url) YIELD value | |
UNWIND value.films as film | |
UNWIND film.characters as character_url | |
MATCH (f:Film { url: film.url }) | |
MATCH (c:Character { url: character_url }) | |
MERGE (c)-[: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.planets as planet_url | |
MATCH (f:Film { url: film.url }) | |
MATCH (p:Planet { url: planet_url }) | |
MERGE (p)-[: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.species as species_url | |
MATCH (f:Film { url: film.url }) | |
MATCH (spec:Species { url: species_url }) | |
MERGE (spec)-[:APPEARED_IN]->(f); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment