Tutorial - Advanced Rule Modeling in Corticon Studio
- Last Updated: September 9, 2024
- 4 minute read
- Corticon
- Version 7.2
- Version 7.1
- Version 6.3
- Corticon.js
- Version 2.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 their execution in Corticon Studio, all without programming.
The Advanced Rule Modeling Tutorial builds on what you learned in the Basic Tutorial. In this tutorial, you 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, which extends to seeing how Rule Trace provides visibility into the execution, and then trying out Analytics to get the idea of how you can log, persist, and query all the accumulated trace results.
Just like the Basic Tutorial, you follow the rule development lifecycle: discover, model, and test rules.
This tutorial is designed for hands-on use. Progress recommends that you follow along in Corticon Studio, using the provided instructions and illustrations. If you haven’t installed Corticon Studio yet, install it now. See Run the Corticon Studio installer wizard for instructions.
The business problem
Like the flight planning example in the Basic Rule Modeling Tutorial, the Advanced Tutorial uses a business case 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), 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 can 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 launches in conjunction with the installation of the new business rule-based cash registers. Shoppers who enroll in the program are 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:
- 2% cash back on all purchases at any branch:
- The Preferred Shopper account tracks the accumulated cash back and allows the shopper to apply it to the total amount at any visit.
- The cashier asks a Preferred Shopper if they would like to apply their cash back balance to their current purchase.
- After which, the cumulative cash back total maintained by the system is reset to zero.
- The accumulation of cash back begins anew with the customer’s next purchase.
- Eligibility for special promotions and coupons:
- A coupon for one free balloon for every item purchased from the Floral department. This coupon has no expiration date.
- A coupon for $2 off on their next purchase when 3 or more soda or juice items are purchased in a single visit. This coupon has an expiration date of one year from the date of issue.
- A coupon for 10% off their next gasoline purchase at any chain-owned convenience store with any purchase of $75 or more. This coupon has an expiration date of three 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.