Currently, the expression $a->gt($b)->gt($c) is allowed, but gets compiled to:
(a > b) > c
However, Cypher supports comparison chains, meaning that something like a > b > c is allowed. This expression is equivalent to a > b AND b > c, while the expression above first evaluates the LHS to a boolean, and then compares that resulting boolean to c.
This extends to all comparison operators and is not limited to three terms. It is even possible to combine comparison operators, e.g.:
a > b >= c = d
Which is equivalent to a > b AND b >= c AND c = d.
Possible implementation
Change the way parentheses are inserted, and do not insert them if the LHS of a comparison operator is also a comparison operator.
Currently, the expression
$a->gt($b)->gt($c)is allowed, but gets compiled to:(a > b) > cHowever, Cypher supports comparison chains, meaning that something like
a > b > cis allowed. This expression is equivalent toa > b AND b > c, while the expression above first evaluates the LHS to a boolean, and then compares that resulting boolean toc.This extends to all comparison operators and is not limited to three terms. It is even possible to combine comparison operators, e.g.:
a > b >= c = dWhich is equivalent to
a > b AND b >= c AND c = d.Possible implementation
Change the way parentheses are inserted, and do not insert them if the LHS of a comparison operator is also a comparison operator.