I need to read a json file having this structure:
{
"source":"source name",
"target":"target name",
"targettype":"targettype",
}
The nodes source and target are already loaded in my graph. And they have distinct labels. Target names are not unique but each duplicate would be in relationship with a different targettype
There are then two distinct groups of target node, those that have a type and those that do not have a type; in the graph those nodes have distinct labels please note that when a node has no type, the json value for targetype is null
The json file is meant to load the relationship between the source and the target using the name
I am pretty lost on how to achieve it. As I need a IF THEN ELSE I TRIED TO USE two FOREACH (ignoreme ) followed by the MATCH but this is not allowed .....
The pseudo code would be
LOAD lines from json
WITH blah blah blah
UNWIND blah blah blah
IF targettype is NULL THEN
MATCH (n:source_name)--(sourcetype)
MATCH (m:NULL_TARGET_LABEL target_name)
ELSE
MATCH (n: source_name)--(sourcetype)
MATCH (m:NON_NULL_TARGET_LABEL target_name)--(targettype)
END
MERGE (n)-[:TIGHT_IT_TO]_(m)
RETURN *
(n:source_name)--(sourcetype)
mean? – NonameCurious