Concepts chapter about Rule Studio in the JRules 7 Information Center


It seems I’ve completely messed up my ZB300 testing environment as it doesn’t show up when I press the Start Exercise button in the course slides.

The circle indicator next to Status keeps looping all the time and nothing happens. I remember experiencing it before a couple of times, but after a while (perhaps it was 10 minutes) the lab popped up. This time it’s different and makes the labs unavailable for me. I’ll have to find out how to report it to the support team.

So, while the labs were not available, I went on reading the Concepts chapter in the JRules 7 InfoCenter, which explains the terms used in the product.

What I like about the JRules 7 InfoCenter is that learning JRules 7 theory is as easy as following the chapters with the Previous and Next buttons. Each and every page in the InfoCenter has them yet I didn’t notice it in the other ones. That makes the difference and smoothes the learning experience greatly.

I’ve got lots of notes about Rule Studio and the JRules 7 in general from the chapter, but there’re so many that it’s almost impossible not to duplicate what’s in the chapter.

Let me sum up what I read to keep it simple and concise without much duplication. I do strongly recommend reading the chapter as it brings lots of terms and JRules idioms that forms the product naming system. If I were you, I wouldn’t bother reading the blog entry, but go straight to the Concepts chapter and read it in its entirety. I doubt if anyone would find it less interesting. You’ve been warned.

Rule Studio is the rule editing environment for rule developers.
The rule project contains the structure of the business rule application: rule artifacts, Business Object Model (BOM), reference to the Execution Object Model (XOM) and vocabulary. It’s a job of a business rule application developer to create a rule project with these elements. All rule project items can be managed in a source code control system.

You set up a rule project using a rule project template. This can comprise a standard, predefined, or custom rule project template.

The rule project is what you publish to Rule Team Server. If you want to manage and track your rules in Rule Team Server, you should select Rule Project from Team Server rather than Rule Project in the New Project wizard.

A rule project needs to reference an implementation to be used as execution object model (XOM). Therefore, you need to reference Java projects or JAR files, or dynamic binding data (XML Schema or JAX-WS Web Service) if you have a dynamic object model.

A rule project can also reference other rule projects. All items in the referenced rule project are then available to you for use in your current rule project. Rule Studio is usually more efficient when you work with several small or medium sized packages, as opposed to a few large packages.

The XOM is the model used to execute the rules, it is the base implementation of the Business Object Model (BOM). The XOM is built from compiled Java classes (Java Execution Object Model) or from an XML Schema (Dynamic Execution Object Model).
Through the XOM, the rule engine can access application objects and methods, which can be Java objects, XML data, or data from other sources. At runtime, rules that were written against the BOM are run against the XOM.

The BOM is the object model for business rules. You edit BOM members in the BOM editor.

The BOM enables you to make business rule editing user-friendly by providing tools to set up a natural-language vocabulary. With this vocabulary, policy managers can describe their business logic in a business rule language. A BOM contains the classes and methods that rule artifacts act on. As an object model, the BOM is very similar to a Java object model. It consists of classes grouped into packages. Each class has a set of attributes, methods, and possibly other nested classes.
A BOM-to-XOM mapping defines the correspondence between the BOM and the Execution Object Model (XOM) used at runtime.

When you verbalize Java classes and their methods, it results in a vocabulary.

By default, the BOM always includes classes that map to specific JDK classes, and basic date and time-related classes. This set of classes is called the System BOM.

A business object model is made of one or several BOM entries. A BOM entry defines a set of business elements in the business object model. BOM entries may be ordered so that if you have two business elements with the same name in two BOM entries, the one in the first BOM entry in the path overrides the other.

A domain places a restriction on type elements in the BOM. You can set a domain on classes, attribute types, method return types and arguments. There are static, dynamic, enumerated and complex domains.

The other domain types were introduced to support most domains coming from the XML binding.

In the Rule Studio BOM editor, when defining a bounded domain on an integer attribute, you can specify the * (asterisk) character as the lower or upper bound of the domain. Bounded domains are not enforced at business rule level.

There’s an excellent visual demonstration on how the RetePlus execution mode works in WebSphere ILOG JRules V7.0.2 > Rule Studio > Creating rule projects > Concepts > Business Object Model (BOM) > Object state update

The Business Object Model (BOM) must reference an Execution Object Model (XOM) to execute the rules at runtime.

Every BOM element (business element) must have a corresponding XOM element (execution element). The correspondence between execution elements and business elements does not need to be one-to-one. If a business element originates from an execution element, then you do not need to explicitly specify a mapping. If a business element does not originate from an execution element, you need to specify a BOM to XOM mapping.
A BOM class is implicitly mapped to a XOM class of the same name.

You can map BOM elements to XOM elements by using the default mechanism, IRL functions, or Java extender classes.

The BOM to XOM mapping mechanism provides a default mapping and supports two kinds of explicit mapping:

  • IRL mapping – With IRL mapping, you associate an IRL function based on the XOM to a business element. With IRL mapping you can call functions, ruleset parameters and variables, and rule instances from the IRL code.
  • Extender mapping – With extender mapping, in a Java extender class, you create static elements that have exactly the same name as business class members.

You can only use extender mapping on a Java XOM. If you have a dynamic XOM, use IRL mapping.

At runtime, the rule engine uses the following order to find the right mapping: Explicit mapping in IRL, Explicit mapping with extender class, Implicit mapping done by default when nothing is specified.

Extender mapping is useful if you prefer to use Java rather than IRL.
You define an extender class name for a class in the Extender name field of the BOM to XOM Mapping section of the BOM Editor, then the BOM to XOM mapping mechanism looks up for extender elements with the same name as your business elements in the extender class. Therefore, when you create the extender class, make sure you create elements that can be found from the business element name.

You use the vocabulary to create business artifacts. The vocabulary comprises terms and phrases attached to the elements of the BOM.

When you create a BOM entry, you can choose to verbalize the business elements to create a vocabulary. A default verbalization is then applied to all attributes, getters, setters, and static references in the BOM entry. You can create a code-like verbalization of all other methods by selecting the option All Methods in the New BOM Entry or Verbalize BOM wizards.
Only business rule artifacts use the vocabulary. If you do not verbalize a business element, that element will not be visible from business rule artifacts.

A vocabulary is composed of a set of business terms, phrases, and constants. Whether a vocabulary element is a business term, a phrase, or a constant depends on the nature of its corresponding business element. Vocabulary elements appear in the drop-down lists of business rule editors.

A navigation phrase is a phrase that associates two business elements and corresponds to a method that has a non void return type or the getter part of an attribute.

You can also use predicate phrases in rules. A predicate phrase is a specific type of navigation phrase that verbalizes a non void method that returns a boolean or java.lang.Boolean. A predicate phrase has an implicit subject.

An action phrase applies an action to an object. It can be the verbalization of a method that has a void return type or the setter part of an attribute.

A constant is the verbalization of the public static final attribute of a class with the same type as this class.

A phrase template is a pattern for the verbalization of phrases. The pattern changes for navigation, predicate or action phrases. It is a combination of placeholders (a word between curly braces {}) and text.

There are three types of placeholders: subject placeholders, which are filled in automatically, appear in navigation phrases and correspond to the return type of a member, {this} placeholders that need to be filled in manually when editing rules and represent the declaring class of a member, and argument placeholders that represent the arguments of a method, which need to be filled in manually when editing rules and are represented by the index of the argument (starting from 0).

A function is an artifact written in IRL. It’s designed to share procedure code between the elements of a ruleset. A function is composed of a header and a statement part. A function is expressed in ILOG Rule Language (IRL) and its code is evaluated when the ruleset executes.
A function can be called either from the action part of a rule, from another function, or from a function task of a ruleflow.
Functions can be used to set up the working memory when testing ruleset execution.

Enough good stuff about JRules and time for some refresher. The following chapter Tasks “describes the tasks required to create and define a rule project”. Guess I need it after such a terribly boring lecture. I wish I could rather work with the labs from the ZB300 course.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s