Copy an existing graph with new node labels and new relationship type

You can use CYPHER to refactor a graph database.

If you need a new graph database that is a copy of the old one (no need to keep them in sync henceforth) you can do the following:

  • Shut down Neo4j.
  • Take a copy of the existing graph.db in $NEO4J_HOME/data/databases.
  • Set the new copy as the active database in neo4j.conf (or using Neo4j desktop).
  • Start Neo4j.
  • Run CYPHER queries to refactor. For every xyz_event add a new abc_event label. Depending on the size of the database you may need to do this in batches.
  • Run a query to remove the old labels.