VS Code has a plugin called KIE DMN Editor which allows one to build DMN models.
The model allows for the setting of constraints on Data Types. In the modal, one can select a constraint type of "Expression".
The modal provides a link to the DMN Spec at https://omg.org/spec/DMN .
I have tried numerous different expressions and none of them work.
I am trying to match the value coming in a JSON. Ultimately, a UTC date in a string. When that failed, I tried matching a single digit in a string, but that failed as well.
The expressions I tried had this form:
How am I to set up this expression with a RegEx style pattern?
Any help appreciated.
The attached xml is simple DMN model, that is like ID function, it returns the obtained input as a result. From the screenshot you can notice, null is returned if the input does not meet data type constraint: matches(?, "\d")
<?xml version="1.0" encoding="UTF-8" ?>
<definitions xmlns="https://www.omg.org/spec/DMN/20230324/MODEL/" expressionLanguage="https://www.omg.org/spec/DMN/20230324/FEEL/" namespace="https://kie.org/dmn/_BEC108E2-92AB-4536-8DB3-352E6A13A6BA" id="_F2FA7703-6CEE-4151-8C9A-E60930142263" name="DMN_70A28027-0959-4657-8B7B-E6C713B9F5A0" xmlns:dmndi="https://www.omg.org/spec/DMN/20230324/DMNDI/" xmlns:dc="http://www.omg.org/spec/DMN/20180521/DC/" xmlns:di="http://www.omg.org/spec/DMN/20180521/DI/" xmlns:kie="https://kie.org/dmn/extensions/1.0">
<itemDefinition id="_728BCE44-9D43-4177-855D-621AC6C33224" name="stringThatMayHaveNumber" isCollection="false" typeLanguage="https://www.omg.org/spec/DMN/20230324/FEEL/">
<typeRef>string</typeRef>
<typeConstraint id="_28270ECA-5BCF-4343-9B20-A673B8F50ED6" kie:constraintType="expression">
<text>matches(?, "\d")</text>
</typeConstraint>
</itemDefinition>
<inputData name="Text Input" id="_A73A92E5-3CCE-42FB-A38B-06C94764EF54">
<variable name="Text Input" id="_65D30C93-6003-45A6-9AC3-34382D8231AF" typeRef="stringThatMayHaveNumber" />
</inputData>
<decision name="Matches Digit" id="_30F833E1-D98F-41E9-A79E-CA5B0CC40AB3">
<variable id="_0C248365-D835-4908-B099-840B50327C00" typeRef="stringThatMayHaveNumber" name="Matches Digit" />
<informationRequirement id="_0C45AA36-FDE7-4DE9-A426-EF80EF9998CD">
<requiredInput href="#_A73A92E5-3CCE-42FB-A38B-06C94764EF54" />
</informationRequirement>
<literalExpression id="_D48158E1-D2C3-4D63-AD0E-375D5AAF75EC" typeRef="stringThatMayHaveNumber" label="Matches Digit">
<text>Text Input</text>
</literalExpression>
</decision>
<dmndi:DMNDI>
<dmndi:DMNDiagram id="_6F44765F-EDDC-425A-8AB9-146D96A42275" name="Default DRD" useAlternativeInputDataShape="false">
<di:extension>
<kie:ComponentsWidthsExtension>
<kie:ComponentWidths dmnElementRef="_D48158E1-D2C3-4D63-AD0E-375D5AAF75EC">
<kie:width>190</kie:width>
</kie:ComponentWidths>
</kie:ComponentsWidthsExtension>
</di:extension>
<dmndi:DMNShape id="_6B66F754-D1AC-47E3-95E4-839C01EE1BB2" dmnElementRef="_A73A92E5-3CCE-42FB-A38B-06C94764EF54" isCollapsed="false" isListedInputData="false">
<dc:Bounds x="120" y="140" width="160" height="80" />
</dmndi:DMNShape>
<dmndi:DMNShape id="_6DBD4814-D4FF-4B92-A274-0A5AF69D60C1" dmnElementRef="_30F833E1-D98F-41E9-A79E-CA5B0CC40AB3" isCollapsed="false" isListedInputData="false">
<dc:Bounds x="460" y="140" width="160" height="80" />
</dmndi:DMNShape>
<dmndi:DMNEdge id="_33417792-146A-4135-B537-302AF23C6E90-AUTO-TARGET" dmnElementRef="_0C45AA36-FDE7-4DE9-A426-EF80EF9998CD" sourceElement="_6B66F754-D1AC-47E3-95E4-839C01EE1BB2" targetElement="_6DBD4814-D4FF-4B92-A274-0A5AF69D60C1">
<di:waypoint x="200" y="180" />
<di:waypoint x="540" y="180" />
</dmndi:DMNEdge>
</dmndi:DMNDiagram>
</dmndi:DMNDI>
</definitions>