neo4jcypher

neo4j cypher: how to change the type of a relationship


I can't find a way to change a relationship type in Cypher. Is this operation possible at all? If not: what's the best way achieve this result?


Solution

  • Unfortunately there is no direct change of rel-type possible at the moment.

    You can do:

    MATCH (n:User {name:"foo"})-[r:REL]->(m:User {name:"bar"})
    CREATE (n)-[r2:NEWREL]->(m)
    // copy properties, if necessary
    SET r2 = r
    WITH r
    DELETE r