如何替换 neo4j 关系中的 属性

how to replace a property in a neo4j relationship

我是 NEO4j 和 Keetle etl 的新手。

现在我正在尝试替换关系中的 属性 值“costPerTon”:COMPANY_COST_FOR_PRODUCT_{period}_{company}

我在 Kettle 中计算了值并尝试使用 Neo4j Cypher 导入它们,但我不知道如何编写此密码...

我应该使用 Merge 还是 Set?

MERGE 为您找到关系(如果存在),SET 仅在您找到/创建关系后才在关系上设置 属性。

对于关系,一旦找到开始和结束节点,请先找到它们

假设您已经找到 (start)(end) 节点

你可以做到

// Find the rel, or create it if it does not yet exist
MERGE (start)-[r:MyRELTYPE]->(end)
// Set the property value
SET r.myProperty =  myPropertyValue