Compose Business Rules

You use the Rule Composer to define a business rule written in plain text within a Business Rule element or Class operation. The Rule Composer enables you to model conceptual-level business rules at a logical level in tabulated format, which assists in transforming the rules to technology-specific rules (code).

You can also download the contents of the Rule Composer to a spreadsheet application such as Microsoft Excel, via a CSV file.

Topics

Topic

Detail

See also

Access The Rule Composer

To access the Rule Composer, right-click on a Rule Task element and select the Rule Composer context menu option; the Rule Composer displays in the central work area on its own tab.

The Rule Composer consists of:

a Rule Statements list
a Decision Table and
a Computation Rule Table.

 

To assist with traceability, as the Rule Composer is completed, selections in one table automatically highlight the corresponding rows and columns of the other tables; for example, if a Rule Statement is selected, the related rule column in the Decision Table and row in the Computation Rule Table are highlighted.

Similarly, if a Computational Rule is selected, the corresponding column in the Decision Table and row in the Rule Statements list are highlighted.

 

 

Rule Statements Table

The Rule Statements table lists the rules associated with the selected Rule Task; you add a rule to the table by dragging an existing Business Rule element from the Project Browser onto an empty row in the Rule Statements table.

You cannot create new rules within the table.

 

 

Decision Table

The Decision Table enables you to model conditional rules (for example: Cars must not be rented to customers of age less than 18)

The table has three sections:

Rule Conditions - to model condition variables
Rule Actions - to model action variables
Rule Bindings - to link the rule in the rule table.

 

 

Computation Rule Table

The Computation Rule table enables you to model rules involving computations

The table has the following columns:

Computation Rule Actions
Expression
Rule Bindings
Rule Dependency.

 

 

How to

To define a business rule associated with the selected Rule Task

Step

Action

See also

1

For the first rule, select the text within the Business Rule element and drag it onto the empty row.

 


2

For a subsequent rule, click on the No column and select the Add Row context menu option; an empty row is added to the Rule Statements table.

 


3

Drag the required Business Rule element from the Project Browser onto the new row.

If the Business Rule element is not already on the diagram, this adds the element to the diagram and creates a Dependency relationship between the Business Rule and Rule Task elements.

 

 

 

To remove a rule that is no longer required in the Rule Composer, right-click on the appropriate No field and select the Remove Rule context menu option. This removes the rule from the Rule Composer and deletes the Dependency relationship with the Rule Task element. However, it does not remove the Business Rule element from either the diagram or the Project Browser (where, in either case, it might be in use with other Rule Task elements).

To model Rule Conditions in the Rule Conditions Section

Step

Action

See also

1

The Business Domain model defines the business terms (such as Customer) and their associated attributes; from the appropriate Class element in the Project Browser, drag and drop the required condition attribute (such as age) or operation (such as IsValidLicense()) onto the Rule Conditions column.

The Rule Condition field enables you to use intellisense to display a list of possible entries for the field; press ( Ctrl+Spacebar ) in the field to display the list of entries
If the Rule Condition is of type enum, the Allowable Values fields are automatically set with the enum literals; the procedure then ends here.

 


2

Determine a range of accepted values for the Rule Condition.

 


3

Right-click on the Allowable Values column and select the Edit Allowable Values context menu option; the Edit Allowable Values dialog displays.

Type each required value or range of values in the Value field, and click on the Save button to display the value in the Allowable Values list box
 
age could have the values:
<18
>18 and <50
>50
 
IsValidLicense() could return:
True
False

 

 

4

Click on the OK button to save the values and close the dialog; a new constraint AllowableValues is created for the attribute.

You can check this constraint by opening the Properties dialog for the attribute and selecting the Constraints tab
If the Rule Condition references an enumeration, the enum literals are not editable in the Edit Allowable Values dialog.

 

 

5

If the Rule Condition is an operation, you can pass parameters to it.

Right click on the Allowable Values field, and select the Edit Parameters context menu option; the Edit Parameters dialog displays.

Select the parameters and type their values into the Value text box; click on the OK button to cancel the dialog.

You can add an operation as a Rule Condition more than once, to allow calling the operation with different sets of parameters
To add another Rule Condition, right-click on the No column and select the Add Row context menu option; an empty row is added to the table.

 

To remove a Rule Condition from the table, right-click on the appropriate No field and select the Delete Row context menu option; this does not affect the original attribute or the new constraint in the model.

You can either re-use the attribute with its constraint, or use the attribute Properties dialog to remove the constraint.

 

 

 

To model Rule Actions in the Rule Actions section

Step

Action

See also

1

In the Rule Actions section, when a specific value of a Rule Condition calls an operation (such as post error) or decision attribute (such as Eligible - Yes/No), you assign the operation or attribute as an action.

From a business term Class element in the Project Browser, drag and drop the required attribute or operation onto the Rule Actions field.

The Rule Actions field enables you to use intellisense to display a list of possible entries for the field; press ( Ctrl+Spacebar )  in the field to display the list of entries.

 


2

For an attribute, double-click on the Allowable Values/Parameters field; the Edit Allowable Values dialog displays.

Type the range of values in the text box (such as Yes, No; or Accept, Reject), click on the Save button and close the dialog; select the appropriate response in the Result column fields.

If the dropped action variable is of type enum, the Allowable Values/Parameters fields are automatically set with the enum literals.

 


3

For an operation, a checkbox displays in each of the Result column fields; to call the operation, select the checkbox in the appropriate column.
 
To pass parameters to the operation, double-click on the Allowable Values/Parameters field; the Edit Parameters dialog displays.

Select the parameters and type the values into the Value text box; click on the Save button and close the dialog.

You can add an operation as a Rule Action more than once, to allow calling the operation with different sets of parameters.

 

 

4

Click on the Save button in the Rule Composer toolbar to save the values.

Alternatively, you can right-click on an Allowable Values/Parameters field to display a context menu with two options:

If the Rule Action is an attribute, the Edit Allowable Values option is enabled and this displays the Edit Allowable Values dialog
If the Rule Action is an operation, the Edit Parameters option is enabled and this displays the Edit Parameters dialog

 

To add another Rule Action, right-click on the No column and select the Add Row context menu option; an empty row is added to the table.

To remove a Rule Action from the table, right-click on the appropriate No field and select the Delete Row context menu option; this does not affect the original attribute or operation in the model.

 

 

 

To bind a rule in the Rule Bindings Section

Step

Action

See also

1

The Rule Bindings section lies on top of the Rule Conditions section; it binds the Rule Condition and Rule Action values to the appropriate rule in the Rule Table.

Select the rule number in the Rule Bindings field over one of the Value<n> or Result<n> columns.

 


2

Ensure that the values set in the Value<n> or Result<n> field for the Rule Condition or Rule Action, underneath the rule number, all satisfy the rule.

 


3

Click on the Save icon in the Rule Composer toolbar.

For example, if rule 2 is Car must not be rented to Customers of age less than 18:

Select 2 in the Rule field over the Value1 column
Select < 18 against Customer.age in the Value1 column in the Rule Conditions table
Select No against Customer.Eligible in the Result1 column in the Rule Action table
Select Reject against Application.Status in the Result1 column in the Rule Action table.

 

 

 

To define a computation rule

Step

Action

See also

1

From the Project Browser, drag and drop the appropriate attribute from a Class in the Fact model into the Computation Rule Actions field.

Both the Computation Rule Actions field and the Expression field enable you to use intellisense to display a list of possible entries for the fields; press (Ctrl + Spacebar ) in the field to display the list of entries.

 


2

In the Expression field, type the expression to be evaluated.

 


3

In the Rule Bindings field, type the rule number from the Rule table of the rule being modeled, to link the table data to the rule.

 

 

4

If the rule depends on another rule being satisfied first, type the number of that rule in the Rule Dependency field.

 

 

5

Click on the Save icon in the Rule Composer toolbar to save the computation rule.

If the computation rule is also a Rule Conditions rule, add the condition variable in the Decision table and bind the appropriate rule in the Rule Bind section.

 

 

 

To export the contents of the Rule Composer to a CSV file, follow the steps below

Step

Action

See also

1

Click on the Export to CSV icon (csvicon) in the Rule Composer toolbar; the Windows Browser dialog displays.

 


2

Browse to the required file location and type in a .CSV filename to export to.

 


3

Click on the Save button to export the data.

 

 

Learn more

 

Learning Center topics

(Alt + F1) | Business Modeling | Business Rules |  Rule Composer