加载csv - 关系

时间:2015-11-10 07:16:14

标签: csv graph load

social network app.
Loaded users.txt  (userid)

5
6
57355
57359
57360

使用:

LOAD CSV FROM "file:C:/data/users.txt" AS line
create (:User { Userid:toInt(line[1]) });

现在,我需要创建关系(user1跟随user2)

userid;follower
57364;57360
57364;300946
57364;57371
57364;474039
57364;418775

LOAD CSV WITH HEADERS FROM "file:C:/data/rels.txt" AS line
MATCH (a:User { Userid:toInt(line[1]) })
MATCH (b:User { Userid:toInt(line[2]) })
CREATE (a)-[:FOLLOWS { roles: [line.role]}]->(b);

LOAD CSV WITH HEADERS FROM "file:C:/data/rels1.txt" AS line 
MATCH (a:User {    Userid:toInt(line[1]) }) 
MATCH (b:User { Userid:toInt(line[2]) }) 
CREATE (a)-[:FOLLOWS { roles: [line.role]}]->(b);

Invalid input 'T': expected whitespace, comment, '|', a length specification, a property map or ']' (line 4, column 24 (offset: 169))
"CREATE (a)-[:FOLLOWS { roles: [line.role]}]->(b);"

有什么建议吗?

感谢。

0 个答案:

没有答案