I have two separate csv files that I need to import into my neo4j database. The first file contains all the nodes that I wish to import. The information is classified as follows:
id, Name
1, Earth science
To import it, I successfully used the following code:
LOAD CSV WITH HEADERS FROM 'file:///Node_test.csv' AS line
CREATE (:Discipline { id: toInt(line.id), name: line.Name})
Now, I want to import my relationship file and create all the relationship between the nodes I just imported. The information in the relationship.csv file is classified as follows:
RelationshipID, parentID, relationship_type, childID
1, 2, IS_A_PARENT_DISCIPLINE_OF, 5
To import it, I used the following code, without success :
USING PERIODIC COMMIT 500 LOAD CSV WITH HEADERS FROM "file:///relationship_test.csv" AS csvLine
MATCH (DParent:Discipline { id: toInt(csvLine.parentID)}),(DChild:Discipline { id: toInt(csvLine.childID)})
CREATE (DParent)-[:IS_A_PARENT_DISCIPLINE_OF { id:toInt(csvLine.RelationshipID) } ]->(DChild)
Note: The result doesn't show any errors, it just returned no changes, no rows.
Please see the links below for other documentations I found regarding the subject; I have not found any documentation describing how to import csv files in order to create relationships between nodes of the same Label.
http://neo4j.com/docs/2.3.0-M01/cypherdoc-importing-csv-files-with-cypher.html
How do i create relationships for existing nodes by importing csv file in neo4j?
Spring Data Neo4j 4.0.0: Can't Create Relationship Between Nodes with the Same Label