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

During development, patterns can emerge in the way business rules define relationships between Vocabulary terms. For example, in the sample FlightPlan application, a recurring pattern might be that all aircraft have limits placed on their maximum takeoff weights. You 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 (200000 or 150000 kilograms) are different in each rule, the basic form of the rule is the same. In fact, you can generalize the rule as follows:

Where the parameters X and Y can be organized in table form, as shown:

Aircraft type X Maximum cargo weight Y
747 200000
DC-10 150000

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, you could build these two rules as a pair of Rulesheets, each with a Filter expression that filters data by aircraftType.

Figure 1. 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 2. 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, then the new aircraft types can 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 {..} braces brackets enclosing the term. See the Rule Language Guide for more details about 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.