Hello everyone,
I have some data in the form:
node:Account
{
"address": "mark.com",
}
relationship:FUNCTIONCALL
{
"date": "Tue Jan 18 2022 15:40:45 GMT+0000 (Greenwich Mean Time)",
"amount": 1,
"id": "unique_id",
"outcome": "Success",
"timestamp": 1642520445191736600.0
}
The idea is that an account should always have a unique address property, and a FUNCTIONCALL relationship between two nodes will always have a unique id property.
To create an account I use MERGE, by declaring a variable with a unique name, and setting its properties:
MERGE (encrypted_mark_address: Account {address: 'mark.com'})
MERGE (encrypted_ted_address: Account {address: 'ted.com'})
I then create a relationship with the two, by still using merge:
MATCH (a1: Account {address: 'mark.com'})
MATCH (a2: Account {address: 'ted.com'})
MERGE(a1)-[unique_id:FUNCTIONCALL {id:'unique_id'}]->(a2)
ON CREATE SET
unique_id.date="Tue Jan 18 2022 15:40:45 GMT+0000 (Greenwich Mean Time)",
unique_id.timestamp=1642520445191736600,
unique_id.amount=1,
unique_id.outcome="Success"
However, by running my code I get to a point where I have duplicate data, like in the following example (real data).
The three central nodes are the same, and so are the 5 surrounding nodes.
Ideally, I should have this instead:
My questions are the following:
- How do I remove / merge the duplicates without messing up the data?
- How do I change my code to create the data, such that this duplicate situation does not happen again?
Thanks in advance!