A Rule Set is a container for a group of logically related rules and actions. Rule sets are functionally significant because they establish when and how the underlying rules are executed. This is accomplished by setting the fire and run modes for the rule set. Rule Sets may also be activated and deactivated individually or by Category to further control the flow and behavior of rule execution.
Three types of rule sets
- Entity rule sets - Rule sets based on an entity context and apply for all instances of the entity
- Context-specific rule sets - Rule sets based on an entity context relevant to a specific location in the schema (via Entity Field or Collection reference)
- Independent rule sets - Rule sets defined without an associated Entity context (Entities and values are passed in as parameters)
All rule sets and rules appear under the Rules folder in the navigation pane. The Rules folder contains a folder for each entity, field, or collection that has a Rule Set specific to its context as well as a folder that contains all independent rule sets.
Each context-specific Rule Set folder for an entity will contain a separate node for Classifications and Constraints if any have been defined for the entity.
Adding a Rule Set
- Click on Entity in the left-hand navigation pane.
- Click the Add Rule Set button.
- The Select Rule Set Context window will be displayed. Select the context to which you would like the Rule Set to run under, and click OK.
Deleting a Rule Set
- Right-click on the Rule Set you want to delete.
- Click the Delete button.
- You will be prompted to delete the Rule Set. Click Yes.
Modifying a Rule Set
- Click on the Rule Set you want to modify.
- The Edit Rule Set screen will be displayed.
The following settings are available for a rule set:
Name
Specifies the name of the Rule Set. This name is used when explicitly executing or activating a rule set from either the Execute Rule Set Action, Activate Rule Set Action, or from irSDK.
Enabled
Designates whether or not this Rule Set will be compiled into the rule dependency network during rule execution. If a Rule Set is not Enabled, it CANNOT be re-enabled during rules processing at runtime. It cannot be re-enabled using Actions. Rule Sets whose Enabled property is set to FALSE will be grayed out in the navigation tree.
Activated by Default
Designates whether or not this Rule Set will be considered in the initial rule dependency network during rule execution. Rule Sets CAN be re-activated during rule processing at runtime using various activate rule set actions, or a calling application using the SDK. When activated, they are run as part of an apply rules directive, otherwise they are not. Activated by default means that an explicit “Activate rule set Action” is not required for the rule set to run. Rule sets can be activated or deactivated by name or by category. When testing using irVerify, rule sets can be activated/ deactivated using the right-click menu.
Auto Fire Mode
Specifies that the Rule Set and its associated rules are always "on" and the engine controls when the rule sets get placed on the agenda. The engine will automatically re-fire rules within the rule set when its dependent values change. The Run Mode dictates when dependent value changes are checked and if the entire rule set or individual rules will re-fire.
Run Mode
Specifies how often the rule engine will re-evaluate the Rule Set. There are three modes: optimized, sequential, and single-pass sequential.
- Optimized: The engine will automatically recalculate a condition within the rule set any time any of its dependent values change. Optimized Rule Sets do not fire in the order they are authored - the engine decides the sequence based on a proprietary optimization algorithm. An "Optimized" Rule Set will continue to fire until all of its conditions are satisfied. Only a limited set of actions are available in optimized rule set.
- Sequential: Specifies that the rule set and its associated rules are always "on". Unlike "optimized" rule sets, sequential rule sets execute in the order they appear in the list. These Rule Sets will fire any time a dependency for a top-level rule condition changes as the result of running a subsequent rule set.
- Single-Pass Sequential: Single-pass sequential rule sets execute in the order they appear in the list (in "Auto" fire mode), and execute only once, even if a dependency for a top-level rule condition changes during execution of a subsequent rule set.
Explicit Fire Mode
Specifies that the Rule Set will be executed only when explicitly instructed to do so by an action or calling application. The Run Mode for an explicit rule set is single-pass sequential, thus an explicit rule set is appropriate for procedural operations and will not get re-fired automatically by the engine.
An explicit rule set allows users to pass in additional information via "Parameters". For entity rule sets, this extends the authoring scope of available values and entities beyond the base entity context of the rule set. The “Parameters” grid provides the definition of decimal, Boolean, date, datetime, integer, text, and entity type arguments that can be passed in via an Execute Rule Set Action or from irSDK. Defining parameters is optional; they are input only (except Entity types which are reference-based) and only available with explicit and independent rule sets.
Parameters are optional and not required for basic Rule Set execution. When the Auto Create box is checked, an instance of the specified entity type is created automatically when the rule set is executed.
Vocabulary
Specifies the list of Vocabulary that will be executed for this Rule Set.
Rules
Specifies the list of Rules and Actions that will be executed for this Rule Set.
View Detail
Displays the Rule Application Detail Report filtered to only show this Rule Set.
Entity Rule Sets
Entity rule sets are the most commonly used of the three rule set types. The associated entity establishes the authoring and execution context for the rule set to operate against, essentially defining which fields are available to the rule set. One goal when authoring rules is to keep the logic in a rule set as atomic as possible without having to reach across contexts; an entity rule set lends itself to this approach as it defines a limited and relevant logical context for the rules. Entity rule sets are typically the recommended authoring model for new users.
Entity rule sets include the following features
- Access to both auto and explicit fire modes
- Rule execution in the context of the associated entity
- Access to related entities in the hierarchy (parent access is optional and set in the Entity definition)
- Most versatile – recommended for the majority of rule authoring
The below example shows a rule set PaymentSummaryRules authored in the context of the Mortgage entity. The rule set has access to all of the fields in the Mortgage entity as well as child entities and collections. For example, rules authored in the Mortgage entity context have access to the LoanInfo child entity (its fields and children), Payment Summary child entity (its fields and children), and the Payments collection.
Creating Entity Rule Sets
An entity rule set can be created from the navigation tree under the Rules folder or from the Entity Definition pane (Edit Rules for this Entity section). From the navigation tree, right-click on the Rules folder and select Insert -> Rule Set, which triggers a pop-up window asking the user to select the context for the rule set.
Name
Specifies the name of the Rule Set. This name is used when explicitly executing or activating the rule set from either an Execute Rule Set Action, Activate Rule Set Action, or from irSDK.
Parameters
Available only in the explicit fire mode. Specifies decimal, Boolean, date, datetime, integer, text, and entity values to act as the inputs for the execution of the rule set. The Auto Create checkbox is enabled for entity parameters only. When the Auto Create box is checked, an instance of the specified entity type is created automatically when the rule set is executed.
Parameters are optional and not required for basic Rule Set execution.
Activated by Default
Designates whether or not this Rule Set will be considered in the initial rule dependency network during rule execution. Rule Sets CAN be re-activated during rule processing at runtime using various Activate Rule Set actions.
Rules
Specifies the list of Rules and Actions that will be executed for this Rule Set.
Context Rule Sets
Context Rule Sets provide the ability to author rules for an Entity that is referenced at a specific location in the schema. They are useful for rules that need to pertain to an Entity when used in a particular context, but the rules will not apply for instances of the Entity in other contexts. For example, an "Address" entity could be referenced from multiple fields on an "Order" entity including "ShippingAddress" and "BillingAddress". A Context Rule Set can be defined in the context of "Order.ShippingAddress" and the rules will be in effect for only the "ShippingAddress" instance of the "Address" entity.
Context Rule Sets may exist in the context of
- Fields - Must have a data type set to Complex or Entity (referred to as a "child entity")
- Collections - Each collection member is the "child entity" context
When authoring rules, users can reference fields from both the child entity and the parent entity. This is referred to as “dual context”. Again, an advantage of this authoring model is that it allows users to author rules against instances of an entity referenced from a specific location in the schema (either from a Field or Collection) rather than ALL instances of the entity type, which is the entity rule set model.
Context Rule Sets include the following features
- Access to both auto and explicit fire modes
- Lets users write rules in the context of specific Complex or Entity fields
- Useful when referencing 1 instance of an entity (referenced in a field) rather than every instance of an entity
The below example shows a rule set that was created in the context of the Mortgage.PaymentSummary entity field, giving it access to all the data in the Mortgage as well as the instance of PaymentSummary referenced in the Mortgage.PaymentSummary field.
Creating Context Rule Sets
Users can create Context Rule Sets by clicking on the target field or collection and clicking Create Rules.
Name
Specifies the name of the Rule Set. This name is used when explicitly executing or activating the rule set from either an Execute Rule Set Action, Activate Rule Set Action, or irSDK.
Parameters
Available only in the explicit fire mode. Specifies decimal, Boolean, date, datetime, integer, text, and entity values to act as the inputs for the execution of the rule set. The Auto Create checkbox is enabled for entity parameters only. When the Auto Create box is checked, an instance of the specified entity type is created automatically when the rule set is executed.
Parameters are optional and not required for basic Rule Set execution.
Activated by Default
Designates whether or not this Rule Set will be considered in the initial rule dependency network during rule execution. Rule Sets CAN be re-activated during rule processing at runtime using various Activate Rule Set actions.
Rules
Specifies the list of Rules and Actions that will be executed for this Rule Set.
Independent Rule Sets
Independent rule sets do not have an inherent associated entity context (unlike entity rule sets or context rule sets ). All entities and values that are referred to by rules in the rule set must be declared as parameters of the rule set.
Independent rule sets are always fired in explicit mode (the fire mode is always explicit and not- configurable)
Creating Independent Rule Sets
Users can create independent rule sets by right-clicking on the Independent Rule Sets folder and selecting Insert -> Rule Set.
Name
Specifies the name of the Rule Set. This name is used when executing the independent rule set from either an Execute Rule Set Action or irSDK.
Parameters
Specifies decimal, Boolean, date, datetime, integer, text, and entity values to act as the inputs for the execution of the independent rule set. The Auto Create checkbox is enabled for entity parameters only. When the Auto Create box is checked, an instance of the specified entity type is created automatically when the rule set is executed.
Parameters are optional and not required for basic rule set execution.
Activated by Default
Designates whether or not this Rule Set will be considered in the initial rule dependency network during rule execution. Rule Sets CAN be re-activated during rule processing at runtime using various Activate Rule Set actions.
Rules
Specifies the list of Rules and Actions that will be executed for this Rule Set.
Comments
0 comments
Please sign in to leave a comment.