Open Your Business Rules!                     
Rules-based Operational Decision Services

Release Notes 6.4.3 (Oct-2017)

OpenRules Release 6.4.3 adds new Decision Management capabilities listed below:

It also fixes a few bugs and provided more sample-projects.

 

Decision Import and Loosely Coupled Decision Models

In practice “big” decision models can be decomposes into smaller, loosely coupled decision models, which can be implemented and executed independently. Then a “big” decision model can simply “import” these “small” decision model using a newly introduced OpenRules table of the type “DecisionImport”. Here is an example of such a table:

The first column refers to the full path of the main file for every decision model we want to import into the big decision model. The second column contains to the names of the imported decision models, under which they are known to the “big” decision. The detailed description of decomposition of big decision models into small loosely coupled decision models and their consecutive integration (import) can be found here. The proper working example has been added to the workspace "openrules.dmn" under the name "DecisionLoanOrigination".

 

New Execution Reports with Explanations

We replaced execution reports previously produced in multiple html-files (one file per decision table) with one report-file for Decision's run that along with all actually executed rules shows all involved decision variables and their values at the moment when the rule was executed. Here is an example of  new execution report for the sample-project "DecisionVacationDays":

 

Besides producing the detailed explanations why the  rules were executed, new reports also use much less memory and work faster.

ActionExecute inside Decisions and Decision Tables

We have added a new action type "ActionExecute" to the standard OpenRules decision table templates. It is similar to the ActionExecute used in the tables of the type "Decision". Here is a simple example:

The cells inside the column ActionExecute contain the names of decision tables you want to be invoked (executed) from the current decision table.

Using Lists Within DecisionTableIterate and DecisionTableSort

Along with arrays of different objects, now you also can use lists of object within DecisionTableIterate and DecisionTableSort. You may see how it's done in the new sample project DecisionSortPassengersList, in which instead of Passenger[] array we use List<Passengers>.

Adding Values and Objects to Arrays and Lists

We’ve added an ability to use lists of objects with the operator “Add”. In previous versions our customers were able to add values only to arrays of the types int[], double[], String[], and Date[] like in the following table:

This versions extends the applicability of the operator "Add":

1)  Instead of arrays of constants such as {36,73,120} you may add  an array (or a value) located in the decision variable "MyTerms" (or "MyTerm") by writing $MyTerms (or $MyTerm) in the proper cell, e.g .

If you adding only one value (not an array), you may even omit '$', e.g. instead of "$MyTerm" you may simply write "MyTerm".

2) We also added support for the arrays of the types long[] and BigDecimal[].

3) We added support for Lists of objects. Let's say your class Department includes an attribute "employees" of the type List<Employee> that refers to all employees working in this department. Let's say you want to use rules to define lists of all women and all men among these employees. In your Java class Department these lists can be defined as:

     List<Employee> women;

     List<Employee> men;

We may navigate through all Employees using the following table:

To fill out the lists Women and Men we may use this simple decision table:

Our glossary contains variables "Women" and "Men" associated with the concept "Department" with attributes women and men.

Now let's assume we want to define an array of rich employees (whose salary is larger than a certain amount). We may add List<Employees> richEmployees to the class Department.java and associate a variable "Rich Employees" with the concept "Department" in out glossary. Then we may simply expand our rules "EvaluateAllEmployees" as below:

4) Instead of lists we may use arrays of objects (while for big arrays performance may suffer to compare with lists).

For example, in the class Department.java we may replace

   List<Employees> richEmployees;

with

   Object[] richEmployees;

Our decision tables will continue to work (probably slightly slower). Please note that in this case you have to use "Object[]" instead of "Employee[]" - this is our (unfortunate) implementation restriction.

You can see all implementation details in the new sample-project "DecisionAggregatedValuesWithLists".

New Operators for Numeric Arrays

We added several new operators that simplify manipulations with numeric arrays such as int[], double[], long[], and BigDecimal[]. You can use the following operators:

Min, Max, Average, Count, Sum, Product, One Element, All Elements

Here is an example:

Note that this table uses a new condition type "ConditionRealArray". The name of the analyzed array goes to the column title. The first sub-column contains one of the above operators, and the second sub-column contains any valid FEEL expressions for these type of numbers. For arrays of integers and big decimals, you may similarly use conditions of the new types "ConditionIntArray", "ConditionLongArray", and "ConditionBigDecimalArray".

The first 6 operators also can be used in the standard columns of the type "Conclusion" along with array names to calculate their Min, Max, Average, Count, Sum or Product. For example, this table

calculates Average Amount for the integer array "Amounts" and "Minimal Term" for the real array "Terms". You may try these new operators by running a new sample-project "DecisionNumericArrays" added to the workspace "openrules.dmn".

Operators Include, Exclude, Exclude All, Intersect Extended

These operators were used for arrays of String variables. This release extends their use to different types of arrays including int[], double[], long[], BigDecimal[], Date[], Object[]. You can find examples of these operators in the sample-project "DecisionNumericArrays".

Additional Methods for Date/Time Manipulations

The standard library "com.openrule.tools" now includes new static methods in the class "Dates" which produce new dates:

   addHours(date, hours)

   addDays(date,days)

   addMonths(date,months)

   addYears(date,years)

   setYear(date,year)

   setMonth(date,month)

   setDay(date,day)

   today()

   newDate(year,month,day)

   newDate("yyyy-mm-dd")

You also may get integer values of year, month, and day by calling Dates methods getYear(date), getMonth(date), and getDay(date).

These methods can be used for dates arithmetic using Java snippets similar to this example:

 Previously to compare two date variables you needed to use macros as below:

Now if FEEL is On, you may simply write the name of the Date variable without preceding '$':

You may see more examples of how to use of new Date operators by analyzing an updated sample-project "DecisionHelloWithDates" in the workspace "openrules.dmn".

By default, OpenRules compares dates ignoring time. If you actually want to use time components of the Date variables, instead of the operators such as "<" you should to use the operator "< time", as in the table below:

 This table is a part of the decision model "DecisionFlightRebooking" included in the workspace "openrules.dmn".

Support for String Concatenation

We added support for FEEL expressions that concatenate string variables. For example, in the sample-project "DecisionHello" to assigns a complete customer's greeting to the decision variable "Result" previously you needed to write the following snippet:

Now you may use simply write:

Empting String Variables 

Now you may use "" (double quotes) in the action cells to assign an empty string to a String variable.

 

Old Deprecated Methods Moved to a new file "DecisionTemplatesDeprecated.xls"

All deprecated methods which were previously defined in the template-files DecisionTemplates.xls and DecisionTableExecuteTemplates.xls have been moved to a separate file called DecisionTemplatesDeprecated.xls, that is also located in the folder "openrules.config". The standard Environment table  in the file DecisionTemplates.xls refers to this file as below:

If you don't use these deprecated methods, we recommend you to delete the second include-statement. If you still use some of the methods described in this file please replace them with new methods as thee will removed in the next major release 7.0.0. Contact us at support@openrules.com if you need our assistance.

Fixed Bugs

We fixed a bug in the comparison of variables of the type BigDecimal when a comparing value is defined by a variable name- see example in the openrules.decisions/DecisionBigDecimal.

 

New or Updated Decision Projects

We added several new sample projects or advanced the existing projects to demonstrate new features. Check out the following projects in the standard workspace "openrules.dmn":

  • DecisionLoanOrigination - demonstrates how to import loosely coupled decision models
  • DecisionVacationDays - demonstrates new execution reports
  • DecisionSortPassengersList - demonstrates the use of List<Passengers> instead of Passenger[]
  • DecisionAddArrays - demonstrates how to add multiple values to arrays of objects
  • DecisionAggregatedValuesWithLists - demonstrates how to add objects to a list of objects
  • DecisionNumericArrays - demonstrates the use of newly introduced operators for numeric arrays
  • DecisionHelloWithDates - demonstrates Date manipulation methods
  • DecisionHelloResult - demonstrates the use of the string concatenation in decision tables.

Download the latest complete OpenRules release 6.4.3 from here.

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

 

Top