Hello I was trying to import some data in csv file to neo4j in my ubuntu 12.04.
The csv file is a two column data file with no header its format is like:
Here's what you do.
LOAD CSV FROM 'file:///home/nate/Downloads/file.csv' AS line
MERGE (n:A {number : line[0]})
WITH line, n
MERGE (m:B {ID : line[1]})
WITH m,n
MERGE (n)-[:LIKES]->(m);
You first create or match the :A
node, then create or match the :B
node, then create or match the relationship. The WITH
clauses collect the results at each point in the sequence to use in the next. To find out more about WITH
clauses, read Section 9.5 in the Neo4j Manual.