optional

Description

optional is used when you want the option to use a variable only if circumstances dictate it is needed. The presence of the ontology that is declared using optional, in other words, is not required.

‚Äč

Example

A joint account needs at least two, and up to four account holders. When creating a document for a joint account involving multiple account holders, account holder 1 and account holder 2 are required, and their information has to be filled out.

Account holders 3 and 4, however, are optional. Without them, the account is still a joint account. Using optional, it means the lack of a third and fourth account holder will not cause an error in the case, and the document can still be correctly filled out.

Here is how to express this in RuLa:

ah1 is AccountHolder
ah2 is AccountHolder
ah3 is optional AccountHolder
ah4 is optional AccountHolder

A document that has this condition attached, will now require the information on at least two account holders. If a third or fourth account holder is present in the case, his/her information will be added to the same document.