Operator precedence rules

EQL enforces the following precedence rules for operators.

The rules are listed in descending order:
  1. Parentheses (as well as brackets in lookup expressions and IN expressions). Note that you can freely add parentheses any time you want to impose an alternative precedence or to make precedence clearer.
  2. * /
  3. + -
  4. = <> < > <= >=
  5. IS (IS NULL, IS NOT NULL, IS EMPTY, IS NOT EMPTY)
  6. IN
  7. BETWEEN
  8. NOT
  9. AND
  10. OR

Except for IN, the binary operators are left-associative, as are all of the JOIN operators. IN (for set membership) is not associative (for example, writing x IN y IN z results in a syntax error.)

Comparisons with sets

When comparing values against sets (multi-assign data), you must use the appropriate set functions and expressions.

For example, if Price is a single-assign double attribute, then this syntax is correct:
RETURN Results AS
SELECT Price AS prices
FROM ProductsState
WHERE Price > 20
However, if Score is a multi-assign integer attribute, then this syntax will fail:
RETURN Results AS
SELECT Score AS ratings
FROM ProductsState
WHERE Score > 80
The error message will be:
In statement "Results": in WHERE clause: The comparison operators are not defined on arguments
of types mdex:long-set and mdex:long

The error message means that Score is a set (an mdex:long-set data type) and therefore cannot be compared to an integer (80, which is an mdex:long data type).

You therefore must re-write the query, as in this example:
RETURN Results AS
SELECT Score AS Ratings
FROM ProductsState
WHERE SOME x IN Score SATISFIES (x > 80)

This example uses an existential quantifier expression.