【发布时间】:2019-09-26 02:58:27
【问题描述】:
LOAD CSV FROM 'file:///relationships.tsv' as row
FIELDTERMINATOR '\t'
WITH row
MATCH (a:actor {id: row[2]}), (b:movie {id: row[0]}) MERGE (a)-[r:ACTED_IN]->(b)
文件看起来像这样:
tt0015637 8 nm0166876 actor \N ["Bull Harding"]
tt2450056 2 nm0000616 actor \N ["Dr. Mc Millan"]
tt1053424 1 nm0000179 actor \N ["Remy"]
tt0062535 1 nm0176061 actor \N ["Ric"]
tt0016908 3 nm0384944 actor \N ["Capt. Blackwell"]
tt0020459 4 nm0176971 actor \N ["Pete"]
tt1300155 1 nm1497548 actor \N ["Moon Blake"]
row[0] 是电影的 ID。 row[2] 是演员的 id
此外,我还希望 row[3] 只是演员。有时会有类似的东西
tt0033839 5 nm0377613 director \N \N
我希望 row[3] 只是我尝试过的演员
LOAD CSV FROM 'file:///relationships.tsv' as row
FIELDTERMINATOR '\t'
WITH row
MATCH (a:actor {id: row[2]}), (b:movie {id: row[0]}) MERGE (a)-[r:ACTED_IN]->(b)
WHERE row[3] == 'actor'
但这给了我 Neo.ClientError.Statement.SyntaxError: Invalid input 'H': expected 'i/I' (line 5, column 2 (offset: 161)) "WHERE 行[3] == '演员'
我添加了所有属性 name 和 id 与电影相同的演员。
为什么这不起作用?
【问题讨论】:
-
这:
==不是有效的 Cypher 运算符。 Cypher 在评估谓词时使用=代替。