Show Table of Contents




3.3. Web Based Guided Decision Tables
3.3.1. Web Based Guided Decision Tables
Decision tables can be edited in the asset editor. Rules derived from web based decision tables are compiled into the DRL format.

Figure 3.4. Guided Decision Table
Expand the Decision table section of the asset editor by clicking the plus sign next to Decision table.
Conditions, actions, and options are added to or removed from the decision table by expanding the relevant section of the asset edit, i.e., Condition columns, Action columns, and (options).
3.3.2. Column Configuration
Columns can have the following types of constraint:
- LiteralThe value in the cell will be compared with the field using the operator.
- FormulaThe expression in the cell will be evaluated and then compared with the field.
- PredicateNo field is needed, the expression will be evaluated to true or false.
You can set a default value, but normally if there is no value in the cell, that constraint will not apply.

Figure 3.5. Column Configuration
3.3.3. Attribute Columns
Zero or more attribute columns representing any of the DRL rule attributes can be added. An additional pseudo attribute is provided in the guided decision table editor to "negate" a rule. Use of this attribute allows complete rules to be negated. For example, the following simple rule can be negated as also shown.
when $c : Cheese( name == "Cheddar" ) then ... end
when not Cheese( name == "Cheddar" ) then ... end
3.3.4. Utility Columns
Two columns containing rule number and description are provided by default.
3.3.5. Metadata Columns
Zero or more meta-data columns can be defined, each represents the normal meta-data annotation on DRL rules.
3.3.6. Condition Columns
Conditions represent fact patterns defined in the right-hand side, or "when" portion, of a rule. To define a condition column, you must define a binding to a model class or select one that has previously been defined. You can choose to negate the pattern. Once this has been completed, you can define field constraints. If two or more columns are defined using the same fact pattern binding, the field constraints become composite field constraints on the same pattern. If you define multiple bindings for a single model class, each binding becomes a separate model class in the right-hand side of the rule.
3.3.7. Action Columns
Action columns can be defined to perform simple operations on bound facts within the rule engine's working memory, or they can be used to create new facts entirely. New facts can be inserted logically into the rule engine's working memory thus being subject to truth maintenance as usual. Please refer to the JBoss Rules Reference Guide for information about truth maintenance and logical insertions.
3.3.8. Rule Definition
Rules are created in the main body of the decision table using the columns that have already been defined.
Rows of rules can be added or deleted by clicking the plus or minus symbols respectively.

Figure 3.6. Rule Definition
3.3.9. Cell Merging
The icon in the top left of the decision table toggles cell merging on and off. When cells are merged, those in the same column with identical values are merged into a single cell. This simplifies changing the value of multiple cells that shared the same original value. When cells are merged, they also gain an icon in the top-left of the cell that allows rows spanning the merged cell to be grouped.

Figure 3.7. Cell Merging
3.3.10. Cell Grouping
Cells that have been merged can be further collapsed into a single row. Clicking the [+\-] icon in the top left of a merged cell collapses the corresponding rows into a single entry. Cells in other columns spanning the collapsed rows that have identical values are shown unchanged. Cells in other columns spanning the collapsed rows that have different values are highlighted and the first value displayed.

Figure 3.8. Cell Grouping
When the value of a grouped cell is altered, all cells that have been collapsed also have their values updated.
3.3.11. Otherwise Operations
Condition columns defined with literal values that use either the equality
== or inequality != operators can take advantage of a special decision table cell value of otherwise. This special value allows a rule to be defined that matches on all values not explicitly defined in all other rules defined in the table. This is best illustrated with an example:
when
Cheese( name not in ("Cheddar", "Edam", "Brie") )
...
then
...
endwhen
Cheese( name in ("Cheddar", "Edam", "Brie") )
...
then
...
end
Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.