If i have csv as follows:
"route_id","service_id","trip_id","trip_headsign"
4973_3, 2, 14519396, "Bf. Tostedt"
4973_3, 2, 14519395, "Bf. Tostedt"
4973_3, 1, 14519379, "Sittensen, Schule"
4973_3, 1, 14519391, "Sittensen, Bahnhofstraße"
4973_3, 2, 14519394, "Bf. Tostedt"
4973_3, 1, 14519390, "Bf. Tostedt"
4973_3, 3, 14519381, "Bf. Tostedt"
4973_3, 4, 14519392, "Bf. Tostedt"
and I want to load only when trip_headsign
is unique, so in above case I would only create Trip 3 times. How do i do it?
I am so far as follows:
load csv with headers from
'file:///hamburg/trips.txt' as csv
create (t:Trip {id: csv.trip_id, service_id: csv.service_id, headsign: csv.trip_headsign});
But I get this error:
Node(76020) already exists with label `Trip` and property `headsign` = 'Bf. Tostedt'
I have intentionally keps headsign as unique constraint because I only want everyone of it to exist only once.