How to load and create a node with its properties in a csv file?

have 5 nodes > DF1 with property (name1,value1,category1,class1),
DF2 with property (name2,value2,category2,class2),
Issue with property (issue_sev,issue_sev_value),
Risk with property (risk_sev,risk_sev_value),
Recomondation with property (reco_category,reco_sev,reco_sev_val,reco
_class,reco_type)

df1 is connected to df2 with relationship1
df2 -> issue with relationship2
issue->risk with relationship3
risk->recomondation with relationship4

Relationship_1 Df2 Name_2 Value_2 Category_2 Class_2 they have empty cells.
CSV FILE---->

i tried this query but it is wrong and couldnt get req. o/p.
i was trying to make 5 nodes Df1 Df2 Issue RiskEntity Recomondation but im confused !!!

load csv with headers from "file:///test_1.csv" as row
call{
with row
with row where row.Df1 is not null
merge(n1:Person{Data:row.Df1,Name:row.Name_1,Value:row.Value_1,Category:row.Category_1,class:row.Class_1})
}
call{
with row
with row where row.Df2 is not null
merge(n2:Person{Data:row.Df2,Name:row.Name_2,Value:row.Value_2,Category:row.Category_2,class:row.Class_2})
}

call{
with row
with row where row.Issue is not null
with row where row.Issue_Sevirity_Value is not null
merge(n3:person{Data:row.Issue,issue:row.Issue_Sevirity,isseVal:row.Issue_Sevirity_Value})
}
call{
with row
with row where row.RiskEntity is not null
merge(n4:person{Data:row.Risk_Entity,risk:row.Risk_Severity, riskSev:row.Risk_Severity_Value})

}
call{
with row
with row where row.Recommendation is not null
merge(n5:person{Data:row.Recommendation,reco:row.Reco_Category,recoSev:row.Reco_Severity,recVal:row.Reco_severity_value,recClass:row.Reco_Class})

}

call{
with row
with row where row.Df1 is not null and row.Df2 is not null
match(n1:Person{Data:row.Df1,Name:row.Name_1,Value:row.Value_1,Category:row.Category_1,class:row.Class_1}), (n2{Data:row.Df1,Name:row.Name_2,Value:row.Value_2,Category:row.Category_2,class:row.Class_2})
CALL apoc.create.relationship(n1, row.Relationship_1,{}, n2) yield rel
return rel
}
return rel

Hi sreeray_sj,

first of all, I would really recommend you look into database normalization. Having all data in one file makes it really difficult and error prone.

The answer to why your current implementation does not work is: spelling mistakes. E.g. the third query contains a lot of them: you are accessing "row.Issue_Sevirity_Value" but in your csv file that respective column is called "Issue_severity_value". The same holds for "row.Issue_Sevirity" (in the csv: "Issue_Severity". Also check the following queries for such errors.

For "RiskEntity" you have the problem that the header in your csv file has a space in it. You cannot address this column with neither "row.RiskEntity" nor "row.Risk_Entity". You can find the solution to this problem here: cypher - Error importing csv data into Neo4j where the header contains spaces - Stack Overflow.

You might want to look at the modeling of your data, e.g. should properties like "Category" or "class" rather be nodes that the respective Person nodes are connected to? At least transforming them into labels would probably make a lot of sense.

Regards,
Elena