I will be creating relationship called "transfered_to" between "from_account" and "to_account" with txn_date , txn_amount and txn_id as relationship property
Whilst creating when there are transaction made to same account more than once I intended to create only one relationship where as it's relationship property values should get appended.
Considering the above example for first two rows , we should have create only one relationship where as it's relationship property should have the details of the both the transaction.
LOAD CSV WITH HEADERS FROM 'file:///sampledata.csv' AS line
MERGE (:Account {id: line.from_account})
MERGE (:Account {id: line.to_account});
Then I created all relationships.
LOAD CSV WITH HEADERS FROM 'file:///sampledata.csv' AS line
MATCH (from:Account {id: line.from_account})
MATCH (to:Account {id: line.to_account})
MERGE (from)-[:TRANSFERED_TO {txn_date: line.txn_date, txn_amount: line.txn_amount, txn_id: line.txn_id}]->(to);
Cypher created two relationships between 123 and 456, which I think is fine.
I think it's not a good design to have multiple transaction properties in one relationship.
Does this answer your question?
Here is my approach:
LOAD CSV WITH HEADERS FROM 'file:///sampledata.csv' AS line
MERGE (from:Account {id: line.from_account})
MERGE (to:Account {id: line.to_account});
MERGE (trndte:TranDate {dte: line.txn_date})
MERGE (trnamt:TranAmt {amount: txn_amount, txn_id: line.txn_id})
MERGE (from)-[:TO_ACCOUNT]->(to)-[:TRAN_DATE]->(trndte)-[:TRAN_AMOUNT]->(trnamt)
For the same from, to, and date the (trndte) node will have multiple branches one for each amount.
In your case (trndate) will have two branches one for amount 100 and another for 120.
Having a separate node for transaction date will help you in your data analysis.
Thanks a lot Ameya. It gives whole lot of another perspective to displaying the date. I am going to simulate this as well and update here the progress.