Allow null when create relations

I need to create company and parent company relations from a json file, however some companies do not have parent companies, like this example
{ "company_id" : 2032,
"parent_company_id" : 343
}
{ "company_id" : 2332,
"parent_company_id" :
}

It is possible to create company-paranet company relation when a company has parent company, skip the company if it does not have parent company or substitute null with some characters?
Thanks.

Hi @jzhou002 ,

Welcome to the Graph Community.

I tried this with the below sample data and query :

{
"company_id" : 2032,
"parent_company_id" : 343
}
{
"company_id" : 2332,
"parent_company_id" :0
}

QUERY :

call apoc.load.json("file:///testjson.json")
yield value AS row
WITH row where row.parent_company_id<>0
MERGE(c:Company{companyId:row.company_id})-[:HAS_PARENT]->(pc:Company{companyId:row.parent_company_id})
RETURN c,pc

Below is the output :

image

Please let me know if this is what you need or did I miss anything.

Oh cool. Thank you very much. I am new to cypher, a lot to learn.