Skip to content

Export to Neo4j

Patrick edited this page Jul 4, 2022 · 3 revisions

How to Export pageTAGNAME.json to Neo4J

Using Apoc Load JSON

call apoc.load.json("pageTAGNAME.json")
YIELD value
MERGE (music:Song {name: value.name, year: value.year, genre: value.genre, artist: value.artist})
FOREACH (song in value.was_sampled_in |
MERGE (musicS:Song {name: song.name, year: song.year, genre: song.genre, artist: song.artist})
MERGE (music)-[:was_sampled_in]->(musicS)
)
FOREACH (song in value.contains_samples_of |
MERGE (musicS:Song {name: song.name, year: song.year, genre: song.genre, artist: song.artist})
MERGE (music)-[:contains_samples_of]->(musicS)
)
FOREACH (song in value.is_a_cover |
MERGE (musicS:Song {name: song.name, year: song.year, genre: song.genre, artist: song.artist})
MERGE (music)-[:is_a_cover]->(musicS)
)
FOREACH (song in value.was_covered_in |
MERGE (musicS:Song {name: song.name, year: song.year, genre: song.genre, artist: song.artist})
MERGE (music)-[:was_covered_in]->(musicS)
)
FOREACH (song in value.was_remixed_in |
MERGE (musicS:Song {name: song.name, year: song.year, genre: song.genre, artist: song.artist})
MERGE (music)-[:was_remixed_in]->(musicS)
)
FOREACH (song in value.is_a_remix |
MERGE (musicS:Song {name: song.name, year: song.year, genre: song.genre, artist: song.artist})
MERGE (music)-[:is_a_remix]->(musicS)
)
Clone this wiki locally