Rule modeling is an iterative process. As your business needs change, you may need to make changes to your rules. See how easy it is in Corticon Studio by adding, analyzing, and testing a new rule in the Rulesheet.

Begin by adding a rule statement for the new rule.

Add a new rule statement

  1. Switch back to your Rulesheet by clicking the Cargo.ers tab. If you closed it earlier, reopen it by double-clicking the file inside the Rule Project Explorer pane.


  2. Enter the new Rule Statement—Cargo requiring refrigeration must be packaged in a reefer container. It acts as a guide while modeling the new rule.


  3. To model this rule, edit the Vocabulary by:
    1. Adding a new attribute to the Cargo entity to define whether the cargo requires refrigeration or not (let’s call this needsRefrigeration).
    2. Adding reefer as another possible selection option for the container attribute.

Open and edit the Vocabulary

  1. Open the Vocabulary tab, Cargo.ecore. If you closed it, open it again by selecting Cargo.ecore from the Recent File list at the bottom of the File menu or double-click the file in the Rule Project Explorer pane.

    The Vocabulary opens in the Vocabulary editor.

  2. Add a Boolean attribute named needsRefrigeration:
    1. In the Vocabulary editor, right-click Cargo and choose Add Attribute and then Boolean from the submenu:


    2. Define the attribute name by double-clicking the default attribute name value (Attribute_1) and changing it to needsRefrigeration.

  3. Add reefer as another allowable type of container:
    1. Select the container attribute and note the Data Type: containerType. This custom data type defines a set of allowable values for container (an enumerated set).


    2. To define custom data types, you must first click on the root node of the Vocabulary, denoted by the open book icon—in this case, Cargo.


    3. Click the containerType entry.

    4. Add reefer as both a Label and a Value.

  4. Save the Vocabulary by selecting File > Save and close the Vocabulary Editor pane.

Custom data types are a powerful capability, which help you define a Vocabulary that matches how you think about your business.

Model the new rule

Now that the Vocabulary contains the new terms required by the new rule, you can model the new rule—Cargo requiring refrigeration must be packaged in a reefer container. After completion, your Rulesheet should look like this:

Be sure to define the Reference link from the Rule Statement to column 4 and add Post and Alias as shown here.

Analyze the new rule

Whenever you add or change rules, re-analyze them.

  1. Start by checking for conflicts. You can either select Rulesheet > Logical Analysis > Check for Conflicts or click the Check for Conflicts button .

    As you can see, adding the new rule has caused three new conflicts, one with each of our three existing rules.

  2. Step through multiple conflicts, and filter the Rulesheet to view only the conflicting rules, using the buttons to the right of the Conflict Check button.

    Rules 1, 2, and 3 each define a specific container type for cargo based on weight and volume, while Rule 4 defines the container type based on whether the cargo needs refrigeration. The conflict occurs because a cargo load that requires refrigeration may also trigger Rules 1, 2, or 3.

  3. Assume that reefer containers are only available for standard and heavyweight loads, but not for oversize loads. So, set Rule 4 to override rules 1 and 3, and set Rule 2 to override Rules 1 and 4.
    Note: Remember, you can select multiple values in the override cell by pressing and holding the CTRL key.

    After you have made these changes, your Rulesheet looks like this:

  4. Check for completeness by selecting Rulesheet > Logical Analysis > Check for Completeness.

After the Rulesheet is complete, click OK in the dialog box and save the Rulesheet file.

Run the Ruletest again

The last step is to modify your test case to test the new rule.

  1. Open Cargo.ert.
  2. Copy and paste Cargo[1] to create Cargo[4], in both the Input and Expected panes.
  3. Drag and drop the needsRefrigeration attribute from your Vocabulary onto both Cargo[4] entities.
  4. In both panes, set the value of needsRefrigeration to true.
  5. In the Expected pane, change the value of container in Cargo[4] to reefer.
  6. Run the test. Your Ruletest should now look like this:

As you can see, the actual results match the expected results.

Congratulations! You have now completed two full iterations of the Corticon decision service development lifecycle and understood the basic concepts of rule modeling, analysis, and testing in Corticon Studio.

To learn more rule modeling techniques, take the Advanced Rule Modeling Tutorial .