I am currently working on a project which aims to use graph databases, in particular Neo4j. My question concerns how to create the "Relationship" relations between the different nodes, for information, the data to be used is in CSV format, in this case, I will import data that is in .csv format, first we create the nodes based on this data, then we move on to creating the relationships between the different nodes.
I tried a lot of code but we didn't get the desired result regarding the creation of relationships between nodes.
I used the following code:
Load csv with headers from "file:///airports.csv" as airports create (a1: Airport {label: airports.label, city: airports.city, state: airports.state})
match (n) return (n)
Load csv with headers from "file:///flights.csv" as flights create (n: Flights {flight: flights.flight, airline: flights.airline, capacity: flights.capacity})
match(n) return(n)
while the nodes are created. but neither do relationships. in addition I had the following message: (no changes, no records) this after the execution of the following code:
Load csv with headers from "file:///flights.csv" as flights match (a: Flights {flight: flights.flight}), (b: Airport {label: flights.arrive}) create (a) –[r : Arrivals] -> (b)
match (n) return (n)
Load csv with headers from "file:///flights.csv" as flights match (a: Flight { flight: flights. flight}), (b: Airport {label: flights. depart}) create (a) –[r : Departures] -> (b)
match (n) return (n)
To inform you, I have two tables of data whose extension .csv one for airports and the other for flights. How should we create the relationship that exists between airports and flights? I don't know where is the error.