Please note : This help page is not for the latest version of Enterprise Architect. The latest help can be found here.
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:
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:
|
|
Computation Rule Table |
The Computation Rule table enables you to model rules involving computations. The table has the following columns:
|
|
How To:
To define a business rule associated with the selected Rule Task, follow the steps below
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, follow the steps below
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.
|
|
2 |
Define 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. |
|
4 |
Click on the OK button to save the values and close the dialog. A new constraint AllowableValues is created for the attribute.
|
|
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.
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, follow the steps below:
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. 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:
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, follow the steps below
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, (referring to the screen diagram at the top of this Rule Composer topic) if rule 2 is Car must not be rented to Customers of age less than 18:
|
|
To define a computation rule, follow the steps below:
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 ( |
|
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: