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.

Copy a Node and Relationship to new one

Kailash
Graph Buddy

Hi Team,

I have a person nodes with many records in it and its relationship created.
I have a requirement where i need to copy person node to personbkup node and copy the relationship.

Match (p:person)<-[ac: ACCESSED_BY]-( b: Block)
here person and Block are linked using b.Id and p.PersonId
Now i need to create a personbkup node from result of above query and then create relationship below.
Match (p:personbkup)<-[ac: ACCESSED_BY]-( b: Block)

Later i will detach delete the person node

2 REPLIES 2

Hello Kailash,

What Cypher commands have you attempted, and what errors/problems are you encountering?

-Tony

I think you are asking how to change the node label. If that was right, try below

MATCH (p: person)
REMOVE p:person
SET p:personbkup

Hope this helps.