You are viewing the documentation for Blueriq 14. 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.name | Person.gender | Person.age |
---|---|---|
“Kim” | ? | 23 |
“Rick” | “m” | 35 |
“Bob” | “m” | 42 |
“John” | “m” | 19 |
“Mary” | “f” | 33 |
Expression | Result | Type |
---|---|---|
EXISTS Person | TRUE | boolean |
EXISTS Person WHERE ( Person.age < 18 ) | FALSE | boolean |
EXISTS Person WHERE ( Person.gender = "m" AND Person.age > 35 ) | TRUE | boolean |
EXISTS Person WHERE ( Person.gender = "f" AND Person.age < 25 ) | UNKNOWN | boolean |
EXISTS Person WHERE ( Person.gender = ? ) | TRUE | boolean |
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.
Overview
Content Tools