skip to main content
Corticon Studio: Rule Modeling Guide : Collections : Special collection operators : Universal quantifier
 

Try Corticon Now
Universal quantifier
The meaning of the universal quantifier is that a condition enclosed by parentheses is evaluated (i.e., its truth value is determined) for all instances of an entity or collection. This is implemented as the ->forAll operator in the Operator Vocabulary. We will demonstrate this operator with an example created using the Vocabulary from our security ranking model. Note that these operators act on collections, so all the examples shown will declare aliases in the Scope section.
Figure 113. Rulesheet with Universal Quantifier (for all) Condition
In this figure, we see the Condition
secinfo ->forAll(secinfo.rank >= 3)
The exact meaning of this Condition is that for the collection of SecInfo elements associated with a Security (represented and abbreviated by the alias secInfo ), evaluate if the expression in parentheses (secinfo.rank >= 3 )is true for all elements. The result of this Condition is Boolean because it can only return a value of true or false. Depending on the outcome of the evaluation, a value of either High or Low will be assigned to the rating attribute of our Security entity and the corresponding Rule Statement will be posted as a message to the user.
The following figure shows a Ruletest constructed to test our for all Condition rules.
Figure 114. Ruletest for Testing for all Condition Rules
In this Ruletest, we are evaluating a collection of three SecInfo elements associated with a Security entity. Since the rank value assigned in each SecInfo object is at least 3, we should expect that our for all Condition will evaluate to true and a rating value of High will be assigned to our Security object when the Ruletest is run through Corticon Server. This outcome is confirmed in the Ruletest results, as shown:
Figure 115. Ruletest for for all Condition Rules