Showing results for 
Search instead for 
Did you mean: 

Copy a Node and Relationship to new one

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


Hello Kailash,

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


Node Clone

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.