Note
|
See graphgist view. |
From #help-cypher:
<keturn> It seems MERGE patterns can’t have the commas that are allowed in MATCH?
That is, I can make one relationship with MERGE (a)-[:rel_1]→(b)
and two with MERGE (a)-[:rel_1]→(b)←[:rel_2](c)
but as soon as I want to add a third relationship to (b)
I’m stuck with the one-dimensional limitations of ascii cypher arrows.
I can have a MERGE following another MERGE, but that … would have different semantics, right? because the MERGE is match-or-create of the entire pattern, so it could pick “match” on one line without considering the “create” required by the following line.
Maybe I can CREATE UNIQUE here; it’s documented as being able to take comma-separated paths.
<Michael> it’s gonna go away. What is the problem with splitting it into two MERGE statements? One for each rel?
CREATE
(c_alpha:Curriculum {name: "Alpha"}),
(c_beta:Curriculum {name: "Beta"}),
(a_cherry:Assignment {name: "Cherry"}),
(a_durian:Assignment {name: "Durian"}),
(a_cherry)<-[:REQUIRES]-(p_alpha:Prereq)-[:PERMITS]->(a_durian),
(p_alpha)-[:IN_CURRICULUM]->(c_alpha);
MATCH
(a_cherry:Assignment {name: "Cherry"}),
(a_durian:Assignment {name: "Durian"}),
(c_beta:Curriculum {name: "Beta"})
MERGE
(a_cherry)<-[:REQUIRES]-(prereq:Prereq)-[:PERMITS]->(a_durian)
MERGE
(prereq)-[:IN_CURRICULUM]->(c_beta);
MATCH (p:Prereq) DETACH DELETE p;
MATCH
(a_cherry:Assignment {name: "Cherry"}),
(a_durian:Assignment {name: "Durian"}),
(c_alpha:Curriculum {name: "Alpha"})
CREATE
(a_cherry)<-[:REQUIRES]-(p_alpha:Prereq)-[:PERMITS]->(a_durian),
(p_alpha)-[:IN_CURRICULUM]->(c_alpha);
what is the problem with: