Now, let’s implement the Vocabulary in Corticon Studio. To begin, launch Corticon Studio and create a Rule Project:

  1. On the Start menu, select Progress > Corticon Studio. In the Workspace Launcher dialog box that opens, retain the default workspace and click OK. Corticon Studio opens.
  2. Select File > New > Rule Project.
  3. In the New Corticon Project window, enter MyAdvancedTutorial as the project name and click Finish.

Create the Vocabulary

Next, create a Vocabulary file:

  1. Right-click MyAdvancedTutorial and select New > Rule Vocabulary.media/image11.png
  2. In the Create a New Vocabulary window, enter groceryStore as the Vocabulary file name and click Finish.

The Vocabulary opens under the rule project MyAdvancedTutorial as shown:

Add Entities

Now, let’s add the entities (Customer, PreferredAccount, Item, ShoppingCart, Coupon):

  1. In the Vocabulary editor on the right, right-click groceryStore and select Add Entity.
    media/image14.png
  2. An entity with the default name Entity_1 is created. Type over this and enter Customer.

  3. Repeat these steps to add the remaining entities. The result will look like this:


Add Attributes

Next, let’s add the attributes. Start by adding attributes for the Customer entity based on this table:



  1. Right-click Customer and select Add Attribute, and then choose String.

  2. An attribute named attribute_1 is created under Customer. Type over this and enter name.

  3. Right-click Customer, select Add Attribute, and then choose Boolean
  4. Type over the default attribute name and enter isPreferredMember.

  5. Click the Mode drop-down and select Transient.

Now, add attributes for the rest of the entities based on this table:


media/image23.png

After adding all the attributes, the Vocabulary looks like this:


media/image24.png

Add Associations

Next, let’s create associations between the entities. Let’s start with the association between Customer and PreferredAccount. This is a many-to-one association.

  1. Right-click Customer and select Add Association.

    media/image25.png
  2. In the Association dialog box:
    1. Select Many in the Source section
    2. Select PreferredAccount as the Target Entity Name
    3. Select One in the Target section
    4. Click OK

media/image26.png

The association appears as shown here.


media/image27.png
Notice that the association shows up as many-to-one () under Customer and one-to-many () under PreferredAccount.
media/image28.png

Similarly add associations between Customer and ShoppingCart (one-to-many) and between Item and ShoppingCart (many-to-one). The final output will look like this.


media/image29.png

Each association has an association role name. For example, the association between Customer and PreferredAccount is given the name preferredAccount. Note that the opposite association between PreferredAccount and Customer is given the role name customer. A role name helps describe or clarify the relationship of an entity with another entity.

You can change the role name for an association to make it more meaningful. In our example, let’s change the role name for the association between Customer and PreferredAccount to preferredCard. To do this, double-click the association under Customer, type over the default value, and enter preferredCard.

media/image30.png