Package ilog.rules.dt

Contains classes related to decision tables and decision trees.

See: Description

  • Interface Summary 
    Interface Description
    IlrDTEnvironment
    IlrDTEnvironment specifies the API of an object that provides the DT model with an environment.
    IlrDTRuleEditingContext
    This interface represents a Rule Editing Context in the context of a DT.
    IlrDTRuleElement
    Specifies the API used by the DT model to manipulate the decision table or decision tree artifact.
  • Class Summary 
    Class Description
    IlrDTAbstractEnvironment
    IlrDTAbstractEnvironment is an abstract partial implementation of the IlrDTEnvironment interface.
    IlrDTController
    IlrDTController controls a DT Model as well as its companion classes, such as a rule element and the rule environment.
    IlrDTExpressionManager
    IlrDTExpressionManager is a companion class to the DT controller, it is used to manipulate DT model expressions.
    IlrDTIRLTranslator
    This class is the implementation of an IRL translator for DT.
    IlrDTIRLTranslatorFactory
    This class is a factory to create instances of DTIRLTranslator.
    IlrDTRuleDefinition
    This class wraps the DOM of a DT model and store a DTController that is lazily created from the XML definition.
    IlrDTTranslator
    This class convert its associated DT to a code.
    IlrDTVariableManager
    This class handles variables accessible from expressions in the decision table.

Package ilog.rules.dt Description

Contains classes related to decision tables and decision trees.

This package provides the root classes to manipulate a DT model and its associated services

Overview

Decision tables provide an alternative and more convenient way of viewing and managing large sets of similar business rules. They are composed of rows and columns: each row corresponds to a single rule, with the columns defining the conditions and actions that apply to the rules.

You can add new rows to a decision table and fill in its cells to create new rules. When the conditions of a given row are met, the actions in that row are performed. It is also possible to add preconditions that apply to all the rules, as explained in section Preconditions. Decision tables also make it easy to see whether you have any overlap or gaps in your rules. To help you with this, decision tables offer some consistency checking features.

Decision trees provide an alternative and more convenient way of viewing and managing large sets of business rules, especially when these rules are not symmetric.

Decision trees make it easy to understand large sets of nonsymmetric rules since the path from the first condition to the end of the actions along any branch corresponds to one rule.

Columns and rows

The columns of a decision table define the conditions and actions that apply to the rules contained in the table. Condition columns are unshaded and appear on the left, while action columns appear shaded and on the right. Conditions or actions can be split across more than one column of the table when the rule statement they represent contains more than one value. You can merge or split the cells under subcolumns and change the operator.

Each row of a decision table corresponds to one rule.

Partitions

Groups of cells that are in the same condition column and have a common cell immediately to the left are referred to as partitions. In a table representation, the columns for conditions and actions are represented by IlrDTPartitionDefinition and IlrDTActionDefinition, respectively. The condition cells and action cells are represented by IlrDTPartitionItem and IlrDTAction, respectively.

Partition items are grouped under partitions, which are linked to a condition definition. All partition items under a partition must have an expression based on the template expression of the corresponding partition definition.

In a path, the order of the successive partitions must respect the order of the partition definitions.

Actions

Actions are grouped under an action set. Each action is linked to an action definition. Actions must have an expression based on the template of their corresponding action definition.

The order of the actions in an action set must respect the order of the action definition only if the model is dedicated to a decision table.

Code example

The following code example shows how to build the decision table structure and load data.

  public IlrDTController buildDecisionTable(IlrDecisionTable dt, IlrDTDataProvider provider) throws IlrObjectNotFoundException, IlrInvalidElementException, IlrKnownUUIDException, IlrObjectLockedException, IlrFolderLockedException, IlrPermissionException {
    // use the locale of display in Rule Team Server
    IlrDTController controller = IlrSessionHelper.getDTController(session, dt, Locale.ENGLISH);
    IlrDTModel dtModel = controller.getDTModel();
    lrDTExpressionManager expressionManager = dtModel.getExpressionManager();
    dtModel.clear();
    // Example of how to add a precondition to the decision table. Not used in the sample.
    // IlrDTHelper.setPreconditionsText(dtModel, "definitions set 'the spouse' to the spouse of 'the borrower' ; if the age of 'the spouse' is ... ");
    IlrDTPartition rootPartition = dtModel.getRoot();
    
    // Add a condition
    IlrDTExpressionDefinition ageExpressionDefinition = expressionManager.newExpressionDefinition("the age of 'the borrower' is between <a number> and <a number>", null);
    IlrDTPartitionDefinition agePartitionDefinition = dtModel.newPartitionDefinition(ageExpressionDefinition) ;
    IlrDTPropertyHelper.setDefinitionTitle(agePartitionDefinition, "Borrower age");
    
    dtModel.addPartitionDefinition(0, agePartitionDefinition);
    
    // Add another condition
    IlrDTExpressionDefinition zipExpressionDefinition = expressionManager.newExpressionDefinition("the zip code of the address of 'the borrower' is <an object>", null);
    IlrDTPartitionDefinition zipConditionDefinition = dtModel.newPartitionDefinition(zipExpressionDefinition);
    IlrDTPropertyHelper.setDefinitionTitle(zipConditionDefinition, "Zip Code");
    dtModel.addPartitionDefinition(dtModel.getPartitionDefinitionCount(), zipConditionDefinition);
    
    // Add an action
    IlrDTExpressionDefinition setInsuranceExpressionDefinition = expressionManager.newExpressionDefinition("set insurance required in 'the loan report' to <a boolean>");
    IlrDTActionDefinition setInsuranceActionDefinition = dtModel.newActionDefinition(setInsuranceExpressionDefinition);
    IlrDTPropertyHelper.setDefinitionTitle(setInsuranceActionDefinition, "Set Insurance");
    dtModel.addActionDefinition(dtModel.getActionDefinitionCount(), setInsuranceActionDefinition);
    // Add another action
    IlrDTExpressionDefinition addMessageExpressionDefinition = expressionManager.newExpressionDefinition("in 'the loan report' , add the message <a string>");
    IlrDTActionDefinition addMessageActionDefinition = dtModel.newActionDefinition(addMessageExpressionDefinition);
    IlrDTPropertyHelper.setDefinitionTitle(addMessageActionDefinition, "Add Message");
    dtModel.addActionDefinition(dtModel.getActionDefinitionCount(), addMessageActionDefinition);
    // Load its data
    controller.populate(provider);
    return controller;
  }
Rule Designer API

© Copyright IBM Corp. 1987, 2017