Hi!, Given that I have created nodes and relationships from the "example.csv" file as below. However, I have a new file, "other_names.csv", with the family_names in example.csv as column heads with a series of first_names under each column.
Any HINT/SUGGESTION on how to –> MATCH AND MERGE<– without individually creating nodes for each column, like row.Dickens , row.Wang etc. ? Thanks
load csv from "file:///other_names.csv" as row
with row as headerRow
limit 1
load csv from "file:///other_names.csv" as row
with headerRow, row
skip 1
unwind range(0,size(headerRow)-1) as index
merge(f:family_name{name:headerRow[index]})
merge(fn:first_name{name:row[index]})
merge (f)-[:first_name_is]->(fn)
MATCH (f:flows)-[r]->(f2)
UNWIND keys({mat: 's', pro: 'p', feat: 'd'}) AS keyword
WITH f, f2, r, keyword
WHERE({mat: 's', pro: 'p', feat: 'd'})[keyword] <> '' AND type(r) = keyword AND f2.name CONTAINS {mat: 's', pro: 'p', feat: 'd'}[keyword]
WITH f.name as text, count(*) AS c ORDER BY c DESC, size(text) ASC
RETURN text
@glilienfield with reference to these files”—-Considering that I want to skip all the null values , what’s the best way to tackle it. I tried use the “is null approach” but failed to get it right.
You had change the starting index to one. Is there a column of row numbers in the first column? If so, this column does not have a header and would explain that null value error, which occurred for the family name (header values).
The case I presented earlier was just a sample case to help do a knowledge transfer. The real data I am working on looks something like this (48 columns):
There are three approach I can think of for dealing with null values during import: 1) coalesce to set a default value, 2) call subquery testing for null condition, and 3) apoc.do.when