DMN Expression Validation
DMN defines many expressions, such as FunctionDefinition, DecisionTable, Boxed Context, Invocation and Literal Expression. The parameters, arguments and logic of expressions are implemented largely by 'text'.
To make modeling easy and reliable, Enterprise Architect provides two features: Auto Completion and Validation.
- Auto Completion: You can select a text string from a list of enumerations rather than type the text in
- Validation: This identifies modeling errors caused by typos, logic incompleteness, inconsistency, and so on
In this topic, we will show you how to validate a DMN Expression.
DMN Expression Window
Simulate > Decision Analysis > DMN > DMN Expression :
DMN Simulation Window
Simulate > Decision Analysis > DMN > Open DMN Simulation > Simulate : Validate icon
Variable Name Validation
In this example, BusinessKnowledgeModel BKM1 defines two parameters, 'Input 1' and 'Input 2', and two local variables, 'Local Variable 1' and 'Local Variable 2'.
- Context Entry #1 failed because there is a typo: it should be operator '-', but the user typed in '–' instead
- Context Entry #2 failed because there is no space between 'Input' and the number 2; note that the function ceiling is defined in DMN Library so it can be successfully parsed
- Context Entry #3 failed because there is no space between 'Local' and 'Variable'
It is hard to identify these kinds of errors by eyesight, running validation can help identify errors and then you can perform an easy fix.
A decision might require other decisions, input data and business knowledge models; these relationships are identified by informationRequirement and KnowldegeRequirement connectors.
When the graph is getting complex, it is quite possible that some connectors are missing or the wrong connector type is being used.
In this example, click on the, Enterprise Architect will show that:
- 'Decision3' is used by 'Decision1' by binding to a parameter of the called BKM2; however, it is not defined - an InformationRequirement connector is missing
- The Invocation defined in 'Decision1' is not valid; the connector type from 'BKM2' to 'Decision1' should be a KnowledgeRequirement
After fixing these problems, run the validation again: