Open Your Business Rules!                     
Rules-based Operational Decision Services

Release Notes 6.4.0 (July-2016)

Steadily Improving DMN Support

OpenRules® Release 6.4.0 essentially improves DMN  support covering the major functionality of DMN FEEL and DMN Interchange Format. OpenRules® was among the first vendors who announced its DMN support and published DMN Primer implementation in 2013 just two weeks after the first DMN announcement. We steadily improve our DMN support and below is the list of new features:

Implementing FEEL Expressions

OpenRules own expression language functionally it is very close the DMN FEEL (Friendly Enough Expression Language). For example, the following single-hit decision table

already uses FEEL-compliant numerical intervals, to which the variable "Current Hour" may belong.

Actually, OpenRules can handle any Java snippets including external Java methods and functions. However, our expressions in Excel-based decision table cells usually start with a special formula  indicator ":=" in conditions or with "::=" in actions. To refer to decision variables inside formulas we ask our customers to use macros such as $R{real-variable-name} or $I{integer-variable-name} like in our Decision1040EZ example:

With the new release 6.4.0, you may write the same formula in a much simpler way as specified by DMN FEEL language:

As you can see, you do not have to use the "::=" and macros when you use FEEL.

The current implementation allows a user to use both traditional OpenRules expressions and DMN FEEL expressions.

Using Names with Spaces

FEEL allows a user to freely use names with spaces inside its expression. Of course, users may use "underscores" instead of spaces between words like Patient_Creatinine_Level or PatientCreatinineLevel. However, we did not want to diminish FEEL "friendliness" and allowed our user to use variable names with spaces inside FEEL expressions. So, the release 6.4.0 allows you to write expressions similar the one from our Patient Therapy example:

If a user prefers to explicitly specify that a combination of words separated by spaces is a variable name, she may surround such names with apostrophes like in the example below:

Note that variable name may include apostrophes like 'Patient's Creatinine Level' above and OpenRules is capable to handle such names inside FEEL formulas without any additional indicators. However, if the name contains special characters like valid operators - or *, a user need to surround the variable name with apostrophes to avoid a possible confusion.

Instead of apostrophes a user may define other symbols, e.g. $, & or #, by calling the following code just before executing the proper decision:

decision.put("LONG_NAME_INDICATOR", "$");

Note. In Excel the very first apostrophe in the cell is used as an indicator that the next character doesn't start an Excel's own formula. So, if your FEEL's formula starts with 'long variable name', you need to double the first apostrophe: ''long variable name'.

 

Turning FEEL Processing On/Off

Processing of FEEL expressions is done during the decision execution and may be less efficient to compare with the standard OpenRules expressions. To avoid any overhead for the existing customers who do not want to use FEEL, by default FEEL processing if OFF. To turn it on, before executing your decision you need to write:

decision.put("FEEL", "On");

 

Allowed FEEL Operators and Predefined Functions

The current implementation allows you to use the standard arithmetic and logical operators and functions for integer and real numbers, e.g.:

Feature Syntax Examples
Numbers regular integer or real numbers  10, 465.25, -25, 3.14
Add x + y  3+2 
Subtract x - y 3 - 2
Multiply x * y 3 * 2
Divide x / y 3/2
Power: x y x**y or x^y 5**2
Negate -x -3
Comparison x < y
x <= y
x = y
x <> y or x != y
x >= y
x > y

2 <> 3 [produces 1]
2 <> 2 [produces 0]
Logical "and" x and y 1 and 1 [produces 1]
1 and 0 [produces 0]
0 and 0 [produces 0]
Logical "or" x or y 1 and 1 [produces 1]
1 and 0 [produces 1]
0 and 0 [produces 0]
Absolute value abs(x) abs(-5) [produces 5]
abs(5)  [produces 5]
Maximum between two numbers max(x,y) max(5,6) [produces 6]
Minimum between two numbers min(x,y) min(5,6) [produces 5]
Floor floor(x) floor(3.5) [produces 3]
floor(-3.5) [produces -3]
Ceiling ceil(x) or ceiling(x) ceil(3.5) [produces 4]
ceil(-3.5) [produces -3]
Additional functions
The mathematical constant "π" pi  
e x exp(x) exp(1) = 2.7182818284590451
Rounding round(x) round(3.5) [produces 4]
round(-3.5) [produces -4]
Conditional if(x,y,z) if(1,50, 100) [produces 50]
if(0,50,100) [produces 100]
Square root sqrt(x) sqrt(9) [produces 3]
Trigonometric functions sin(x), cos(x), tan(x), asin(x), acos(x), atan(x) sin(pi/2) [produces 1]

The current FEEL implementation works only with numerical decision variables. It utilizes an open source package "expr" initially developed by Darius Bacon but essentially modified and now supported by OpenRules.

Dealing with String Variables

This release allows you to use names of String variables inside decision table cells. If the content of the cell is a valid name of the string variable, it will be replaced by its value. We do not yet support string concatenation operation - in this case you need to use regular OpenRules string expressions (Java snippets) which start with ":=" for conditions or "::=" for conclusions, e.g. ::= ${Greeting} + " " + %{Salutation} + ", " + $O{Customer}.name

Dealing with Date Variables

OpenRules naturally supports date comparison like in the following example:

However, to define a number of years, months, or days between dates, you still need to use regular OpenRules expressions (Java snippets). For convenience, we added a new Java class "Dates" to "com.openrules.tools". It includes static methods to calculate a number of years, months, and days between two dates, e.g. you may write the following code inside a condition cell of your decision table:

:= Dates.years( $D{Date1}, $D{Date2} ) >= 2

It checks that a number of years passed between the variables "Date1" and "Date2" is at least 2 years. Or you may calculate the age of the person from its birthday as follows:

You may similarly use methods Dates.months(Date d1, Date2 d2), Dates.monthsToday(Date date), Dates.days(Date d1, Date d2), Dates.daysToday(Date d). Don't forget to add to your Environment table an "import.java" statement that points to "com.openrules.tools.Dates".

 

Using '-' as a Not Applicable Symbol Inside Decision Tables

OpenRules historically leave decision table cells empty when the proper conditions and/or actions are not applicable. However, DMN requires to use the symbol '-' in these cases. This release allows you to use both empty cells or '-'  interchangeably.

DMN Sample Projects

The release 6.4.0 comes with a new workspace "openrules.dmn" that includes many sample projects with test cases implemented in accordance with DMN requirements. In particular, it includes "DecisionLoanOrigination" that implements an example from the DMN Chapter 11 specification. You may read its detailed description that explains how OpenRules implements various DMN constructs and compares different implementation styles. See the list of included decision models. This workspace is added to the evaluation and complete installations of OpenRules and we are constantly improving and extending DMN sample projects.

Importing Decision Tables from DMN XML Files

OpenRules 6.4.0 provides an initial implementation of the DMN 1.1 Interchange format. It allows a user to read any DMN xml-file, extract from it all decision tables, and generate the proper decision tables in the OpenRules DMN format placed in a single xls-file.

This initial implementation is described at this post "DMN Interchange". It is written in such a way that allows anyone to reuse the provided DmnXmlReader and to add its own generator of decision tables in a format required by any other BR&DM product. The implementation with all sources is available as a sample project "org.dmn.xml" in the workspace "openrules.dmn". This implementation will be improved in the future releases.

 

Bug Fixed

There were some errors in the operators "Is One Of" and "Is Not One Of" for integer, long and double variables, which are now fixed.

We removed the file "servlet-api.jar" and all dependencies from openrules.config/lib/. This suppresses the warning about "offending javax/servlet/Servlet.class" when you start Tomcat - the new Tomcat versions already include the proper jars.

 

Download the latest complete OpenRules® release 6.4.0 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