Release Notes 5.1

August 2008

 

OpenRules Release 5.1 is a minor release that adds advanced features to rule templates.

Advanced Rule Templates

The release 5.1 essentially expands the functionality of the rule templates introduced in the release 5.0.

Keywords. The new keyword "template" now specifies the use of the templates:

Rules <table-name> template <template-name>

See the example "summerGreeting" below. The old key word "extends" along with "extend", "implement", and "implements" will also work.

Default rules in templates.  The release 5.1 adds an ability to define some rules directly in a template that will be executed when all other rules inside template implementations fail. For example, consider this template for multi-hit rule tables:

Rules void defineGreeting(int hour, Response response)
C1 C2 A1
min <= hour hour <= max response.map.put("greeting", greeting); 
int min int max String greeting
Hour From Hour To Set Greeting
    Invalid Greeting

The following implementation of this template

Rules summerGreeting template defineGreeting
Hour From Hour To Set Greeting
0 10 Good Morning
12 18 Good Afternoon
19 22 Good Evening
23 24 Good Night

by mistake misses the hour 11.  So, if these rules are launched between 10 and 12 the default rule from the template will not be overridden by any rule from the implementation and the "Invalid Greeting" will be produced.

Let's consider a template for single-hit rule tables like such as this one:

Rules String defineSalutation(Customer customer, Response response)
C1 C2 C3 A1
customer.gender.equals(gender) customer.maritalStatus.equals(status) customer.age < min response.map.put("salutation",salutation);
return salutation;
String gender String status int min String salutation
Gender Marital Status Age is Less than Set Salutation
      InvalidSalutation

The default rules from the template will be executed only when all rules from an implementation table failed. 

The defaults rules allows a rule repository designer to define unified rules for exceptional conditions only once in the templates instead of repeating them many times in multiple template implementations.

Warning.  The previous release 5.0 ignored the rules defined in the templates. When you move to the 5.1 make sure that your old templates do not contain undesirable rules.

Partial Template Implementation. With the release 5.1 you may create large rule templates but use not all but only selected conditions and actions in the rule tables created based on these templates.  To do that, it is enough to add the second row that specifies the names of the selected conditions and actions like in the example below:

Rules defineSalutationBasic template defineSalutation
C1 C2 A1
Gender Marital Status Set Salutation
Male   Mr.
Female Married Mrs.
Female Single Ms.

Here the column C3 from the template "defineSalutation" above is ignored.

Optional Conditions and Actions.  If the majority of the template implementations do not use a certain condition/action from the template, then this condition/action may be explicitly marked as "optional" by putting the condition name in the brackets, e.g. "[C3]" or "[Action2]".  In this case it is not necessary to use the second row to specify the selected conditions in the majority of the rule tables. Only template implementations that actually need optional columns will use the second row to explicitly specify the optional columns.

The standard sample project "HelloJavaTemplates" has been extended to demonstrate the use of new features - see files HelloTemplates.xls and HelloRules.xls.  Click here to read the updated documentation.

New table type "Variable"

OpenRules 5.1 introduces a new type of tables "Variable".   These tables are similar to the Data tables but instead of arrays of variables they allow you to create separate instances of objects directly in Excel files. Here is a simple example:

Variable Customer mary
name age gender maritalStatus
Name Age Gender Marital Status
Mary Brown 5 Female Single

The variable "mary" has type Customer and can be used inside rules or passed back from an OpenRulesEngine to a Java program as a regular Java object. As usual, the object type Customer can be defined as a Java class, an Excel Datatype, or an xml structure. 

OpenRulesEngine API

You may attach any Java object to the OpenRulesEngine using methods setAttachment(Object attachment) and getAttachment().  You may receive a string with the current version number of the OpenRulesEngine using the method getVersion().

OpenRules team wants to thank Jose C. Lasal from www.OpenPHI.com for his help in improving our documentation.

 

 

 

 

Welcome
Welcome
Business Rules Repository Decisions Top-Down Semantics In Concert Business Analyst Decisioning
Welcome
themed object
Business Rules - Time to Excel
Bookmark and Share