Skip to content

Instantly share code, notes, and snippets.

@ljmotta
Last active September 12, 2022 18:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ljmotta/8fac66b82575a98ccd1208bf6805f9d9 to your computer and use it in GitHub Desktop.
Save ljmotta/8fac66b82575a98ccd1208bf6805f9d9 to your computer and use it in GitHub Desktop.
Example
<?xml version="1.0" encoding="UTF-8"?>
<dmn:definitions xmlns:dmn="http://www.omg.org/spec/DMN/20180521/MODEL/" xmlns="https://kiegroup.org/dmn/_3B43CC66-E86C-48E6-9B9C-99435BA2B628" xmlns:feel="http://www.omg.org/spec/DMN/20180521/FEEL/" xmlns:kie="http://www.drools.org/kie/dmn/1.2" xmlns:dmndi="http://www.omg.org/spec/DMN/20180521/DMNDI/" xmlns:di="http://www.omg.org/spec/DMN/20180521/DI/" xmlns:dc="http://www.omg.org/spec/DMN/20180521/DC/" id="_5BA6081A-7F44-46FF-8714-15998F72B873" name="Untitled" typeLanguage="http://www.omg.org/spec/DMN/20180521/FEEL/" namespace="https://kiegroup.org/dmn/_3B43CC66-E86C-48E6-9B9C-99435BA2B628">
<dmn:extensionElements/>
<dmn:inputData id="_5937E4F1-7B59-4986-B846-29200DABC01D" name="myInput">
<dmn:extensionElements/>
<dmn:variable id="_9FC6FA97-04A6-4F22-B5B2-A7C336489C5C" name="myInput" typeRef="string"/>
</dmn:inputData>
<dmn:decision id="_20608E65-1528-4D19-B7E0-9206C06FC729" name="myDecision">
<dmn:extensionElements/>
<dmn:variable id="_490C9F86-3554-4370-9A5F-0571BC785153" name="myDecision" typeRef="string"/>
<dmn:informationRequirement id="_E365B2C0-99B9-47E5-AE96-550A2EF5173E">
<dmn:requiredInput href="#_5937E4F1-7B59-4986-B846-29200DABC01D"/>
</dmn:informationRequirement>
<dmn:literalExpression id="_4DB21A9D-4445-45CC-81D7-788C3360C276">
<dmn:text>myInput</dmn:text>
</dmn:literalExpression>
</dmn:decision>
<dmn:decision id="_D33C2B74-4E5D-48A2-97D6-FD0D7D530886" name="Decision-1">
<dmn:extensionElements/>
<dmn:variable id="_9DE2023B-A4CA-496E-B94B-323F66495D6E" name="Decision-1"/>
<dmn:informationRequirement id="_6DC52B53-220D-4660-A205-ADD8B7F3DA78">
<dmn:requiredInput href="#_5937E4F1-7B59-4986-B846-29200DABC01D"/>
</dmn:informationRequirement>
</dmn:decision>
<dmndi:DMNDI>
<dmndi:DMNDiagram id="_EBD3BB95-1026-404C-A37F-47259097C626" name="DRG">
<di:extension>
<kie:ComponentsWidthsExtension>
<kie:ComponentWidths dmnElementRef="_4DB21A9D-4445-45CC-81D7-788C3360C276">
<kie:width>300</kie:width>
</kie:ComponentWidths>
</kie:ComponentsWidthsExtension>
</di:extension>
<dmndi:DMNShape id="dmnshape-drg-_5937E4F1-7B59-4986-B846-29200DABC01D" dmnElementRef="_5937E4F1-7B59-4986-B846-29200DABC01D" isCollapsed="false">
<dmndi:DMNStyle>
<dmndi:FillColor red="255" green="255" blue="255"/>
<dmndi:StrokeColor red="0" green="0" blue="0"/>
<dmndi:FontColor red="0" green="0" blue="0"/>
</dmndi:DMNStyle>
<dc:Bounds x="158" y="144" width="100" height="50"/>
<dmndi:DMNLabel/>
</dmndi:DMNShape>
<dmndi:DMNShape id="dmnshape-drg-_20608E65-1528-4D19-B7E0-9206C06FC729" dmnElementRef="_20608E65-1528-4D19-B7E0-9206C06FC729" isCollapsed="false">
<dmndi:DMNStyle>
<dmndi:FillColor red="255" green="255" blue="255"/>
<dmndi:StrokeColor red="0" green="0" blue="0"/>
<dmndi:FontColor red="0" green="0" blue="0"/>
</dmndi:DMNStyle>
<dc:Bounds x="275" y="17" width="100" height="50"/>
<dmndi:DMNLabel/>
</dmndi:DMNShape>
<dmndi:DMNShape id="dmnshape-drg-_D33C2B74-4E5D-48A2-97D6-FD0D7D530886" dmnElementRef="_D33C2B74-4E5D-48A2-97D6-FD0D7D530886" isCollapsed="false">
<dmndi:DMNStyle>
<dmndi:FillColor red="255" green="255" blue="255"/>
<dmndi:StrokeColor red="0" green="0" blue="0"/>
<dmndi:FontColor red="0" green="0" blue="0"/>
</dmndi:DMNStyle>
<dc:Bounds x="140" y="17" width="100" height="50"/>
<dmndi:DMNLabel/>
</dmndi:DMNShape>
<dmndi:DMNEdge id="dmnedge-drg-_E365B2C0-99B9-47E5-AE96-550A2EF5173E-AUTO-SOURCE-AUTO-TARGET" dmnElementRef="_E365B2C0-99B9-47E5-AE96-550A2EF5173E">
<di:waypoint x="208" y="144"/>
<di:waypoint x="325" y="67"/>
</dmndi:DMNEdge>
<dmndi:DMNEdge id="dmnedge-drg-_6DC52B53-220D-4660-A205-ADD8B7F3DA78" dmnElementRef="_6DC52B53-220D-4660-A205-ADD8B7F3DA78">
<di:waypoint x="208" y="169"/>
<di:waypoint x="190" y="67"/>
</dmndi:DMNEdge>
</dmndi:DMNDiagram>
</dmndi:DMNDI>
</dmn:definitions>
<?xml version="1.0" encoding="UTF-8"?>
<dmn:definitions xmlns:dmn="http://www.omg.org/spec/DMN/20180521/MODEL/" xmlns="https://kiegroup.org/dmn/_E5AE7F47-D106-4EC5-AE8A-402AD2E45847" xmlns:feel="http://www.omg.org/spec/DMN/20180521/FEEL/" xmlns:kie="http://www.drools.org/kie/dmn/1.2" xmlns:dmndi="http://www.omg.org/spec/DMN/20180521/DMNDI/" xmlns:di="http://www.omg.org/spec/DMN/20180521/DI/" xmlns:dc="http://www.omg.org/spec/DMN/20180521/DC/" id="_EB9CE2CC-F803-4EFF-ACE5-F9AA6AC68921" name="traffic violation" typeLanguage="http://www.omg.org/spec/DMN/20180521/FEEL/" namespace="https://kiegroup.org/dmn/_E5AE7F47-D106-4EC5-AE8A-402AD2E45847">
<dmn:extensionElements/>
<dmn:itemDefinition id="_16B3820F-BEDA-4802-BE80-24EAFA6AD200" name="tDriver" isCollection="false">
<dmn:itemComponent id="_89008381-5392-4B6A-AA51-2E259D7A3EF2" name="Current Points" isCollection="false">
<dmn:typeRef>number</dmn:typeRef>
</dmn:itemComponent>
</dmn:itemDefinition>
<dmn:itemDefinition id="_AA2E90FF-7E2B-414D-9170-6DEDC735ABCB" name="tViolation" isCollection="false">
<dmn:itemComponent id="_2D3CFB67-D848-49D3-A0F9-D5410BCC8FF1" name="Type" isCollection="false">
<dmn:typeRef>string</dmn:typeRef>
<dmn:allowedValues kie:constraintType="enumeration" id="_0ACF6AB4-4646-4FD1-83FA-BD88FB99A1DB">
<dmn:text>"speed", "parking"</dmn:text>
</dmn:allowedValues>
</dmn:itemComponent>
<dmn:itemComponent id="_B972F580-321B-4121-BF9E-6D1C2A892038" name="Actual Speed" isCollection="false">
<dmn:typeRef>number</dmn:typeRef>
</dmn:itemComponent>
<dmn:itemComponent id="_DD57FCC8-E969-4019-8A81-1A9617E9B651" name="Speed Limit" isCollection="false">
<dmn:typeRef>number</dmn:typeRef>
</dmn:itemComponent>
</dmn:itemDefinition>
<dmn:itemDefinition id="_B0CB70E6-D296-4756-B232-F0A2FCA7F58D" name="tFine" isCollection="false">
<dmn:itemComponent id="_F51E2269-46B9-4D73-94AD-FC0F69D72D0F" name="Points" isCollection="false">
<dmn:typeRef>number</dmn:typeRef>
</dmn:itemComponent>
<dmn:itemComponent id="_33869306-F1D0-404A-8EC7-137AD6E9C809" name="Amount" isCollection="false">
<dmn:typeRef>number</dmn:typeRef>
</dmn:itemComponent>
</dmn:itemDefinition>
<dmn:inputData id="_BD9BD3DB-2FEB-4657-89E5-15BEFE3F0815" name="Driver">
<dmn:extensionElements/>
<dmn:variable id="_3C708175-72E3-4EAE-B800-6BA32BEA1F06" name="Driver" typeRef="tDriver"/>
</dmn:inputData>
<dmn:inputData id="_F9E2BEF0-222C-49A4-8F24-30147C936EC5" name="Violation">
<dmn:extensionElements/>
<dmn:variable id="_89D4BE82-52B0-4773-8FF5-61A5D26C5B28" name="Violation" typeRef="tViolation"/>
</dmn:inputData>
<dmn:decision id="_BA0784C5-994D-4CE7-9ADA-8E838C04BDD2" name="Fine">
<dmn:extensionElements/>
<dmn:variable id="_A62CD797-7C09-4942-AA96-E34E6E3E0398" name="Fine" typeRef="tFine"/>
<dmn:informationRequirement id="_A3FF5ED1-E02E-4001-A387-3F1A6F24FF72">
<dmn:requiredInput href="#_F9E2BEF0-222C-49A4-8F24-30147C936EC5"/>
</dmn:informationRequirement>
<dmn:decisionTable id="_0A8B6F3F-7D6E-4711-885B-ED043A81437A" hitPolicy="UNIQUE" preferredOrientation="Rule-as-Row">
<dmn:input id="_23B804FA-C5EE-4407-95AE-B39A79A95068">
<dmn:inputExpression id="_55DBD14B-BA25-4BF7-9489-0E242B12F94C" typeRef="string">
<dmn:text>Violation.Type</dmn:text>
</dmn:inputExpression>
</dmn:input>
<dmn:input id="_4AF1C8BA-B65A-401D-A037-F94538A39E33">
<dmn:inputExpression id="_E4714B48-FE0E-4AFA-B584-55272F454DF7" typeRef="number">
<dmn:text>Violation.Actual Speed - Violation.Speed Limit </dmn:text>
</dmn:inputExpression>
</dmn:input>
<dmn:output id="_091746E7-529D-4FEF-BAF6-7CA15406D80A" name="Amount" typeRef="number"/>
<dmn:output id="_5DA94E49-630B-4A80-BE2C-8BAB6F3A75D0" name="Points" typeRef="number"/>
<dmn:annotation name="annotation-1"/>
<dmn:rule id="_EE8031D4-FB15-4063-A186-F6C9E28CBF0F">
<dmn:inputEntry id="_4B6B9D1A-6668-4479-A14D-C56F3267D0B6">
<dmn:text>"speed"</dmn:text>
</dmn:inputEntry>
<dmn:inputEntry id="_5EAD165F-613E-4398-949B-0EE0D62A0B84">
<dmn:text>[10..30)</dmn:text>
</dmn:inputEntry>
<dmn:outputEntry id="_E8D5633B-FD8F-42DD-8CAF-282DC87232E4">
<dmn:text>500</dmn:text>
</dmn:outputEntry>
<dmn:outputEntry id="_2CCDDDEE-E6ED-4392-BBC9-05ECD0121C3A">
<dmn:text>3</dmn:text>
</dmn:outputEntry>
<dmn:annotationEntry>
<dmn:text/>
</dmn:annotationEntry>
</dmn:rule>
<dmn:rule id="_E3B0C581-2A12-4E5A-8BDE-9B3F0AA02965">
<dmn:inputEntry id="_9627D923-CAA2-4007-A25F-B7EE13C720CD">
<dmn:text>"speed"</dmn:text>
</dmn:inputEntry>
<dmn:inputEntry id="_4B584400-4405-45C2-86C5-15A73C69AA60">
<dmn:text>&gt;= 30</dmn:text>
</dmn:inputEntry>
<dmn:outputEntry id="_423B417F-1D3A-4CAC-A41F-40413B4FF288">
<dmn:text>1000</dmn:text>
</dmn:outputEntry>
<dmn:outputEntry id="_6AC853EE-B205-470B-8939-A812EB834680">
<dmn:text>5</dmn:text>
</dmn:outputEntry>
<dmn:annotationEntry>
<dmn:text/>
</dmn:annotationEntry>
</dmn:rule>
<dmn:rule id="_696C02E5-A140-47B5-914F-8FF771625E5A">
<dmn:inputEntry id="_B3AE2BE6-9391-45B3-9FE5-FE3A3B240685">
<dmn:text>"parking"</dmn:text>
</dmn:inputEntry>
<dmn:inputEntry id="_BE8F34D4-4F54-4034-A4A4-38CADCF05131">
<dmn:text>-</dmn:text>
</dmn:inputEntry>
<dmn:outputEntry id="_76354B3B-5CEE-4A48-AEF5-3D3AAA41A076">
<dmn:text>700</dmn:text>
</dmn:outputEntry>
<dmn:outputEntry id="_82CC6551-5D67-4D24-9B02-04BD2B8B03DA">
<dmn:text>3</dmn:text>
</dmn:outputEntry>
<dmn:annotationEntry>
<dmn:text/>
</dmn:annotationEntry>
</dmn:rule>
</dmn:decisionTable>
</dmn:decision>
<dmn:decision id="_38A97746-BFD6-4D08-AF44-C729D17FAB85" name="Should driver be suspended?">
<dmn:extensionElements/>
<dmn:question>Should driver be suspended?</dmn:question>
<dmn:allowedAnswers>Yes,No</dmn:allowedAnswers>
<dmn:variable id="_62E1F5BA-7AAE-4988-ACF8-4B6713D3A053" name="Should driver be suspended?" typeRef="string"/>
<dmn:informationRequirement id="_05A3481D-5C7B-42B8-9728-5BCE89C3B034">
<dmn:requiredDecision href="#_BA0784C5-994D-4CE7-9ADA-8E838C04BDD2"/>
</dmn:informationRequirement>
<dmn:informationRequirement id="_6B9BB205-ED12-4836-84DF-5208E93CDF9F">
<dmn:requiredInput href="#_BD9BD3DB-2FEB-4657-89E5-15BEFE3F0815"/>
</dmn:informationRequirement>
<dmn:context id="_A74801A2-0089-4B7F-9631-8353C7AEAB22">
<dmn:contextEntry>
<dmn:variable id="_17A9694B-37F4-4035-9DE9-BF37BC86EF90" name="Total Points" typeRef="number"/>
<dmn:literalExpression id="_19AC74F5-7728-49DD-BE2D-428B48B4A69B">
<dmn:text>Driver.Current Points + Fine.Points</dmn:text>
</dmn:literalExpression>
</dmn:contextEntry>
<dmn:contextEntry>
<dmn:literalExpression id="_928A117F-E6D3-40B9-A835-01951ADAD6AD">
<dmn:text>if Total Points &gt;= 20 then "Yes" else "No"</dmn:text>
</dmn:literalExpression>
</dmn:contextEntry>
</dmn:context>
</dmn:decision>
<dmndi:DMNDI>
<dmndi:DMNDiagram id="_7E5AFB93-1683-470D-A647-13120FC5A4D3" name="DRG">
<di:extension>
<kie:ComponentsWidthsExtension>
<kie:ComponentWidths dmnElementRef="_0A8B6F3F-7D6E-4711-885B-ED043A81437A">
<kie:width>50</kie:width>
<kie:width>100</kie:width>
<kie:width>178</kie:width>
<kie:width>100</kie:width>
<kie:width>100</kie:width>
<kie:width>100</kie:width>
</kie:ComponentWidths>
<kie:ComponentWidths dmnElementRef="_A74801A2-0089-4B7F-9631-8353C7AEAB22">
<kie:width>50</kie:width>
<kie:width>100</kie:width>
<kie:width>262</kie:width>
</kie:ComponentWidths>
<kie:ComponentWidths dmnElementRef="_19AC74F5-7728-49DD-BE2D-428B48B4A69B">
<kie:width>262</kie:width>
</kie:ComponentWidths>
<kie:ComponentWidths dmnElementRef="_928A117F-E6D3-40B9-A835-01951ADAD6AD">
<kie:width>262</kie:width>
</kie:ComponentWidths>
</kie:ComponentsWidthsExtension>
</di:extension>
<dmndi:DMNShape id="dmnshape-drg-_BD9BD3DB-2FEB-4657-89E5-15BEFE3F0815" dmnElementRef="_BD9BD3DB-2FEB-4657-89E5-15BEFE3F0815" isCollapsed="false">
<dmndi:DMNStyle>
<dmndi:FillColor red="255" green="255" blue="255"/>
<dmndi:StrokeColor red="0" green="0" blue="0"/>
<dmndi:FontColor red="0" green="0" blue="0"/>
</dmndi:DMNStyle>
<dc:Bounds x="228" y="328" width="100" height="50"/>
<dmndi:DMNLabel/>
</dmndi:DMNShape>
<dmndi:DMNShape id="dmnshape-drg-_F9E2BEF0-222C-49A4-8F24-30147C936EC5" dmnElementRef="_F9E2BEF0-222C-49A4-8F24-30147C936EC5" isCollapsed="false">
<dmndi:DMNStyle>
<dmndi:FillColor red="255" green="255" blue="255"/>
<dmndi:StrokeColor red="0" green="0" blue="0"/>
<dmndi:FontColor red="0" green="0" blue="0"/>
</dmndi:DMNStyle>
<dc:Bounds x="547" y="328" width="100" height="50"/>
<dmndi:DMNLabel/>
</dmndi:DMNShape>
<dmndi:DMNShape id="dmnshape-drg-_BA0784C5-994D-4CE7-9ADA-8E838C04BDD2" dmnElementRef="_BA0784C5-994D-4CE7-9ADA-8E838C04BDD2" isCollapsed="false">
<dmndi:DMNStyle>
<dmndi:FillColor red="255" green="255" blue="255"/>
<dmndi:StrokeColor red="0" green="0" blue="0"/>
<dmndi:FontColor red="0" green="0" blue="0"/>
</dmndi:DMNStyle>
<dc:Bounds x="445" y="205" width="100" height="50"/>
<dmndi:DMNLabel/>
</dmndi:DMNShape>
<dmndi:DMNShape id="dmnshape-drg-_38A97746-BFD6-4D08-AF44-C729D17FAB85" dmnElementRef="_38A97746-BFD6-4D08-AF44-C729D17FAB85" isCollapsed="false">
<dmndi:DMNStyle>
<dmndi:FillColor red="255" green="255" blue="255"/>
<dmndi:StrokeColor red="0" green="0" blue="0"/>
<dmndi:FontColor red="0" green="0" blue="0"/>
</dmndi:DMNStyle>
<dc:Bounds x="429" y="13" width="100" height="50"/>
<dmndi:DMNLabel/>
</dmndi:DMNShape>
<dmndi:DMNEdge id="dmnedge-drg-_A3FF5ED1-E02E-4001-A387-3F1A6F24FF72-AUTO-SOURCE-AUTO-TARGET" dmnElementRef="_A3FF5ED1-E02E-4001-A387-3F1A6F24FF72">
<di:waypoint x="597" y="328"/>
<di:waypoint x="495" y="255"/>
</dmndi:DMNEdge>
<dmndi:DMNEdge id="dmnedge-drg-_05A3481D-5C7B-42B8-9728-5BCE89C3B034-AUTO-TARGET" dmnElementRef="_05A3481D-5C7B-42B8-9728-5BCE89C3B034">
<di:waypoint x="495" y="230"/>
<di:waypoint x="479" y="13"/>
</dmndi:DMNEdge>
<dmndi:DMNEdge id="dmnedge-drg-_6B9BB205-ED12-4836-84DF-5208E93CDF9F" dmnElementRef="_6B9BB205-ED12-4836-84DF-5208E93CDF9F">
<di:waypoint x="278" y="353"/>
<di:waypoint x="479" y="63"/>
</dmndi:DMNEdge>
</dmndi:DMNDiagram>
</dmndi:DMNDI>
</dmn:definitions>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment