Created
February 17, 2017 16:27
-
-
Save adam-cowley/0df314e4ed10fa1e3deb86e3e6f1b52d to your computer and use it in GitHub Desktop.
Import Ticketmaster Classifications into Neo4j
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
CALL apoc.load.json('https://app.ticketmaster.com/discovery/v2/classifications?locale=en-us&apikey={key}') YIELD value AS json | |
UNWIND json._embedded.classifications as classification | |
MERGE (seg:Segment {ticketmaster_id: classification.segment.id, name: classification.segment.name}) | |
WITH seg, classification | |
UNWIND classification.segment._embedded.genres as genre | |
MERGE (gen:Genre {ticketmaster_id: genre.id, name: genre.name}) | |
MERGE (seg)-[:HAS_GENRE]->(gen) | |
WITH seg, gen, genre | |
UNWIND genre._embedded.subgenres as subgenre | |
MERGE (sub:SubGenre {ticketmaster_id: subgenre.id, name: subgenre.name}) | |
MERGE (gen)-[:HAS_SUBGENRE]->(sub) | |
RETURN seg, gen, sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment