简体   繁体   中英

Load Relations.csv file to Neo4j Database

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM