Assume a simplistic graph created by:
merge (n:Node {name: "x"})
merge (m:Node {name: "y"})
merge (n)-[:R]->(m)
merge (n)-[:R {k: "v"}]->(m)
return n, m
Naturally, I can delete both edges via:
match (n:Node {name: "x"})
match (m:Node {name: "y"})
match (n)-[r:R]->(m)
delete r
return n, m
and I have confirmed, that I can delete only the second edge via:
match (n:Node {name: "x"})
match (m:Node {name: "y"})
match (n)-[r:R {k: "v"}]->(m)
delete r
return n, m
However, I have a hard time deleting only the first edge. When I tried the following, both edges are deleted
match (n:Node {name: "x"})
match (m:Node {name: "y"})
match (n)-[r:R {}]->(m)
delete r
return n, m
What does work is
match (n:Node {name: "x"})
match (m:Node {name: "y"})
match (n)-[r:R]->(m)
where not exists(r.k)
delete r
return n, m
However, this is very inconvenient for me, because I need to know the that the other edge has a property k
. I would prefer to match (and then delete) edges "without any property"