I have a relations csv file. I have to load this relations to neo4j but i can't.I have already created my News node and this nodes have unique id.

The csv file has iStart, iRel, iEnd columns. Thanks

Sample .csv file looks like this:

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

and this is my code:

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 Answers

0
Reshma Radhakrishnan On

Try this one:

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 );