vgrabovets
9/27/2016 - 4:01 PM

load data

load data

USING PERIODIC COMMIT 1000
LOAD CSV WITH HEADERS
FROM "file:///movies.csv"
AS line
CREATE (movie:Movie { obj_id:line.obj_id, cdn_obj_id:line.cdn_obj_id, type:line.type, year:line.year, title:line.title, title_en:line.title_en, country:line.country, duration:toInt(line.duration_sec), rating_imdb:toInt(line.rating_imdb), rating_kinopoisk:toInt(line.rating_kinopoisk)});



USING PERIODIC COMMIT 10000
LOAD CSV WITH HEADERS
FROM "file:///users.csv"
AS line
CREATE (user:Users { user_id:line.uid, email:line.email, reg_date:line.reg_date });



CREATE INDEX ON :Movie(obj_id);



CREATE INDEX ON :Users(user_id);



USING PERIODIC COMMIT 10000
LOAD CSV WITH HEADERS
FROM "file:///liked.csv"
AS line
MATCH (movie:Movie { obj_id:line.id_obj })
MATCH (user:Users { user_id:line.uid })
CREATE (user)-[:LIKED]->(movie);



USING PERIODIC COMMIT 10000
LOAD CSV WITH HEADERS
FROM "file:///disliked.csv"
AS line
MATCH (movie:Movie { obj_id:line.id_obj })
MATCH (user:Users { user_id:line.uid })
CREATE (user)-[:DISLIKED]->(movie);



USING PERIODIC COMMIT 10000
LOAD CSV WITH HEADERS
FROM "file:///rels.csv"
AS line
MATCH (movie:Movie { obj_id:line.id_obj })
MATCH (user:Users { user_id:line.uid })
CREATE (user)-[:LIKED]->(movie);