Task 5: Refining the vocabulary

You improve the verbalization of the subject of a phrase and a method with arguments.

About this task

If necessary, you can edit terms or phrases in the default verbalization to make them easier to understand. You edit a class verbalization of the BOM editor by using the Edit Term dialog. You edit member verbalization, or the navigation and action phrases, in the Template field by using text and Content Assist. To edit the subject that is used in a phrase, you use the Edit Term dialog.

In the rule UnderAge, you must make the following phrases clearer:

  • the customer age of the rental agreement
  • the session .displayMessage ( "...")

The phrase the customer age of the rental agreement might be confusing because it seems to associate age with rental agreement. To make it less ambiguous, you can edit the term customer age, which is the subject of the phrase.

Step 1: Editing the subject of a phrase

You edit the subject of the phrase the customer age of the rental agreement to make it less ambiguous.

Procedure

  1. In the Rule Explorer view, double-click the BOM entry model.
  2. In the Outline view, expand RentalAgreement, and then click the method getCustomerAge.
  3. In the Member Verbalization section, click Edit the subject used in phrases.
    The Edit Term dialog opens.
  4. In the Singular field, change the text to age of the customer, and then click OK.
    A warning message informs you that these changes might affect your rules.
  5. On the File menu, click Save.
    The Refactor Vocabulary dialog opens.
  6. Make sure that the rule UnderAge is selected, and then click Yes.
  7. Open the rule UnderAge.
    You updated the condition part of this rule with the new verbalization:
    if
    the age of the customer of the rental agreement is less than 18

Step 2: Editing the verbalization of a method

You edit the verbalization of the method Session.displayMessage to clarify the meaning.

Procedure

  1. Open the rule UnderAge in the Intellirule Editor.
  2. Press Ctrl, and then click the session .displayMessage ( "The rental agreement is rejected.");, which is shown as a link.
    The Member page of the BOM Editor opens.
  3. In the Member Verbalization section, delete the contents of the action phrase Template field.
  4. Enter the following action phrase:
    display the message {0} in {this}

    You can use the Content Assist box (Ctrl+Spacebar) to insert the placeholders {0} and {this} into the new action phrase. You must type the rest of the phrase.

    A warning message informs you that these changes might affect the business rules.

  5. On the File menu, click Save.
    The Refactor Vocabulary dialog opens.
  6. Make sure the rule UnderAge is selected, and then click Yes.
  7. Open the rule UnderAge. You can see that you updated the rule with the new verbalization:
    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" in the session;
    

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

What to do next

In the next task, you extend the BOM by creating an enumerated domain that is displayed as a list in business rules.