Thanks for your response Paul.
I am concerned about Form Variable Name" being null. I do not want to create a node when this value is null.
So suppose my column Form Variable Name" has values h,p,q,NULL,NULL,a , I want nodes to be created only for h,p,q,a and no nodes for NULL values.
I have two codes now:
-
This code does not give any output graph.
LOAD CSV WITH HEADERS FROM "file:///Latest_Matrix.csv" AS line WITH line
WITH line
WHERE NOT line.Form Name Extension
IS NULL and NOT line.Study Title
is NULL
and NOT line.Domain Label
is NULL and NOT line.SDTM Variable Name
is NULL
MERGE (a: Study {name: line.Study Title
, type: 'Study'})
//CREATE (domain: Domain {name: line.Domain})
mergE (b: Domain {name: line.Domain Label
, type: 'SDTM Domain', domain_identifier: line.Study Title
+ line.Domain Label
})
Merge (e: SDTM_Target_Variable {name: line.SDTM Variable Name
,type: 'SDTM Domain Variable', transformation:line.Transformation Code
, transformation_type:line.Transformation Type
,SDTM_Domain_Label:line.SDTM Variable Label
,
field_identifier: line.Study Title
+ line.Domain Label
+ line.SDTM Variable Name
})
Merge (c: Source_Form_File {name: line.Form Name
,type: 'Source_Form_File', form_name_extension:line.Form Name Extension
, file_identifier: line.Study Title
+ line.Domain Label
+ line.Form Name
})
WITH line
WHERE NOT line.Form Variable Name
IS NULL
MATCH (d: Source_Form_Variable {name: line.Form Variable Name
,type: 'Source_Form_Variable', field_identifier: line.Study Title
+ line.Domain Label
+ line.SDTM Variable Name
})
MERGE (c)-[u:Has]->(d)
MERGE (e)-[q:Constitutes]->(b)
MERGE (b)-[p:Part_of]->(a)
MERGE (d)-[g:transforms]->(e)
REMOVE b.domain_identifier
REMOVE e.field_identifier
REMOVE d.domain_identifier
REMOVE c.file_identifier
RETURN a,b,e;
-
This code creates named "Other" for all NULL values. Is there a way I could have just one node named "Other" and point all NULL to that?
LOAD CSV WITH HEADERS FROM "file:///Latest_Matrix.csv" AS line WITH line
WITH line
WHERE NOT line.Form Name Extension
IS NULL and NOT line.Study Title
is NULL
and NOT line.Domain Label
is NULL and NOT line.SDTM Variable Name
is NULL
MERGE (a: Study {name: line.Study Title
, type: 'Study'})
//CREATE (domain: Domain {name: line.Domain})
mergE (b: Domain {name: line.Domain Label
, type: 'SDTM Domain', domain_identifier: line.Study Title
+ line.Domain Label
})
Merge (e: SDTM_Target_Variable {name: line.SDTM Variable Name
,type: 'SDTM Domain Variable', transformation:line.Transformation Code
, transformation_type:line.Transformation Type
,SDTM_Domain_Label:line.SDTM Variable Label
,
field_identifier: line.Study Title
+ line.Domain Label
+ line.SDTM Variable Name
})
Merge (c: Source_Form_File {name: line.Form Name
,type: 'Source_Form_File', form_name_extension:line.Form Name Extension
, file_identifier: line.Study Title
+ line.Domain Label
+ line.Form Name
})
MATCH (d: Source_Form_Variable {name: coalesce(line.Form Variable Name
,"Other"),type: 'Source_Form_Variable', field_identifier: line.Study Title
+ line.Domain Label
+ line.SDTM Variable Name
})
MERGE (c)-[u:Has]->(d)
MERGE (e)-[q:Constitutes]->(b)
MERGE (b)-[p:Part_of]->(a)
MERGE (d)-[g:transforms]->(e)
REMOVE b.domain_identifier
REMOVE e.field_identifier
REMOVE d.domain_identifier
REMOVE c.file_identifier
RETURN a,b,e;