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

EXISTS


Determines whether an instance of a specified entity exists, optionally meeting certain criteria.


Syntax

EXISTS instances [ WHERE ( condition ) ]


Inputs
  • instances - Instances to search.
  • condition - boolean expression that represents the criterion the instance has to meet.


Return type

  • boolean


Examples

Suppose the following data model.


Person.namePerson.genderPerson.age
“Kim”?23
“Rick”“m”35
“Bob”“m”42
“John”“m”19
“Mary”“f”33
ExpressionResultType
EXISTS PersonTRUEboolean
EXISTS Person WHERE ( Person.age < 18 ) FALSEboolean
EXISTS Person WHERE ( Person.gender = "m" AND Person.age > 35 )TRUEboolean
EXISTS Person WHERE ( Person.gender = "f" AND Person.age < 25 )UNKNOWNboolean
EXISTS Person WHERE ( Person.age < 25 AND Person.gender = "f" )FALSEboolean
EXISTS Person WHERE ( Person.gender = ? )TRUEboolean

Please note that you can use a COLLECT expression as well for collecting instances for which the EXISTS should hold. E.g., EXISTS (COLLECT Person FROM ALL Person WHERE (Person.gender = "f")) WHERE ( Person.age < 25 ).

In case that the list of instances for which the EXISTS should hold is an EMPTY list, then the EXISTS expression returns FALSE.

Back to Top