Basic example Airport traffic

18 views
Skip to first unread message

Joaquín Silva

unread,
Jul 11, 2016, 6:57:34 AM7/11/16
to Neo4j
Hi, I new using Neo4j so I began with a very basic example.I have a table with  this info:

Bill_To_Adress_provided Arriving_Airport  Departing_Airport
Address 1234 COR BUE

So I did a graph with 3 nodes: Adress, Arrive, Depart and the relationship between them. This is the query:

CREATE CONSTRAINT ON (a:Address) ASSERT a.id IS UNIQUE;
CREATE CONSTRAINT ON (b:Arrive) ASSERT b.id IS UNIQUE;
CREATE CONSTRAINT ON (c:Depart) ASSERT c.id IS UNIQUE;

USING PERIODIC COMMIT
LOAD CSV WITH HEADERS FROM
"file:f:/address/to/the/table.csv" as transactions 
FIELDTERMINATOR ';'

MERGE (address:Address {id: transactions.Bill_To_Adress_provided})
MERGE (arrive:Arrive {id: transactions.Arriving_Airport})
MERGE (depart:Depart {id: transactions.Departing_Airport})
CREATE (address)-[r:FROM]->(arrive)
CREATE (depart)-[s:TO]->(address)
;




















But now I want to merge Arriving_Airport with Departing_Airport in a node call Airport. How can I do that?. 

Regards,
Reply all
Reply to author
Forward
0 new messages