将Relations.csv文件加载到Neo4j数据库

时间:2019-04-03 21:42:07

标签: csv neo4j cypher

我有一个csv关系文件。我必须将此关系加载到neo4j,但是我不能。我已经创建了News节点,并且该节点具有唯一的ID。

csv文件具有iStart, iRel, iEnd列。谢谢

示例.csv文件如下:

iStart    iRel    iEnd
------------------------
114471    IS      2225

这是我的代码:

LOAD CSV WITH HEADERS FROM "file:///try.csv" as input 
MATCH (from:News {id: input.iStart}), (to:News {id: input.iEnd}) 
CREATE (from)-[:RELATION { type: input.iRel }]->(to);

1 个答案:

答案 0 :(得分:0)

尝试这个:

LOAD CSV WITH HEADERS FROM 'file:///try.csv' as input 
CREATE (fromnews:FromNews{id: input.iStart}),(tonews:ToNews{id: input.iEnd})
WITH fromnews,tonews 
CREATE (fromnews)-[:RELATION{type: input.iRel}]->(tonews );