Ich verwende LOAD CSV, um Knoten und Relationen zu importieren, aber eine der Spalten die "country_id", die ich verwende, um die Beziehung mit anderen nicht zu erstellen ist im Eingangsdatensatz NULL, wie macht man bedingte MERGE nur dann, wenn die Spalte einen Wert hat. Ich habe das "CASE" versucht, aber es funktioniert nicht mit "IS NOT NULL". Danke. Luis Oscar
Das folgende ist mein Code zur Zeit für country_id discarting NULL ist: Wie bedingte MERGE nur, wenn die Spalte Wert hat, wenn LOAD CSV verwendet, um Daten zu laden
USING PERIODIC COMMIT 20
LOAD CSV WITH HEADERS FROM 'file:///physical_location.csv' as row
WITH
toInt(row.physical_location_id) as physical_location_id,
CASE row.country_id WHEN IS NOT NULL THEN MERGE (c:Country {code:country_id}) END,
toFloat(row.latitude) as latitude,
toFloat(row.longitude) as longitude,
row.addressline1 as addressline1,
row.addressline2 as addressline2,
row.cityname as cityname,
row.postalcode as postalcode,
row.telephone as telephone,
row.airport as airport,
row.railway as railway,
row.ferryport as ferryport,
row.iata_airport_code as iata_airport_code,
row.iata_city_code as iata_city_code,
row.timezone as timezone,
row.pickup_only as pickup_only,
row.return_only as return_only,
row.outofhours_return as outofhours_return,
row.dropbox as dropbox,
row.delivery_collection as delivery_collection,
row.pl_email as pl_email
//where country_id IS NOT NULL
MERGE (pl:PhysicalLocation {physical_location_id:physical_location_id})
ON MATCH SET
pl.addressline1 = addressline1,
pl.addressline2 = addressline2,
pl.cityname = cityname,
pl.postalcode = postalcode,
pl.telephone = telephone,
pl.airport = airport,
pl.railway = railway,
pl.ferryport = ferryport,
pl.iata_airport_code = iata_airport_code,
pl.iata_city_code = iata_city_code,
pl.timezone = timezone,
pl.pickup_only = pickup_only,
pl.return_only = return_only,
pl.outofhours_return = outofhours_return,
pl.dropbox = dropbox,
pl.delivery_collection = delivery_collection,
pl.pl_email = pl_email
//MERGE (pl)-[r:IN_COUNTRY]->(c)
RETURN count(pl)
Vielen Dank für die Hilfe, es ist ein großartiger Tipp. –