Skip to content

Instantly share code, notes, and snippets.

@freeeve
Last active September 16, 2016 00:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save freeeve/455002a28bafb319ba2816d5c920cf3d to your computer and use it in GitHub Desktop.
Save freeeve/455002a28bafb319ba2816d5c920cf3d to your computer and use it in GitHub Desktop.
movie import.cypher;
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