< Previous

Task 6: Creating a domain

You create an enumerated domain that allows policy managers to select a car rental branch.

About this task

You can make the vocabulary more specific by giving policy managers a way to select values in a domain. For this tutorial, you create an enumerated domain of literals in the BOM from which policy managers select car rental branches from a drop-down list.

Step 1: Creating an enumerated domain of branches

You create an enumerated domain of branches.

Procedure

  1. In the Rule Explorer view, double-click the BOM entry model.
  2. In the Outline view, click the attribute Branch.state.
  3. In the Domain section of the Member page, click Create a domain.
  4. In the Domains wizard, select Literals, and then click Next.
  5. Click Add. The list of literals displays a newValue field.
  6. Overtype newValue with New York, and then press Enter.
  7. Use the Add button to add these values:
    • Rhode Island
    • New Hampshire
    • Massachusetts
  8. Click Finish, and then save your work.

    The Domain section now lists the values in the domain.

    Enumerated domain of literals

Step 2: Writing an action rule to define a member

You write an action rule that uses the domain defined for the state member.

Procedure

  1. In the rules folder, create an action rule named BranchInfo.
  2. In the Content section of the Intellirule editor, type if, and then press Enter.
  3. Type the following phrase:
    the state of the branch is one of { "Massachusetts"}
  4. Place the cursor immediately after "Massachusetts", and then type a comma followed by the Spacebar. The Content Assist box shows the list of constants defined in the enumerated domain.
  5. From the Content Assist box, select "New Hampshire".
  6. Finish writing the rule to produce the following:
    if 
       the state of the branch is one of { "Massachusetts" , "New Hampshire" }
    then
        display the message "The branch is in the state of Massachussets or New Hampshire" in the session; 
  7. Save your work. You now have a rule project with a vocabulary set up for efficient rule editing.

    For more information on using the rule editors, see Working with action rules.

Results

You have completed the tutorial. It showed you how to define a vocabulary for making rules.

< Previous