Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
04-27-2020 03:45 PM
Hi,
I import a .csv file into Neo4j. And there are three columns there: Company_Name, legal_address, and physical_address. And the above picture shows the relationship of these three columns.
My question is: if the legal_address and the physical _address is same for one company, but one is in lower cace, one is in upper case, how to treat these two address nodes as one node for that company? (Like below)
i tired these code below but it does not work:
load csv with header from "..." as line
merge (v1: company{company:line.name})
FOREACH (i in CASE WHEN exists(line.P_ADDR_LN) THEN [1] ELSE [] END |MERGE (v5:address {address:line.P_ADDR_LN}) merge (v1)-[:physically_located_at ]->(v5) set v5.address=toUpper(line.P_ADDR_LN))
FOREACH (i in CASE WHEN exists(line.D_ADDR_LN) THEN [1] ELSE [] END |MERGE (v6:address {address:line.D_ADDR_LN}) merge (v1)-[:LEGAL_located_at ]->(v6) set v6.address=toUpper(line.D_ADDR_LN))
The above code can make the addresses into upper case, but they will be treated as two different nodes like picture 1.
Thanks,
Sharon
Solved! Go to Solution.
04-27-2020 04:14 PM
You are creating the nodes and then changing the case and that's why you see two different nodes.
Try changing the case before creating the node:
{address:toUpper(line.P_ADDR_LN)}) merge (v1)-[:physically_located_at ]->(v5)
{address:toUpper(line.D_ADDR_LN)}) merge (v1)-[:LEGAL_located_at ]->(v6)
04-27-2020 04:14 PM
You are creating the nodes and then changing the case and that's why you see two different nodes.
Try changing the case before creating the node:
{address:toUpper(line.P_ADDR_LN)}) merge (v1)-[:physically_located_at ]->(v5)
{address:toUpper(line.D_ADDR_LN)}) merge (v1)-[:LEGAL_located_at ]->(v6)
04-27-2020 04:39 PM
oh. You are right. It makes sense. I will try it. Thank you.
All the sessions of the conference are now available online