Exporting DMN diagrams as drools rules

SAP Signavio Process Manager enables you to model decision logic with the easy-to-use editor and to subsequently export DMN diagrams as DRL files to transfer them into the open source business rules management solution Drools (http://www.drools.org/). Thus, you can easily transfer DMN diagrams into automated business logic.

You can either export multiple diagrams, one diagram, or just one decision table and its sub-decisions. The Drools export supports four different export types: Production, Development, Test, and Cases. In contrast to Production, Development adds additional comments and logging behavior.

You can select which diagram revision to export.

Permissions for the Drools export can be limited to users of specific user groups.

To export decision logic to Drools, open the Explorer. Select one or multiple diagrams and go to Import/Export, then Export Drools:

Select one or multiple diagrams and go to 'Import/Export', then 'Export Drools'.
Select one or multiple diagrams and go to 'Import/Export', then 'Export Drools'.

Now you can adjust your selection and set the following export properties:

  • Export revision

    You can choose whether to export the latest revision of the diagram that has been saved in the Editor or the latest revision that was published in SAP Signavio Process Collaboration Hub.

  • Export mode

    • The option Production mode exports the decision logic to drools. It does not include comprehensive comments, support for detailed logging, and test cases.
    • Development mode provides additional comments and logging behavior.
    • Development mode + test cases provides additional test cases in the form of .csv files (one .csv file for each top level decision). The .csv files contain all combinations of all relevant sub-decisions.
    In the export dialog, you can configure the export options in detail.
    In the export dialog, you can configure the export options in detail.

Click Export to trigger the export process.

Alternatively, you can export a decision table and its sub-decisions directly from the Editor.

In the Editor, open a decision table and click Import/Export in the top-right corner of the dialog. There you can chose between generating the Drools export or the test cases (as described above):

Click 'Import/Export' in the decision table dialog.
Click 'Import/Export' in the decision table dialog.

Before starting the export, you can choose whether to include related sub-decisions (if applicable):

Choose if you want to include related sub-decisions.
Choose if you want to include related sub-decisions.

As soon as the files are generated, you can download them in you browser:

Customize the export

If dictionary entries are used as data input objects and data definitions, you can add information to export.

For that, an administrator must enable the use for data modeling for the respective dictionary category. Then, the configuration dialog for dictionary entries has two fields more to specify the information:

  • Technical name

  • Class name

If both names are set in one dictionary entry, only the class name is exported.

Both names are only used when exporting a DMN diagram as Drools rules. In SAP Signavio Process Manager and SAP Signavio Process Collaboration Hub, the standard dictionary name is always used.

Read how to enable the fields in section Set up a dictionary category for DMN modeling.

Add export names to data input objects

For dictionary entries that are used as data input objects, you can add export names. This way, you can provide domain-specific vocabulary when executing the exported DRL file.

  • To add an export name, specify a technical name for the dictionary entry.

Add java source references to data definitions

For dictionary entries that are used as data definitions, you can reference existing java sources. This way, you can integrate exported DMN Drools rules into existing execution environments.

  • To add a reference, specify a class name for the dictionary entry, for example com.signavio.dmn.example.DataDefinition. The exported DRL file then contains an import statement, for example import com.signavio.dmn.example.DataDefinition.