Creating and editing DMN diagrams

This chapter explains DMN modeling with the Signavio Process Manager. You can find more general instructions on how to edit diagrams in the chapter Basic modeling with the Editor.

Creating and editing DMN diagrams

To create a DMN diagram, open the Explorer and select New - Business Decision Diagram (DMN 1.0):

Create a new DMN diagram.

Create a new DMN diagram.

Your browser will open the editor with a blank DMN canvas in a new tab:

A new DMN diagram in the Editor.

A new DMN diagram in the Editor.

Once you have created or opened a DMN diagram, you can simply drag and drop an element from the shape repository on the left onto the canvas:

Drag and drop elements onto the canvas.

Drag and drop elements onto the canvas.

You can also use the interactive context menu of an already existing element to create new DMN elements:

Make use of the interactive context menu.

Make use of the interactive context menu.

To save the diagram, click the Save button in the upper left corner of the Editor.

Save the diagram.

Save the diagram.

Creating Decision Tables

To create a decision logic table, proceed as follows:

  • Select decision element from the shape repository and drop it on the canvas as described above. Label the element:
Label the decision element.

Label the decision element.

  • A decision can typically be described by a question - answer scheme. By default, there are attributes on decision element level for documenting this scheme for each decision:
Define decision question and answers.

Define decision question and answers.

  • To open the Decision Table, click the table icon in the upper left corner of the element:
Open the decision logic dialog.

Open the decision logic dialog.

  • The decision logic table dialog opens. In the tab Decision Table you can define the decision logic through creating inputs and mapping them to outputs.

    First, click New Input to give the input a label:

Label the input.

Label the input.

  • Now, define the type of the input by clicking Text and selecting the type of your choice, e.g. Enumeration of Values:
Choose the type of input.

Choose the type of input.

  • In case you chose ‘enumeration’, you need to define possible values:
Define possible values.

Define possible values.

  • Outputs are created in the same way.
  • If you chose Enumeration of values as your input/output, you can sort the values by clicking the move up and move down buttons at the right of the value. Additionally, you can have the values sorted automatically in alphanumerical order by clicking the Sort values button:
Sort the values automatically.

Sort the values automatically.

  • Once you have defined a new input, the input is added as an input data element to the canvas:
A new 'input data' element has been created and linked to the 'decision' element.

A new ‘input data’ element has been created and linked to the ‘decision’ element.

  • More inputs and outputs can be created by clicking Add Input, respectively Add Output:
Add another output.

Add another output.

  • Now, create a rule by clicking Add rule:
Add a rule.

Add a rule.

  • Now, define the relation between input and output:
Define the relation between input and output.

Define the relation between input and output.

  • Select input values:

    ../../_images/selectinput_en.png
  • Do the same for the output values you want to map the inputs to.

  • In the column ‘Annotations’, you can add documentation to the new rule:

Add additional information.

Add additional information.

Defining a literal expression as decision logic

As an alternative to the logic defined in the decision table for more experienced users, you can define a literal expression. Literal expressions represent pre-defined logical algorithms or rules that can be used to automatically create output results for decisions, often but not necessarily in a formal expression language. They are most commonly used in cases where the output of a decision is a the result of complex calculations or logical algorithms, or when the logic of the decision does not have much variation in their outputs with regards to its inputs.

Literal expressions are written in ‘FEEL’, the ‘friendly enough expression language’ specified as part of the DMN standard, which you can download along with examples for literal expression use cases at http://www.omg.org/spec/DMN/1.0/PDF.

Read more about literal expressions in the chapter Using literal expressions instead of decision tables.

Define a literal expression.

Define a literal expression.

Important

If a literal expression is defined, it supersedes the decision logic in the decision table.

Referencing a decision of another DMN diagram

To reference a decision of another DMN diagram, switch to the Link tab:

Click 'Link'.

Click ‘Link’.

Now, identify the target diagram and select a decision element:

Reference a decision of another DMN diagram.

Reference a decision of another DMN diagram

Warning

In an older version of the Decision Manager you could reference a diagram without specifying a decision. Such a reference is semantically incomplete and cannot be interpreted by the Simulation and Test Lab.

Referencing decisions in business knowledge models

When a business knowledge model links to a decision, referencing decision elements can reuse its logic. Such a reference is called a boxed invocation.

Boxed invocations provide decision logic and input type information as a generic function, whereas decisions that are referenced in DMN elements simply link to a decision and apply not only the input data types, but the specific input data objects.

In the following example, an insurance premium is calculated based on the applicant’s and their spouse’s risk level. For both persons, the same decision logic determines separate risk levels. A reference via a business knowledge model allows calling the linked decision model with different data inputs. In contrast, a direct link to a decision diagram would fail to distinguish between the two data sources.

Reuse decision logic via business knowledge models.

Reuse decision logic via business knowledge models.

You can reference decisions in business knowledge models in the same way you link them in decision elements. To apply a business knowledge model’s decision logic, proceed as follows:

  1. Open the referencing decision.
  2. Switch to the Invocation tab.
  3. Set up a mapping between the referencing and the invoked decision’s input data:
Apply a business knowledge model in a decision element.

Apply a business knowledge model in a decision element.

Creating sub decisions

In many situations, a decision depends on one or multiple sub decisions. In such a case, you can daisy-chain decision elements or transform Data Input elements into Decisions as depicted below:

../../_images/transformtodecision_en.png

In case you transform a data input, a new data input is automatically created and attached to the sub decision:

../../_images/addinputcanvas_en.png

In our example, when opening the Decision Table, its output is already defined. All you need to do is create possible additional inputs and map them to output values.

Creating complex input data elements

In many cases, it is impractical to model each Data Input parameter as a separate element.

Instead, you can create complex data input elements.

For example, the Data Input element Order can contain the attributes Purchase value and Customer status.

To configure a data input element as complex, set the value of the attribute Type definition to Complex type:

Configure a Data Input element as "Complex type".

Configure a data input element as “Complex type”.

Now, click the empty field next to Attributes:

Open the attribute configuration dialog.

Open the attribute configuration dialog.

In the attribute dialog, you can add attributes and define their properties. For each attribute, you need to define the name and the type. Depending on the type, you can define further properties. Click Save to confirm the changes:

Define attribute properties.

Define attribute properties.

After configuring the complex input data element, the attributes are available in the Decision Table editor, for example as Order.Purchase value:

Reference an attribute of a complex data input element in a decision table.

Reference an attribute of a complex data input element in a decision table.

Verifying decision tables

The Signavio Process Manager offers an automatic verification feature for decision tables to automatically check the completeness and consistency of rules.

To execute the automatic verification check, click the Verify button in the upper right corner of the decision table dialog:

Verify the decision table.

Verify the decision table.

In our example, one combination of input values is not covered by a decision rule:

The verification function found an error: For one input combination, no rule exists.

The verification function found an error: For one input combination, no rule exists.

Configuring hit policies and completeness

With the help of hit policies you define how your decision table manages inputs that are handled by several rules and inputs for which no rules are defined.

There are single hit policies and multiple hit policies. Single hit policies produce one result per input, while multiple hit policies produce an array of outputs, which is then aggregated according to an aggregation scheme.

The completeness settings define whether your table is producing outputs for every possible input.

For further details, please consult the DMN specification document: http://www.omg.org/spec/DMN/1.0/PDF/

You can define the hit policies and the aggregation and completeness settings by clicking the UC label in the upper left corner of the table (UC stands for unique hit policy and a complete table):

Click 'UC' - 'UC' stands for a unique hit policy and a complete table.

Click ‘UC’ - ‘UC’ stands for a unique hit policy and a complete table.

Now you can configure the hit policy, aggregation and completeness settings. In the example below, multiple outputs are returned as an unsorted list and their maximum value is picked as the final result:

Define hit policy, aggregation and completeness settings.

Define hit policy, aggregation and completeness settings.

Linking BPMN diagrams to DMN diagrams

You can easily link DMN diagrams to tasks in BPMN diagrams:

Once you have created the Task in the BPMN diagram, change the Ttsk type to Business Rule:

Change the task type to 'Business Rule'.

Change the task type to ‘Business Rule’.

Now, select the attribute Decision reference:

Select the 'Decision reference' attribute.

Select the ‘Decision reference’ attribute.

Alternatively, you can click the arrow in the upper left corner of the Task:

Click the table icon.

Click the table icon.

In the dialog that opens, you can either create a new DMN diagram or link an already existing one:

Link a DMN diagram to a BPMN Task.

Link a DMN diagram to a BPMN Task.

Copying elements and element groups

For faster modeling, it can be helpful to copy elements or interconnected element groups. If you copy an interconnected group of DMN elements in the Editor contained decision tables and attributes are copied as well.

In our example, we determine a customer discount and subsequently calculate the purchase price of products with an additional discount and normally priced products separately to be able to have the values displayed separately on the bill:

These elements are almost identical and can be copied during the modeling process to save time. As both 'Product value' input elements have the same input range, only the label has to be altered here.

These elements are almost identical and can be copied during the modeling process to save time. As both ‘Product value’ input elements have the same input range, only the label has to be altered here.

To copy elements, select them, then click the Copy and Paste buttons in the Editor’s toolbar:

Click the 'Copy' button in the toolbar.

Click the ‘Copy’ button in the toolbar.

Next, click the 'paste' button. The copied elements will appear and can be rearranged.

Next, click the ‘paste’ button. The copied elements will appear and can be rearranged.

Now, rearrange the elements as needed and alter decisions and names, then connect them to other elements if necessary.

You can also copy elements from one diagram to another. For this, we recommend you to open the corresponding diagrams in different browser tabs. This procedure is especially helpful when you split one complex model into multiple, better understandable parts.

Importing decision rules

You might have parts of your decision rules already defined in a spreadsheet. Then, you can import these decision rules into your DMN decision table, for example as a list of comma-separated values.

For this, open the decision table editor and click Import/Export - Text Import in the top-right corner:

Click 'Import/Export' - 'Import text'.

Click ‘Import/Export’ - ‘Import text’.

Now, you can insert a set of decision rules, for example by copy and paste.

In the example below, we import a set of rules to determine a customer discount:

Import the decision rules.

Import the decision rules.

The rules need to comply with the following structure:

  • Depending on the delimiter you choose, the entry fields of a decision table rows (rule) need to separated by a tab, semicolon or comma. Relational operators like = and <= must be part of the field they relate to.

  • For each rule, you need to start a new line.

  • The import only supports the following literal expressions:

    • not(value)
    • not(value1, ..., valueN)
    • !=value

    For example, not(Premium, Gold, Platinum) can exclude all customers with corresponding bonus cards.

An import doesn’t overwrite existing rules. After you have imported the rules, they are appended to the decision table:

The rules are appended to the decision table.

The rules are appended to the decision table.