Last active
September 16, 2016 00:04
-
-
Save freeeve/455002a28bafb319ba2816d5c920cf3d to your computer and use it in GitHub Desktop.
movie import.cypher;
This file contains 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
create index on :Movie(movieId); | |
create index on :Person(personId); | |
load csv with headers from 'file:///people.csv' as record | |
merge (p:Person {personId:record.personId}) | |
set p = record; | |
load csv with headers from 'file:///movies.csv' as record | |
merge (m:Movie {movieId:record.movieId}) | |
set m = record; | |
load csv with headers from 'file:///directors.csv' as record | |
match (p:Person), (m:Movie) | |
where p.personId = record.personId | |
and m.movieId = record.movieId | |
merge (p)-[:DIRECTED]->(m); | |
load csv with headers from 'file:///actors.csv' as record | |
match (p:Person), (m:Movie) | |
where p.personId = record.personId | |
and m.movieId = record.movieId | |
merge (p)-[:ACTED_IN {roles:coalesce(record.characters, "")}]->(m); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment