DMN Expression Validation
DMN defines many expressions, such as FunctionDefinition, DecisionTable, Boxed Context, Invocation and Literal Expression. The parameters, arguments and logic of these expressions are implemented largely by 'text'.
To make modeling easier and more reliable, Enterprise Architect provides two features: Auto Completion and Validation.
- Validation: Identifies modeling errors caused by typos, logic incompleteness, inconsistency, and so on
- Auto Completion: You can select a text string from a list of enumerations rather than type the text in
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, the Boxed Context Business Knowledge Model BKM1 defines two parameters, 'Input 1' and 'Input 2', and two local variables, 'Local Variable 1' and 'Local Variable 2'. The expression has been validated, and the results output to the 'DMN Validation' tab of the System Output window.
- Context Entry #1 failed because there is a typographic error; it should be operator '-', but the user typed or copied in '–'
- Context Entry #2 failed because there is no space between 'Input' and the number 2; note that the function 'ceiling()' is defined in the 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 visually identify these kinds of error. Running validation can help identify errors and then you can easily perform a correction.
A decision might require other decisions, input data and business knowledge models; these relationships are identified by InformationRequirement and KnowledgeRequirement 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: