Skip to main content
Version: 7.0

Logical operators (AND, OR, NOT, XOR)

Logical operators create properties that consider their operands as logical values of class BOOLEAN and whose return value is also a value of class BOOLEAN. If the value of an operand of a logical operator is not NULL, then the operand is treated as the value TRUE of class BOOLEAN, otherwise as NULL. The result is always either TRUE or NULL, never FALSE.

The platform currently supports the following logical operators:

OperatorNameDescriptionExampleResult
ANDConjunctionTakes two operands and returns TRUE if both operands are non-NULLTRUE AND TRUETRUE
ORDisjunctionTakes two operands and returns TRUE if either operand is non-NULLNULL OR TRUETRUE
NOTNegationTakes one operand and returns TRUE if the operand is NULLNOT TRUENULL
XORExceptionTakes two operands and returns TRUE if exactly one operand is non-NULLTRUE XOR TRUENULL

With more than two operands, XOR returns TRUE when an odd number of operands are non-NULL.

Language

Description of logical operator syntax.

Examples

likes = DATA BOOLEAN (Person, Person);
likes(Person a, Person b, Person c) = likes(a, b) AND likes(a, c);
outOfInterval1(value, left, right) = value < left OR value > right;
outOfInterval2(value, left, right) = NOT (value >= left AND value <= right);