Open Your Business Rules!                     
Rules-based Operational Decision Services

Release Notes 6.3.1 (May-2014)

OpenRules® Release 6.3.1 adds the enhanced testing facilities with automatic comparison of expected and actual decision execution results, support for XLSX formats with latest Apache POI, and more new features requested by the OpenRules customers.

Decision Test Harness

This release introduces a new type of decision tables called "DecisionTableTest". Such tables may define your test cases that contains:

1) Test objects for different business concepts defined in the Glossary

2) The expected results for several decision variables.

Then you may test your decision by simply calling a new Decision's method "test":

          decision.test(name_of_decision_test_table)

For example, the standard project "DecisionPatientTherapy" already includes test Data objects "visits" and "patients". Now you may add the following DecisionTableTest called "testCases" with two test cases:

Here the first column specifies test IDs, next two columns specify test-objects defined in traditional Data tables, and the last two columns specify the expected results.

In your Java launcher you do not need anymore to read and put your test object into the decision and call decision.execute(). Instead you may simply call decision.test("testCases"). The Decision's method "test" will execute all tests from the Excel table "testCases" using business objects defined in the columns of the type "ActionUseObject". After the execution of each test-case, the actually produced results will be compared with the expected results, which are defined in the columns of the type "ActionExpect". All mismatches will be reported in the execution log. For instance, the above example will produce the following records:

                Validating results for the test <Test 1>
                Test 1 was successful
                Validating results for the test <Test 2>
                MISMATCH: variable <Patient Creatinine Clearance> has value <48.03> while <48.04> was expected
                Test 2 was unsuccessful
                1 test(s) out of 2 failed!

The table "DecisionTableTest" is based on the template "DecisionTableTestTemplate" that has been added to the standard file "DecisionTemplates.xls". You may add any number of business objects and decision variables with expected results to your test cases. An example of the test harness can be found in the project DecisionPatientTherapyTest added to the standard installation.

 

Support for the XLSX format

With this release OpenRules supports new XLXS file format (along with the regular xls format). It required to switch to the latest Apache POI package and modify OpenRules-POI interface. So, now you may use both xls- and xlsx-formats or even both of them in the same rule project. However, instead of one file         poi-3.9-20121203.jar, Apache POI 3.10 requires the following 5 jars to be present in your classpath:

  • poi-3.10-FINAL-20140208.jar
  • poi-ooxml-3.10-FINAL-20140208.jar
  • poi-ooxml-schemas-3.10-FINAL-20140208.jar
  • dom4j-1.6.1.jar
  • xmlbeans-2.3.0.jar

All these jars are now included in the standard project "openrules.config" in the folder "lib". So, you need to replace your entire "openrules.config" with a new one if you are moving to the release 6.3.1 from a previous OpenRules release.

 

Additional Macro for Business Objects

We added a new macro $O{ObjectName} that can be used inside expressions (Java snippets) to replace
 
       
((ObjectName)decision.getBusinessObject("ObjectName"))

where "ObjectName" is a name of a business concept used in the glossary. If you use this macro make sure that "ObjectName" is specified exactly as the proper Java class or Excel Datatype - no spaces allowed. Here is an example from the sample project "DecisionHello":

 

Using Custom Delimiters instead of Commas

When your decision table deals with collection of variable, by default you list elements of your collections separated by commas, like in this example:

However, if the elements contain commas you need to define a custom delimiter. Now you can do it by adding a delimiter to the name of the operator after at east one space or some text:

Instead of '#' you can use any character, and instead of "Add Separated By #" you may simply write "Add #". The same construction works with all other operators defined on collections including: Are, Is One Of, Include, Exclude.

Previously, the operator "Add" worked only with arrays of strings. Now you may also use "Add" with arrays of the types in[], double[], and Date[] like in this example:

 

For more details, see a new example "DecisionAddArrays" in the standard installation.

 

OpenRules Execution Reports Now Support the Unicode Format

The standard execution reports are being generated in the HTML format. This release makes the reports compliant with various international language including Japanese and Chinese languages by supporting the Unicode format. 

 

Changes in Rule Solver

We modified Rule Solver templates (the file "DecisionTableSolveTemplates.xls") in such a way that when you execute a decision using a constraint-based inference engine it always returns solution(s) as a decision's output. If you try to find one feasible or an optimal solution, then after calling Decision's method decision.execute() you may write

      Solution solution = (Solution) decision.getOutput();

If the "solution" is null, it means no solution is found. Otherwise, you may print a solution using solution.log() or analyze it using the JSR331 Solution API.

If you try to find many feasible solutions, then after decision.execute() you may write

      Solution[] solution = (Solution[]) decision.getOutput();

and to analyze the array of the produced solutions.

For scheduling problems, we added an ability to generate a number of different feasible solutions and also to find among these solutions the one that minimizes a certain objective. For example, look at a new sample project "DecisionScheduleActivitiesAlternativeResourcesOptimal". We associated certain costs with each resource, and allow the Rule Solver to generate up to 4000 solutions  by stating:

      decision.put("MaxSolutions","4000");

It will also generate an HTML report with all found solutions and associated costs. If you want to select among these 4000 solutions the one that minimizes the Total Cost of actually assigned resources, you may add this line:

      decision.put("Minimize","Total Cost");

Rule Solver will find and return an optimal solution showing it in the HTML report. The name of the generated report is now formed using the name of the proper decision. By default, this report is placed in the folder "report" of the main decision folder. If you want to change the report path say to "c:/temp/report" you may achieve it by stating:

      decision.put("report","On");
      decision.put("reportPath","c:/temp/report");

The generated report will be placed to the file "c:/temp/report/Report.ScheduleActivitiesWithAlternativeResources.html".

If you want to also use a custom report's name instead of the decision's name, say "MyReport", you may add one more line: 

      decision.put("reportName","MyReport");

Read more in the updated Rule Solver Guide.

 

New Sample Decision Projects

We added several new sample decision projects:

  • DecisionPatientTherapyTest - demonstrates how to add automatically validated test cases to the standard project DecisionPatientTherapy

  • DecisionUniqueness - demonstrates how to validate uniqueness of objects inside a collection; see this blog-post

  • DecisionMacros - demonstrates the use of macros inside expressions

  • DecisionAddArrays - demonstrates how to use the operator "Add" in the decision table conclusions for adding arrays of strings, integer and real numbers, and dates

The product documentation has been properly updated. After downloading the latest complete OpenRules® release 6.3.1 from here, you need to update your "openrules.config" project. Pay attention that new Apache POI 3.10 jars need to be added.

We appreciate help provided by our beta-testers and partners during the preparation of this release. Our special thanks go to our Japanese partner NTTData Intra-Mart.

If you have any comments or suggestions, please post them at the Google Discussion Group or send them to support@openrules.com

 

Top