Last active
May 5, 2019 08:21
-
-
Save vladbatushkov/67e7036fab32f64a521cf7e8bee7a515 to your computer and use it in GitHub Desktop.
Character-related relationships
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.people as character | |
UNWIND character.species as species_url | |
MATCH (c:Character { url: character.url }) | |
MATCH (spec:Species { url: species_url }) | |
MERGE (c)-[:OF]->(spec); | |
WITH "https://vbatushkov.bitbucket.io/swapi.json" AS url | |
CALL apoc.load.json(url) YIELD value | |
UNWIND value.people as character | |
MATCH (c:Character { url: character.url }) | |
MATCH (p:Planet { url: character.homeworld }) | |
MERGE (c)-[:HOMEWORLD]->(p); | |
WITH "https://vbatushkov.bitbucket.io/swapi.json" AS url | |
CALL apoc.load.json(url) YIELD value | |
UNWIND value.people as character | |
UNWIND character.vehicles as vehicle_url | |
MATCH (c:Character { url: character.url }) | |
MATCH (v:Vehicle { url: vehicle_url }) | |
MERGE (c)-[:PILOT]->(v); | |
WITH "https://vbatushkov.bitbucket.io/swapi.json" AS url | |
CALL apoc.load.json(url) YIELD value | |
UNWIND value.people as character | |
UNWIND character.starships as starship_url | |
MATCH (c:Character { url: character.url }) | |
MATCH (s:Starship { url: starship_url }) | |
MERGE (c)-[:PILOT]->(s); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment