Reputation: 943
having a csv file containing two columns (movie, actors) where movie is the movie name and actors a comma separated list of actors, is it possible to create a pattern such as (:Person) -[:ACTS_IN]-> (:Movie) ? How should I loop through all actors for each line?
I tried with no convictions:
load csv with headers from 'file:///myfile.csv' as row fieldterminator '\t' with split(row, ",") as p foreach (n in p | merge (:Person {Name: n.Actors}))
It returned WARNING: Type mismatch: expected String but was Map. I'm running neo4j 2.3.0.
Upvotes: 1
Views: 956
Reputation: 66967
row
is a map (containing the Movie
and Actors
properties).
This should work:
LOAD CSV WITH HEADERS FROM 'file://myfile.csv' AS row FIELDTERMINATOR '\t'
WITH SPLIT(row.Actors, ",") AS p
FOREACH (n IN p | MERGE (:Person {Name: n}));
Upvotes: 2