Action: Ensure Instances
This action ensures the instances you specify are present in a case, if the rule's condition is met.
Adding this action to a rule displays the following field:
Field
Description
Creation
Using RuLa, specify what instance(s) should be created in the case.
Example of a condition,
cr is ContractualRelationship
cr.type_of_account = joint
and the 'Ensure Instance' action it triggers to ensure there are two instances of the ontology Person, with the role AccountHolder:
create 2 AccountHolder, Person
Use the exact term of the role and ontology, here: AccountHolder and Person , even though we're dealing with the creation of two instances. The role 'AccountHolders' does not exist in RuLa, nor does the ontology 'Persons', so using those would lead to an error message.
As the name of the action indicates, the system will Ensure the instances exist in the case. If they do not exist yet, this action triggers the creation of them. However, if they already exist before this action is triggered, the action will not create another two.

Calculating how many to create

In the example, the Action: Ensure Instances is create 2 AccountHolder, Person .
The number of instances to create doesn't have to be an integer. It can also be any RuLa expression. We could replace the integer 2 with a calculation. In the most straightforward way, this results in:
ensure 1 + 1 AccountHolder, Person
You can even replace the integer with a direct reference to what is written in the rule's condition. If there, it says cr is ContractualRelationship , then this is how to match it in an Ensure Instances action:
ensure cr.number_of_account_holders Person
This ensures the number of instances of Person equals the number of account holders that exist in the Contractual Relationship.
Copy link