I have Officer nodes belonging to the same community (property community_probably_same_officer that I created with Graph Data Science). I would like to merge those nodes with apoc.refactor.mergeNodes. I cannot use the iterate apoc since it has a bug that I reported so this is a workaround.
I wrote this code:
match (n:Officer)
with collect(distinct n.community_probably_same_officer) as idcom
unwind idcom as unwidcom
MATCH (n:Officer) where n.community_probably_same_officer=unwidcom
WITH unwidcom, collect(n) AS nodicom
CALL apoc.refactor.mergeNodes(nodicom,{
properties:"discard", mergeRels:true, preserveExistingSelfRels:false})
yield node
return count(*)
and I have this error
Failed to invoke procedure apoc.refactor.mergeNodes
: Caused by: java.lang.NullPointerException: Cannot invoke "java.lang.Throwable.getMessage()" because the return value of "org.neo4j.graphdb.NotFoundException.getCause()" is null
When I used this code for other communities based on a different property it worked with no problems.
Thanks in advance.