0

I had created a node in neo4j but i would like to create relation ships that relationship is in csv file,how to create a relationship between nodes while adding csv into neo4j...pls anybody answer me..

This is my query

    LOAD CSV WITH HEADERS FROM "file:///opt/lampp/htdocs/cia/data/data1.csv" AS line with line
    merge(Anum:ph{num:tofloat(line.`A_Number`),imei:toint(line.`IMEI_A`),imsi:toint(line.`IMSI_A`)})
    merge(Bnum:ph{num:tofloat(line.`B_Number`),imei:toint(line.`IMEI_B`),imsi:toint(line.`IMSI_B`)}) 
    create(Anum)-[line.'Call_Type']->(Bnum)
return line;

But it does not excuted,please tell me the correction

ketan
  • 19,129
  • 42
  • 60
  • 98
Suriya Kumar
  • 647
  • 1
  • 5
  • 13

1 Answers1

0

The main problems were in the way the CREATE clause specified the relationship. A relationship must always have a type, and a property must always have a name.

You also do not need to use backticks (`) to surround any of the simple names you used, and you had an unnecessary WITH line.

In the following example, I gave the relationship the type MY_REL:

LOAD CSV WITH HEADERS FROM "file:///opt/lampp/htdocs/cia/data/data1.csv" AS line
MERGE (Anum:ph { num:tofloat(line.A_Number), imei:toint(line.IMEI_A), imsi:toint(line.IMSI_A)})
MERGE (Bnum:ph { num:tofloat(line.B_Number), imei:toint(line.IMEI_B), imsi:toint(line.IMSI_B)})
CREATE (Anum)-[:MY_REL { callType:line.Call_Type }]->(Bnum)
cybersam
  • 63,203
  • 6
  • 53
  • 76
  • where i can get a keylines.js file..??if you has then send it to suriyakumar2211@gmail.com...please its very important – Suriya Kumar Mar 24 '16 at 11:33
  • You can only create a relationship with a hardcoded type -- the type cannot come from a variable. You can download keylines from here: http://cambridge-intelligence.com/keylines/neo4j/ – cybersam Mar 24 '16 at 17:40
  • The answer to this question may be helpful for working around the hardcoded relationship-type problem: http://stackoverflow.com/questions/36068270/neo4j-changing-relationship-type-not-working-in-web-interface-data-browser – cybersam Mar 24 '16 at 17:42