cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

APOC Rename and Merge Nodes

Hi Graphistas!

Im running Aura professional and I created a graph which I now have populated with data. Unfortunately I made a small mistake in the node type and now I have two node types: Identifier and identifier.

I want to consolidate them so the strategy is to first rename the identifier to Identifier and then Merge them with mergeRels true.

I created a sample graph and the following queries to perform this transformation

Rename old label

MATCH(i:identifier)
WITH collect(i) AS ids
CALL apoc.refactor.rename.label("identifier", "Identifier", ids)
YIELD committedOperations
RETURN committedOperations

Merge nodes with rels.

MATCH (i:Identifier)
WITH i
WITH i.id AS id, collect(i) as nodes
CALL apoc.refactor.mergeNodes(nodes, {properties: {`.*`: 'combine'}, mergeRels:true})
YIELD node
RETURN count(*)

When I do this on Neo4j Desktop it works great, when on Aura it doesnt do anything.
Here's the sample graph

CREATE (:Device {id: "device2"})-[:HAS_IDENTIFIER {created_at: 432432, updated_at: 432432}]->(:identifier {id: "A"})<-[:HAS_IDENTIFIER {created_at: 21212121, updated_at: 453543}]-(:Device {id: "device1"}),
(:Device {id: "device33"})-[:_RELATED]->(:identifier {id: "B"}),
(:Identifier {id: "A", propertymustsaved: "true"})

Would appreciate any guidance you have!

Thank you
Joao

1 REPLY 1

You did the exact same mistake in both Aura and Desktop?

The state of your database must be different I guess or do you get any error while using Aura?
Aura doesn't include all the functionnality of apoc full, it's just a core version of apoc but I think merge should be part of it.