How to express a conditions for two consecutive variable length relationships?
Consider this partial query
MATCH(t1:Type{myID: 1})-[r:relType]->(:Type)-[rels:relType*0..]-(t2:Type{myID:100})
WHERE r.attr1>10
Basically I am trying to saying that there could be one or more relations from t1
to t2
. The first relation r
should satisfy a given condition on its attribute.
If this is the only relation between the two nodes then it's ok.
It at least another relation exist I want to add another condition such as:
WHERE r.attr1>10 AND r_next.attr2> r_prev.attr2+r_prev.attr1
where r_next
and r_prev
are consecutive relations: ()-[r_prev]->()-[r_next]-()
. Note that at the first step r_prev
is the first relation r
.
I know rels
is a collection but I do not know how to express such a condition.