Cypher 查询给出 java.lang.OutOfMemoryError

Cypher query gives java.lang.OutOfMemoryError

当我在 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);

我收到这条消息:

Error occured in server thread; nested exception is: java.lang.OutOfMemoryError: Java heap space

知道如何解决这个问题吗?

不知道有没有帮助。但这里是针对您的案例修复的 Cypher 查询:

MATCH (b:PHARMA)-[r:HAS_DONATED]->(a:DOCTOR)      
WITH a, b, SUM(r.DECL_AVANT_MONTANT) as total, COUNT(r) as count   
MERGE (b)-[:RELATIONSHIP {   
totalDECL: total,   
numberDECL: count  
}]->(a);

我使用这个查询解决了我的问题:

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;

基本上,我在 csv 导入期间创建关系并在整个过程中更新属性。

谢谢大家的帮助!