title: How to import relationships between nodes of the same label from a csv file in neo4j?
body: <p>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:</p>
  <pre><code>                             id, Name 
  
                                1, Earth science
  </code></pre>
  <p>To import it, I successfully used the following code:</p>
  <blockquote>
  <p>LOAD CSV WITH HEADERS FROM 'file:///Node_test.csv' AS line</p>
  <p>CREATE (:Discipline { id: toInt(line.id), name: line.Name})</p>
  </blockquote>
  <p>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:</p>
  <pre><code>                 RelationshipID, parentID, relationship_type, childID
  
                                1, 2, IS_A_PARENT_DISCIPLINE_OF, 5
  </code></pre>
  <p>To import it, I used the following code, without success :</p>
  <blockquote>
  <p>USING PERIODIC COMMIT 500
  LOAD CSV WITH HEADERS FROM &quot;file:///relationship_test.csv&quot; AS csvLine</p>
  <p>MATCH (DParent:Discipline { id: toInt(csvLine.parentID)}),(DChild:Discipline { id: toInt(csvLine.childID)})</p>
  <p>CREATE (DParent)-[:IS_A_PARENT_DISCIPLINE_OF { id:toInt(csvLine.RelationshipID) } ]-&gt;(DChild)</p>
  </blockquote>
  <p>Note: The result doesn't show any errors, it just returned no changes, no rows.</p>
  <p>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.</p>
  <p><a href="http://neo4j.com/docs/2.3.0-M01/cypherdoc-importing-csv-files-with-cypher.html" rel="nofollow noreferrer">http://neo4j.com/docs/2.3.0-M01/cypherdoc-importing-csv-files-with-cypher.html</a></p>
  <p><a href="https://stackoverflow.com/questions/26279278/how-do-i-create-relationships-for-existing-nodes-by-importing-csv-file-in-neo4j">How do i create relationships for existing nodes by importing csv file in neo4j?</a></p>
  <p><a href="https://stackoverflow.com/questions/30418226/spring-data-neo4j-4-0-0-cant-create-relationship-between-nodes-with-the-same-l">Spring Data Neo4j 4.0.0: Can&#39;t Create Relationship Between Nodes with the Same Label</a></p>