I have some nodes (n1) and (n2) that have the same name but unique properties and share a node-pair relationship (s1)-[r]->(e1) as follows:
I am trying to do a one-off where I create new relationships between s1 and e1 so that the new relationships are unique, based on id of n1 and n2, but the relationships have the same type as the previous relationship, and then delete the old relationship:
I found the following: neo4j cypher: how to change the type of a relationship which guided me toward the following query:
MATCH (e1)<-[:ENDS_WITH]-(n {name:"same"})-[:STARTS_WITH]->(s1),
(s1)-[r]->(e1)
CREATE (s1)-[r2:NEWREL]->(e1)
// copy properties and set n_id unique
SET r2 = r, r2.n_id = n.n_id
WITH r
DELETE r
Makes perfect sense. However, when I attempt this in the Neo4j web interface data browser, the n_id property gets set properly, but the type(r2) gets set as string "NEWREL" rather than the expected "REL"
I tried back ticks around the NEWREL
and passing a temporary variable from type(r). Not working.