Tuesday, March 21, 2017

DMN 1.1 XML: from modeling to automation with Drools 7.0

I am a freelance consultant, but I am acting today as a PhD student. The global context of my thesis is Enterprise Architecture (EA), which requires to model the Enterprise. As one aspect of EA is business process modeling, I am using BPMN from years, but this notation is not very appropriate to represent decision criteria: a cascade of nested gateways becomes quickly difficult to understand then to modify. So, when OMG published the first version 1.0 Beta of DMN specification in 2014, I found that DMN was a very interesting notation to model decision-making. I succeeded in developing my own DMN modeling tool, based on DMN metamodel, in using the Sirius plugin for Eclipse . But even the next “final” version 1.0 of DMN specification was not very accomplished.

The latest version 1.1 of DMN, published in June 2016, is quite good. In the meantime, software editors (at least twenty) have launched good modeling tools, as Signavio Decision Manager (free for Academics) used for this article. This Signavio tool was already able to generate specific DRL files for running DMN models on the BRMS Drools current version 6. In addition to the graphics, some editors added recently the capability to export DMN models (diagram & decision tables) into “DMN 1.1 XML” files, which are compliant with the DMN specification. And the good news is that BRMS like Drools (future version 7, available in Beta version) are able to run theses DMN XML files for automating decision-making (a few lines of Java code are required to invoke theses high level DMN models).

This new approach of treating “DMN 1.1 XML” interchange model directly is better for tool independency and model portability. Here is a short comparison between the former classic but specific solution and this new and generic solution, using the tool Signavio Decision Manager (latest version 10.13.0). MDA (Model Driven Architecture) and its three models CIM, PIM & PSM gives us the appropriate reading grid for this comparison:

3 MDA models
Description
Classic specific DMN solution
from Signavio Decision Manager
to BRMS Drools
CIM (Computation
Independent Model)
Representation model for business,
independent of computer considerations
DRD (Decision Requirements Diagram)
+ Decision Tables
PIM (Platform
Independent Model)
Design model for computing,
independent of the execution platform
û
PSM (Platform
Specific Model)
Design model for computing,
specific to the execution platform
DRL (Drools Rule Language)
+ DMN Formulae Java8-1.0-SNAPSHOT.jar

The visible aspect of DMN is its emblematic Decision Requirements Diagram (DRD) which can be completed with some Decision Tables for representing the business logic for decision-making. A DRD and its Decision Tables compose a CIM model, independent of any computer considerations.

Then, in the classic but specific DMN solution, Signavio Decision Manager is able, from a business DMN model (DRD diagram and Decision Tables), to export a DRL file directly for a Drools rules engine. So, this solution skips the intermediate PIM level, that is not very compliant with MDA concept. Note that this DRL file needs a specific Signavio’s jar library with DMN formulae.

3 MDA models
Description
New generic DMN solution
from Signavio Decision Manager(or other tools)
to BRMS Drools (or other BRMS)
CIM (Computation
Independent Model)
Representation model for business,
independent of computer considerations
DRD (Decision Requirements Diagram)
+ Decision Tables
PIM (Platform
Independent Model)
Design model for computing,
independent of the execution platform
DMN 1.1 XML (interchange model)
containing FEEL Expressions
PSM (Platform
Specific Model)
Design model for computing,
specific to the execution platform
û

The invisible aspect of DMN is its DMN XML interchange model, very useful for exchanging a model between modeling tools. DMN XLM is also very useful for going from model to automation. DMN XML model takes into account computer considerations, but as it is defined into DMN specification, a standard published by OMG (Object Management Group), it is independent of any execution platform, so it is a PIM model. DMN XML complies to DMN metamodel and can be checked with an XSD schema provided by OMG. The latest version 1.1 of DMN has refined this DMN XML format.

As DMN is a declarative language, a DMN XML file contains essentially declarations. The business logic included can be expressed with FEEL (Friendly Enough Expression Language) expressions. All entities required for a DMN model (input data, decision tables, rules, output decisions, etc.) are exported into the DMN XML file, due to a mechanism called serialization. It is why automation is now possible from DMN XML directly. Not all DMN modeling tools allow to export (or import) to DMN XML format.

With the new generic DMN solution, Signavio Decision Manager is now able, from the same business DMN model (DRD diagram and decision tables), to export “DMN 1.1 XML” interchange model. As the future 7.0.0 version of Drools is able to interpret “DMN 1.1 XML” format directly, the last level PSM, specific to the execution platform, is not useful anymore.

The new generic DMN solution, without skipping PIM level, sounds definitely better than the specific one and is a good basis for automating decision-making. Another advantage is, as Signavio said, that this new approach using “DMN 1.1 XML” reduces the vendor lock-in.

Thierry BIARD

Share/Bookmark