You are viewing the documentation for Blueriq 16. Documentation for other versions is available in our documentation directory.

Learn more about the logical functions AND, OR, NOT, logical values TRUE, FALSE, and the special meta-value UNKNOWN. 

Overview

Function / valueDescription
ANDReturns TRUE if all its arguments evaluate to TRUE; it returns FALSE if one or more arguments evaluate to FALSE.
NOTReverses the value of its boolean argument.
ORReturns TRUE if at least one of its arguments evaluates to TRUE; it returns FALSE if none of the arguments evaluate to TRUE.
UNKNOWNUse the '?' (question mark), representing UNKNOWN, to check if an expression or an attribute has a value.
TRUEThis is the boolean value TRUE.
FALSEThis is the boolean value FALSE.

Functions

AND


Returns TRUE if all its arguments evaluate to TRUE; it returns FALSE if one or more arguments evaluate to FALSE.


Syntax

argument1 AND argument2 [AND ...]



Inputs
  • argument1 - The first boolean condition that you want to evaluate.
  • argument2 - The first boolean condition that you want to evaluate.
  • [AND …] - Additional boolean conditions that you want to evaluate. (optional)


Return type

  • boolean


Examples

ExpressionResultType
TRUE AND TRUETRUEboolean
TRUE AND FALSE

FALSE

boolean
TRUE AND ? (= UNKNOWN)UNKNOWNboolean
FALSE AND ? FALSEboolean




OR


Returns TRUE if at least one of its arguments evaluates to TRUE; it returns FALSE if none of the arguments evaluate to TRUE.


Syntax

argument1 OR argument2 [OR ...]


Input

  • argument1 - The first boolean condition that you want to evaluate. argument2 - The first boolean condition that you want to evaluate. [OR …] - Additional boolean conditions that you want to evaluate.


Return type

  • boolean


Examples

ExpressionResultType
TRUE OR TRUE

TRUE

boolean
TRUE OR FALSETRUEboolean
FALSE OR FALSEFALSEboolean

TRUE OR ? (= UNKNOWN)

TRUEboolean
FALSE OR ? (= UNKNOWN)UNKNOWNboolean


Back to Top


NOT


Reverses the value of its boolean argument.


Syntax

NOT argument


Input
  • argument - The boolean condition of which you want to reverse its value.


Return type

  • boolean


Examples

ExpressionResultType
NOT (TRUE)FALSEboolean
NOT (TRUE AND FALSE)TRUEboolean
NOT ( ? (= UNKNOWN) )UNKNOWNboolean
NOT (NOT (TRUE))TRUEboolean


Using brackets is not required, but advised to clearly indicate which boolean condition needs to be reversed.


UNKNOWN


Use the '?' (question mark), representing UNKNOWN, to check if an expression or an attribute has a value.

Example

Suppose a model with an entity Person and attributes Person.name and Person.age. In runtime, a user fills out a form and enters his name, but forgets to fill out his age.

As a result:

ExpressionResultTypeReason
Person.name = ?FALSEbooleanThis attribute is filled out
Person.age = ?TRUEbooleanThis attribute is not filled out, and therefore UNKNOWN

TRUE


This is the boolean value TRUE.

FALSE


This is the boolean value FALSE.



4 Comments

  1. Unknown User (d.van.der.poel)

    I was wondering in what order logical operators are processed. My assumption was AND first, then OR. It seems that it is neither that nor the other way around:


    FALSE AND FALSE OR TRUE --> TRUE (consistent with AND first, inconsistent with OR first)

    TRUE OR FALSE AND FALSE --> FALSE (consistent with OR first, inconsistent with AND first)

    Both: consistent with ( ( A operator B ) operator C )


    Edit: corrected a copy-paste error

    1. I always learned to use brackets. When omitted, expect anything, even the spanish inquisition.

  2. In older documentation I saw a comment that there was a operator for exclusive or (Logical functions).

    Is there a build in operator or do i still model this like ?

    1. You can use ' != ' (does not equal) to perform XOR on two boolean expressions.

      Note the difference between using ' != '  as ...

      • ... a check if an attribute/expression is known   ( entity.attribute != ? , green cells )
      • ... XOR ( expression != expression , blue cells )


      !=TRUEFALSEExpression resulting in ?

      Manual input of ?

      TRUEFALSETRUE?TRUE
      FALSETRUEFALSE?TRUE
      Expression resulting in ????FALSE

      Manual input of ?

      TRUETRUEFALSEFALSE