Newer Version Available
Require Rule
Required components can have attributes and quantity specified. The require rule can include an optional explanation message, for the rule failure explanation.
In certain scenarios, you can independently add a type at the header level. This means you can include a specific type even if it isn't explicitly defined as part of any of the relationships you've configured. This capability offers flexibility in managing and including necessary types that might not always fall under a specific relationship structure.
The require rule has this syntax:
1require(logic expression, relationship[type]{var=value,…,var=value}==integer value, "Explanation message");In this example, the require rule specifies that if the number of engineers is more than 0, installation is required. The installation will be automatically added upon adding an engineer.
1type GeneratorSet {
2 relation engineers : engineer[0..99];
3relation installation : install[0..5];
4 require(engineers[engineer] > 0, installation[install], "Installation is required if engineers are present");
5}
6type engineer{}
7type install{}