Tutorial - Advanced Rule Modeling in Corticon Studio
- Last Updated: March 24, 2022
- 4 minute read
- Corticon
- Version 6.3
- Tutorials
Tutorial - Advanced Rule Modeling in Corticon Studio
In the Basic Rule Modeling Tutorial you learned how to capture rules from business specifications, model the rules, analyze them for logical errors, and test the execution of your rules in Corticon Studio, all without programming.
The Advanced Rule Modeling Tutorial builds on what you learned in the Basic Tutorial. In the Advanced Tutorial, you will learn how to use some of Corticon Studio’s more complex and powerful functions, including:
- Building a Vocabulary with associations—Associations enable you to define relationships between entities. For example, many items can be associated with one shopping cart.
- Using Scope and Aliases in rules—Scope and Aliases enable you to define rules that apply to an entity in relation to another entity. For example, if the total price of items in a customer’s shopping cart exceeds $100, give the customer a coupon.
- Creating action-only rules—Rules in column 0 of a Rulesheet. They are non-conditional rules: the rules always fire so the action always applies. For example, calculate the total price of items in a shopping cart.
- Using equations in rules
- Using Collections and Collection operators—Collections enable you to define rules that apply to a group of entity instances. For example, check to see if any items in a Shopping Cart are from the Liquor department.
- Using Filters in rules—Filters enable you to filter out data, so only entities that pass the filter criteria are evaluated by rules in a Rulesheet.
- Using a variety of attribute and entity operators in rules
- Sequencing Rulesheets in a Ruleflow
- Embedding attributes within rule statements—This feature enables you to retrieve the value of an attribute instead of hard-coding it in a rule message. For example, “${ShoppingCart.cashBackEarned} bonus earned today”.
- Testing at the Ruleflow level
Just like the Basic Tutorial, you will follow the rule development lifecycle. You will discover, model, and test rules. Since the focus of this tutorial is to teach you how to build complex rule models, we will skip the Analyze phase to save time.
This tutorial is designed for hands-on use. We recommend that you follow along in Corticon Studio, using the instructions and illustrations that are provided. If you haven’t installed Corticon Studio yet, install it now. Click here for instructions on installing Corticon Studio.
The business problem
Like the flight planning example in the Basic Rule Modeling Tutorial, the Advanced Tutorial uses a business case which you will use to build a rule model in Corticon Studio. The business case is as follows:
The owner of a chain of grocery stores wants to build and install a system of business rule-based “smart” cash registers in all its branches. Some branches are large supermarkets, and some are smaller “convenience” stores, which sell gasoline and other essentials.
In addition to the minimum cash register functionality (adding up the price of items in a customer’s shopping cart, for example), the new system should also be able to apply:
- Promotional rules
- Loyalty program rules
- Coupon generation rules
- Special warning rules that alert the cashier to take certain actions
Because every item in every store has a bar-coded label, the system’s scanner should be able to determine complete information about each item, such as which department an item comes from.
To foster customer loyalty and drive additional sales, a “Preferred Shopper” program will be launched in conjunction with the installation of the new business rule-based cash registers. Shoppers who enroll in the program will be issued Preferred Shopper membership cards (one card per household) to present to the cashier at check-out time. Benefits of the Preferred Shopper program include:
- A Preferred Shopper earns 2% cash back on all purchases at any
branch.
- The Preferred Shopper account will track the accumulated cash back and allow the shopper to apply it to the total amount at any visit. The cashier will ask a Preferred Shopper if they would like to apply their cash back balance to their current purchase.
- Once a Preferred Shopper chooses to apply their cash back balance, the cumulative cash back total maintained by the system will be reset to zero, and the accumulation of cash back will begin anew with the customer’s next purchase.
- A Preferred Shopper will be eligible for special promotions and
coupons as defined below:
- Preferred Shoppers receive a coupon for one free balloon for every item purchased from the Floral department. This coupon has no expiration date.
- Preferred Shoppers receive a coupon for $2 off on their next purchase when 3 or more Soda/Juice items are purchased in a single visit. This coupon has an expiration date of one year from the date of issue.
- Preferred Shoppers receive a coupon for 10% off their next gasoline purchase at any chain-owned convenience store with any purchase of $75 or more. The expiration date for this coupon is 3 months from the date of issue.
Additionally, in compliance with local, state, and federal laws, the chain needs to ensure that all purchases of liquor (any items from the Liquor department) are made by shoppers 21 or older. The new system should display an alert or warning on the cashier’s screen, prompting them to check the customer’s ID.