ILOG JRules User Guide > Creating Rule Projects > Getting Started > Tutorial: Defining a Vocabulary > Step 1: Create a BOM Entry

In this tutorial, you follow a bottom-up approach to creating a vocabulary in Rule Studio. This means that you use existing application objects as the basis for your vocabulary. For this purpose, we have provided a Java project that models car rental concepts.

In this step you will:

Before you start, you need to import the Java project into your Eclipse workspace.

Note
If you have imported the answer projects for the tutorial, close or delete them before importing the start projects.

To import the Java project:

  1. Switch to the Java perspective.
  2. On the File menu, click Import.
  3. In the Import wizard, open the General folder, select Existing Projects into Workspace then click Next.
  4. In the following page of the Import wizard, click Browse and select carrental-xom from the shared directory:
  5. <InstallDir>/studio/tutorials/shared
  6. Click Finish.
  7. The carrental-xom project appears in the Package Explorer view.

You are going to use this Java project as the Execution Object Model (XOM), which is the basis of the Business Object Model (BOM) for rule editing.

To store and organize the BOM and rule artifacts, you need to create a rule project.

To create the rule project:

  1. On the File menu, click New > Project. In the New Project wizard, select Rule Project. Click Next.
  2. To select the template to use, click Standard Rule Project. Click Next.
  3. In the Project name field, type vocabulary-rules. Click Next.
  4. In the Rule Project References page, do not define any references; just click Next.
  5. In the Rule Project Java XOM Settings page, select the box for the Java project carrental-xom.
  6. Click Finish.
  7. The rule project vocabulary-rules now appears in the Rule Explorer view. You can see it contains a rules directory for rule artifacts, a bom directory for BOM entries, and directories for queries and business rule templates.
    Rule Explorer

During this tutorial, you will write the following rules:

Business Rule Loyalty.AwardLoyalty

if
   the duration of the rental agreement is more than 20
then
   make it true that the customer of the rental agreement 
                                  is loyalty program member;

Business Rule Eligibility.UnderAge

if 
   the age of the customer of the rental agreement is less than 18
then
   make it true that the rental agreement is rejected; 
   display the message "The rental agreement is rejected";

Business Rule BranchInfo

if 
  the state of the branch is one of { "Massachusetts" , "New Hampshire" }
then
  display the message "The branch is in Massachusetts or New Hampshire" ;

Now you need to create a BOM entry and verbalize the elements of the vocabulary that are required to edit these rules. Verbalizing is the process of associating terms and phrases to elements of the BOM.

To create the BOM entry:

  1. In the Rule Explorer view, right-click the rule project vocabulary-rules, and click New > BOM Entry.
  2. In the New BOM Entry wizard, leave the default name model in the Name field and select the Create a BOM entry from a XOM option. Click Next.
  3. In the BOM Entry page, click Browse XOM.
  4. In the Browse XOM dialog, select the Java project carrental-xom.Click OK.
  5. The carrental package appears in the Select classes field.
  6. In the Select classes field, open the carrental package and select the classes Customer and RentalAgreement.
  7. Make sure the option Load getters and setters as attributes is selected, then click Next.
  8. In the BOM Verbalization page, make sure the options Getters, Setters, and Static References are selected. Click Finish.
  9. The bom model appears in the Outline view and the BOM Editor. It contains errors, as you can see in the Problems view:
    images/bomentrywarnings.png

The classes you added to the BOM entry include references to other classes that are not in the BOM entry. Although not all the members of these classes need to be verbalized, they need to be included in the BOM entry. You will fix this problem in the next Step of the tutorial.

Before you go and fix the warnings, take a minute to look at the default verbalization of the classes in the BOM entry.

To look at the verbalization:

  1. In the BOM Editor, expand the carrental package and double-click the class Customer.
  2. On the Class page, in the Class Verbalization section, you can see the verbalization of this class as the business term customer.
  3. In the Members section of the Class page, double-click the attribute firstName.
  4. On the Member page, in the Member Verbalization section, you can view the verbalization of this attribute as the navigation phrase {first name} of {this}.
  5. On the Window menu, click Show View > Vocabulary.
  6. In the Vocabulary view, you can look at all your vocabulary elements.
    Vocabulary View

In the next Step of the tutorial, you will fix the warnings by updating the BOM entry to include the missing classes, and verbalize some new elements.

Next Next: Step 2: Verbalize New Business Elements