有一个包含两列(电影,演员)的csv文件,其中movie是电影名称,actor是逗号分隔的actor列表,是否可以创建一个模式,如(:Person) - [:ACTS_IN] - &gt ; (:电影)?我应该如何遍历每一行的所有演员?
我试过没有定罪:
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}))
它返回警告:类型不匹配:期望字符串但是是Map。 我正在运行neo4j 2.3.0。
答案 0 :(得分:2)
row
是一张地图(包含Movie
和Actors
属性)。
这应该有效:
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}));