Open Your Business Rules!                     
Rules-based Operational Decision Services

Release Notes 6.2.6 (dec-2013)

< OpenRules® Release 6.2.6 advances OpenRules BDMS with the following features:

Generating Excel Workbooks with OpenRules Decision Tables

This release of OpenRules® allows you to generate xls-files with multiple decision tables programmatically, by providing the proper Java API. The Java class DecisionBook that corresponds to one Excel workbook (or an xls-file) allows you to add OpenRules® decision tables defined in Java. Multiple decision tables can be added to a preliminary created instance of the DecisionBook class. Each new decision table will be placed in a new worksheet of the same workbook. Then you may simply save this decision book as an Excel file.

Let’s first consider a new example provided in the standard OpenRules® installation as the “DecisionWithGeneratedRules” project.  In this project we want to run a Java application (GenerateRules.java) to generate the following decision tables in Excel:

Here is the proper Java class GenerateRules.java:

import com.openrules.table.external.DecisionBook;

public class GenerateRules {

 public static void main(String[] args) {

   DecisionBook decisionBook = new DecisionBook();

   decisionBook.addDecisionTable(

      "DefineGreeting",                                        //table 

      "DecisionTableTemplate",                                 //template

      new String[] { "If", "If", "Then" },                     // labels

      new String[] { "Current Hour","Current Hour","Result" }, //variables

      new String[][] {                                         //rules

          new String[] {">=0","<=11","Good Morning"},

          new String[] {">=12","<=17","Good Afternoon"},

          new String[] {">=18","<=21","Good Evening"},

          new String[] {">=22","<=24","Good Night"}

      }

   );

   decisionBook.addDecisionTable( 

      "CheckGreeting",                                     //table name

      "DecisionTableTemplate",                             //template name

      new String[] { "ConditionVarOperValue", "Message" }, // labels

      new String[] { "<Var> <Oper> <Value>", "Message" },  //titles

      new String[][] {                                     //rules

          new String[] {"Result","Is Not","Good Afternoon",

                        "Error: Expected Good Afternoon"},

          new String[] {"Result","Is","Good Afternoon", "Good Result"}

      }

   );          

   decisionBook.saveToFile("./rules/include/Rules.xls");

  }

}

The first statement  

            DecisionBook decisionBook = new DecisionBook();

simply creates an instance of the class DecisionBook. Then we add two decision tables to this decision book by using decisionBook.addDecisionTable(…).

The decision table “DefineGreeting” is created based on the standard OpenRules template "DecisionTableTemplate" defined as the second parameter of the above Java structure. This parameter may use one of the following template names:

·  DecisionTableTemplate  – for regular single-hit decision tables

· DecisionTable1Template  – for multi-hit decision tables

· DecisionTable2Template – for rule sequences (see more).

Then the strings { "If", "If", "Then" } define the selected table columns from this template.  The next array of strings { "Current Hour", "Current Hour", "Result" } defines the names of decision variables used in these columns.  Then we have a two-dimensional array of strings where each sub-array represents one rule (or the table row) such as

    new String[] {">=0","<=11","Good Morning"}.

Depending on the column type, instead of the names of the decision variables the column titles may contain any text in plain English. For example, the first column in the second decision table ��CheckGreeting” is defined as "ConditionVarOperValue, that according to the standard template has 3 sub-columns. The title of this column is defined as “<Var> <Oper> <Value>”. Note that this title is “merged” while the content of the proper 3 sub-columns is defined using 3 strings such as "Result","Is Not","Good Afternoon" in the unmerged format.

Finally, this decision book is saved to the file “./rules/include/Rules.xls” using the method decisionBook.saveToFile("./rules/include/Rules.xls");

You may read more about Excel generation API in the User Manual - see pp. 101-104.

This API may be effectively used by the automatic rules discovery mechanisms such as Rule Learner.

 

Invocation of Sub-Decisions and Decision Tables by Name (not as a function)

This release essentially simplifies the invocation of OpenRules® sub-decisions and decision tables from decisions. The modified DecisionTemplate allows you to use the names of the invoked sub-decisions or decision tables directly without using formulas like in the picture below:

Previously the column "ActionExecute" required you to write

          := ValidateTaxReturn(decision)

but now you may simply invoke the sub-decision by its name

          ValidateTaxReturn

without ":=" and the parameter "(decision)".

Please note that if your tables of the type "Decision" use the old format, you will probably receive syntax errors which may look like below:

  

Then you will need to modify your xls-file to replace

        := ValidatePolicy(decision)

with

         ValidatePolicy

Previously you used to call/execute a decision table as a function like

        := DecisionTableCalculate()

Now you may simply call it by name

        DecisionTableCalculate

The old format for a decision table invocation will continue to work as well.

This change not only simplifies the invocation of sub-decisions and decision tables from other decisions, but also makes OpenRules more compliant with the newly introduced DMN standard. 

All examples from the standard OpenRules® installation that invoked sub-decisions have been modified to address this change.

We've also added a similar optional column "ActionExecute" to the regular decision table execution templates. It means you may add this column to your regular DecisionTable and invoke another DecisionTable (or any Method without parameters) simply by name.

 

Initial DMN Implementation

On Sep 26, 2013 OMG made the "beta" version of the Decision Model and Notation (DMN) Specification 1.0 publicly available. OpenRules® already uses the concepts of decisions and decision tables that are very close to the ones specified by the DMN. However, we added several more features to bring OpenRules® closer to the DMN. Along with an ability to invoke sub-decisions and decision tables by name, OpenRules® now allows a user to explicitly define a decision output as required by the DMN.  A new Decision API includes two new methods:

      public void setOutput(Object output); 

      public Object getOutput(); 

The first method may be used inside the main Excel table of the type "Decision" as the very last sub-decision. The second method may be used from Java to get the decision's output.

This release OpenRules® includes the first implementation of the DMN 1.0 Primer based on the Loan Origination example described in the Section 10 of the Specification. We provide a detailed description of this implementation here. You may analyze it for free without any downloads from here. You also may download the DMN 1.0 Primer project from here and do your own experiments by changing Excel-based decisions, executing the decision model, and analyzing the results.

 

With the release 6.2.6 OpenRules® became more compliant with the DMN 1.0 while we still have some differences with an initial Specification - we expect that the DMN development team will be take into consideration our suggestions for improvement during the beta period of the standard.

 

The product documentation has been properly updated. After downloading the latest complete OpenRules® release 6.2.6 from here, you need to update your "openrules.config" project.

Please post your comments and suggestions to the Google Discussion Group or send them to support@openrules.com

 

Top