I hope this would just update the empty 'properties' field in the coOccur relationship. However, it didn't. I have to remove all relationships and re-create the relationship. The merge function works well for node property update without recreating the whole node. Why doesn't it work for relationship merging?
Hi,
Fairly new to Neo4J. Two thoughts:
May be you need to include a WITH before the procudere CALL. Thought I ran into that.
WITH h, t, row.type, row.confidence
However I'm wondering why you don't use Cypher MERGE here and direct the relationship. (That may be something for me to learn ;)
MATCH (h:Topic{nid: row.start})
MATCH (t:Topic{nid: row.end})
MERGE (h) -[:row.type {confidence:toFloat(row.confidence)}-(t)
Taken from:
MATCH
(charlie:Person {name: 'Charlie Sheen'}),
(oliver:Person {name: 'Oliver Stone'})
MERGE (charlie)-[r:KNOWS]-(oliver)
RETURN r
I have struggled with relationship property updates using APOC functions myself. You might want to look at your MATCH construction. I would have expected a relationship match, something like (h)-[row.type]->(t). The code sample for apoc.create.setRelProperties() might provide some insights:
MATCH (:Person)-[friends:FRIENDS]->(:Person)
WITH friends, keys(friends) AS keys
CALL apoc.create.setRelProperties(friends,[k in keys | k + "Copy"], [k in keys | friends[k]])
YIELD rel
RETURN startNode(rel) AS start, rel, endNode(rel) AS end