When I type this query in the Neo4j shell:
MATCH (b:PHARMA)-[r:HAS_DONATED]->(a:DOCTOR)
WITH a,r,b, r.DECL_AVANT_MONTANT as total, COUNT(r) as count
MERGE (b)-[:RELATIONSHIP {
totalDECL: total,
numberDECL: count
}]->(a);
I receive this message:
Error occured in server thread; nested exception is: java.lang.OutOfMemoryError: Java heap space
Any idea on how to get around this?
I solved my problem by using this query:
USING PERIODIC COMMIT 2000
LOAD CSV WITH HEADERS FROM "file:c:/sunshine.anonymes.csv" AS line
FIELDTERMINATOR ','
MATCH (b:DOCTOR {ID: line.BENEF_PS_ID})
MATCH (a:PHARMA {NAME: line.LABO})
MERGE (a)-[r:IS_LINKED_TO]->(b)
ON CREATE SET r.numberDECL = 1, r.totalDECL = toINT(line.DECL_AVANT_MONTANT)
ON MATCH SET r.numberDECL = r.numberDECL +1, r.totalDECL = line.totalDECL + r.totalDECL;
Basically, I'm creating the relationship during the csv import and updating the properties throughout the process.
Thank you for your help guys!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With