Possible queries, which allows correct evaluation of if/else constraint in nested/concatenated constraints:
// some other constraints
OPTIONAL MATCH (f:Field)
WITH count(f)>0 as m_0
// if/else constraint check
OPTIONAL MATCH (f1:Field)
OPTIONAL MATCH (f1:Field)-[f1_right_0_f2:right]->(f2:Field)
WITH m_0, f1, f1_right_0_f2, f2
WHERE f1_right_0_f2 IS NULL OR f2 IS NULL
WITH m_0, count(f1) > 0 as m_1
RETURN m_0, m_1
After each constraint OPTIONAL MATCH, return boolean expression instead of the counted number of matches. In the WHERE query only the boolean results will be inserted and evaluated only. If/else socntraint query itself must be changed slightly. As well: change WITH clause of positive and negative constraint.
Note: check if solution for conditions (with precondition) is suitable as well.
Possible queries, which allows correct evaluation of if/else constraint in nested/concatenated constraints:
After each constraint OPTIONAL MATCH, return boolean expression instead of the counted number of matches. In the WHERE query only the boolean results will be inserted and evaluated only. If/else socntraint query itself must be changed slightly. As well: change WITH clause of positive and negative constraint.
Note: check if solution for conditions (with precondition) is suitable as well.