skip to main content
Corticon Studio: Rule Modeling Guide : Recognizing and modeling parameterized rules : Parameterized rule where a specific attribute is a variable (or parameter) within a general business rule
 

Try Corticon Now

Parameterized rule where a specific attribute is a variable (or parameter) within a general business rule

During development, patterns may emerge in the way business rules define relationships between Vocabulary terms. For example, in our sample FlightPlan application, a recurring pattern might be that all aircraft have limits placed on their maximum takeoff weights. We might notice this pattern by examining specific business rules captured during the business analysis phase:
These rules are almost identical; only a few key parts – parameters – are different. Although aircraft type (747 or DC-10) and max cargo weight (200,000 or 150,000 kilograms) are different in each rule, the basic form of the rule is the same. In fact, we can generalize the rule as follows:
Where the parameters X and Y can be organized in table form as shown below:
Aircraft type X
Maximum cargo weight Y
747
200,000
DC-10
150,000
It is important to recognize these patterns because they can drastically simplify rule writing and maintenance in Corticon Studio. As shown in the following figure, we could build these two rules as a pair of Rulesheets, each with a Filter expression that filters data by aircraftType.
Figure 195. Non-Parameterized Rule
But there is a simpler and more efficient way of writing these two rules that leverages the concept of parameterization. The following figure illustrates how this is accomplished:
Figure 196. Parameterized Rules
Notice how both rules are modeled on the same Rulesheet. This makes it easier to organize rules that share a common pattern and maintain them over time. If the air cargo company decides to add new aircraft types to its fleet in the future, the new aircraft types can simply be added as additional columns.
Also notice the business rule statements in the Rule Statements section. By entering 1:2 in the Ref column and inserting attribute names into the rule statement, the same statement can be reused for both rule columns. The syntax for inserting Vocabulary terms into a rule statement requires the use of {..} curly brackets enclosing the term. See the Rule Language Guide for more details on embedding dynamic values in Rule Statements.
In addition to collecting parameterized rules on the same Rulesheet, other things can be done to improve rule serviceability. In the Trade Allocation sample application that accompanies the Corticon Studio installation, two parameterized rules are accessible directly from the application's user interface – the user can update these parameters without entering the Corticon Studio because they are stored externally. When the application runs, Corticon Studio accesses the parameter table to determine which rules should fire.