Decision Logic (Boxed Expressions)

Decision Logic refers to the value expression of a Decision or BKM that transforms the input values of a decision (i.e., its information requirements) or a parameter values of a BKM into its output value. It is modeled using the combination of a boxed expression and the expression language FEEL.

Boxed Expression Types

DMN defines several standard table formats called boxed expressions, each with particular properties and execution behavior. These include:

Literal expression

A boxed literal expression is a single FEEL textual expression in a box, above which is a tab containing the name and datatype of the decision or BKM. In a decision, variables in the expression may reference only information requirements and knowledge requirements. In a BKM, variables in the expression may reference only parameters and incoming knowledge requirements.

literalexp 3 800x260

Decision table

A decision table is a boxed expression in which the output value is selected by decision rules. An example is shown below. The decision or BKM name is the heading of the column to the right of the double line. Columns to the left of the double line are inputs to the decision logic, called input expressions. In a Decision, an input expression can only reference an information requirement. In a BKM, the input expressions actually define the BKM parameters and their order.

Below the name of the decision table inputs and output is their datatype, which may include allowed values. Below that are rows defining the decision rules. In each column of a decision rule, the combination the input expression and the expression in the input cell, called an input entry, defines a Boolean expression. For example, Rule 1 column 1 below defines the expression Risk Category = “High”, true or false. A hyphen in an input entry means the input expression is not considered in this rule. Each Boolean expression in a rule defines a rule condition, and if all conditions in a rule evaluate to true the rule is said to match and the expression in the output cell of the rule is, called the output entry, selected as the decision table output value.

The Hit policy code in the upper left corner of the decision table determines output value selection when multiple rules match.

decisiontable1 1

Invocation

A boxed invocation invokes a BKM or decision service linked to the invoking element by a knowledge requirement. In the boxed expression, the name of the invoking Decision or BKM is shown in a tab at the top, below which is the name of the invoked BKM or decision service. Below that is a two-column table. The first column lists the names of the parameters of the invoked element, and the second column is a boxed expression – typically a literal expression but possibly any expression type – for the value of that parameter. The invocation passes these parameter values to BKM or decision service and receives in return its output value.

boxed invocation

Context

A boxed context displays the Decision or BKM name in a tab at the top. If the element is a BKM, below the name is a comma-separated list of parameters enclosed in parentheses. If a Decision, this row is omitted. Below that is a two-column table of context entries, each defining a context entry name and its value expression (any boxed expression type). Below that is a row with one column, called the final result box. If the final result box contains an expression, the context entries are not included in the output, but serve as local variables, simplifying the logic. If final result box does not contain an expression, each context entry is output as a component of the result, which is a data structure.

boxed context

Relation

A Relation boxed expression defines a data table, which in FEEL is a collection of a structured variable type. The column headings define the components of that structured type, and each row of the Relation defines a record in that collection. The cells in a Relation are literal expressions, but in most cases they are static values.

boxed relation

List

A boxed List is simply a list of expressions comprising the values of a collection variable.

Function definition

A Function definition is a user-defined function modeled as a context entry. It is similar to a BKM, except that it may be invoked only by subsequent context entries or the final result box of the same context.

functiondef

Iterator

A boxed iterator is an alternative graphical representation of a for..in..return literal expression, separating the for, in, and return clauses into separate rows of the table.

boxed iterator

Conditional

A boxed conditional expression is an alternative graphical representation of if..then..else literal expression, separating the if, then, and else clauses into separate rows of the table.

boxed conditional

Filter

A boxed filter expression is an alternative graphical representation of a literal filter expression of the form <list>[<Boolean expression of list items>]. In the boxed expression, the first row is an expression defining the list; the second row is square brackets enclosing the Boolean expression.

boxed filter