Skip to content

Instantly share code, notes, and snippets.

@ljmotta
Last active July 5, 2021 22:47
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/ad5ed86390b90d9a0e7aaf0f96135f5f to your computer and use it in GitHub Desktop.
Save ljmotta/ad5ed86390b90d9a0e7aaf0f96135f5f to your computer and use it in GitHub Desktop.
TraficViolation.dmn
<dmn:definitions xmlns:dmn="http://www.omg.org/spec/DMN/20180521/MODEL/" xmlns="https://kiegroup.org/dmn/_41B2F498-3F8D-4DBA-95B9-216E1C0209EA" 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="_4195FEF6-9C31-4A5D-97EC-AFF8B8B57E38" name="new-file" typeLanguage="http://www.omg.org/spec/DMN/20180521/FEEL/" namespace="https://kiegroup.org/dmn/_41B2F498-3F8D-4DBA-95B9-216E1C0209EA">
<dmn:extensionElements/>
<dmn:itemDefinition id="_7FBA70D7-5A2A-4583-947F-71D4C6BD98C9" name="tDriver" isCollection="false">
<dmn:itemComponent id="_5E62C98F-9C03-49D3-909A-F87397910191" name="Points" isCollection="false">
<dmn:typeRef>number</dmn:typeRef>
</dmn:itemComponent>
<dmn:itemComponent id="_34FF7299-DF1E-4FCC-87A7-ADD428028D59" name="Age" isCollection="false">
<dmn:typeRef>number</dmn:typeRef>
</dmn:itemComponent>
</dmn:itemDefinition>
<dmn:itemDefinition id="_5DC601B0-1760-4968-820C-BA4E41E01330" name="tViolation" isCollection="false">
<dmn:itemComponent id="_E807BA2D-4C8B-4829-A46B-47F01C0D0427" name="Type" isCollection="false">
<dmn:typeRef>string</dmn:typeRef>
<dmn:allowedValues kie:constraintType="enumeration" id="_D69973DF-02C3-4F47-AD9C-107B41943681">
<dmn:text>"speed", "parking"</dmn:text>
</dmn:allowedValues>
</dmn:itemComponent>
<dmn:itemComponent id="_C2BF1C47-42ED-4768-B79A-667E18B39F2E" name="Actual Speed" isCollection="false">
<dmn:typeRef>number</dmn:typeRef>
</dmn:itemComponent>
<dmn:itemComponent id="_14F95E0A-920F-4174-B7BB-054FB9E537A7" name="Speed Limit" isCollection="false">
<dmn:typeRef>number</dmn:typeRef>
</dmn:itemComponent>
<dmn:itemComponent id="_B81AC9C9-182C-4AE9-825E-CF8570B15405" name="Code" isCollection="false">
<dmn:typeRef>string</dmn:typeRef>
</dmn:itemComponent>
</dmn:itemDefinition>
<dmn:itemDefinition id="_5EBEAB5F-4AEA-402A-BD85-B52EE5BB6EB9" name="tFine" isCollection="false">
<dmn:itemComponent id="_37751EA9-64FF-4817-BBAD-9A42774D61D2" name="Points" isCollection="false">
<dmn:typeRef>number</dmn:typeRef>
</dmn:itemComponent>
</dmn:itemDefinition>
<dmn:inputData id="_D6443A31-609A-47DC-B488-0E4F4363ED15" name="Driver">
<dmn:extensionElements/>
<dmn:variable id="_1578E9F2-48F1-4365-AC26-18A66B8F9823" name="Driver" typeRef="tDriver"/>
</dmn:inputData>
<dmn:inputData id="_DA82A0C1-B34B-45A6-9682-71B046D5BE52" name="Violation">
<dmn:extensionElements/>
<dmn:variable id="_6795B6C5-BC0F-45DC-AA2D-9447BA7BEEFE" name="Violation" typeRef="tViolation"/>
</dmn:inputData>
<dmn:decision id="_ECD60FAA-C040-4F0E-9980-9E76FCA74C11" name="Fine.Points">
<dmn:extensionElements/>
<dmn:variable id="_AAE96EBE-F00A-4F04-9EB0-B1B0425D0C9D" name="Fine.Points" typeRef="tFine"/>
<dmn:informationRequirement id="_3E588A8E-F6A6-420E-87E5-6EDCDCB36684">
<dmn:requiredInput href="#_DA82A0C1-B34B-45A6-9682-71B046D5BE52"/>
</dmn:informationRequirement>
<dmn:decisionTable id="_BEED9B06-D731-45C3-B610-B102F5F0AC19" hitPolicy="UNIQUE" preferredOrientation="Rule-as-Row">
<dmn:input id="_EB87E9DA-FEB9-4F43-947C-2BAB42749FC5">
<dmn:inputExpression id="_DA90DDA0-5425-4CFC-BD10-52F70607E56E" typeRef="string">
<dmn:text>Violation.Type</dmn:text>
</dmn:inputExpression>
</dmn:input>
<dmn:input id="_9AB9C221-D354-4FC8-A5FB-18E6A2E30A85">
<dmn:inputExpression id="_12DA180D-A892-42A6-8035-7074606A29B8" typeRef="number">
<dmn:text>Violation.Actual Speed - Violation.Speed Limit</dmn:text>
</dmn:inputExpression>
</dmn:input>
<dmn:output id="_AAA3814B-0137-49DB-9962-0402C3F07D04"/>
<dmn:annotation name="annotation-1"/>
<dmn:rule id="_6A0076BB-5579-4600-AF2C-AE72D9504AC9">
<dmn:inputEntry id="_9A76F161-02AF-43BF-A791-167CED5040F7">
<dmn:text>"speed"</dmn:text>
</dmn:inputEntry>
<dmn:inputEntry id="_8E2A9254-E4EC-4754-8A50-08C8AF9A7FDC">
<dmn:text>[10..30)</dmn:text>
</dmn:inputEntry>
<dmn:outputEntry id="_78EB4644-1C83-4040-A0B6-0CF91720D884">
<dmn:text>3</dmn:text>
</dmn:outputEntry>
<dmn:annotationEntry>
<dmn:text/>
</dmn:annotationEntry>
</dmn:rule>
<dmn:rule id="_D8802334-5C31-4DC8-B00A-16D91FE5EA98">
<dmn:inputEntry id="_C529FB82-6D5E-4EF7-9B82-7CB5F65EE41D">
<dmn:text>"speed"</dmn:text>
</dmn:inputEntry>
<dmn:inputEntry id="_BC7F714B-6D1E-4A66-9589-AB443C0A2783">
<dmn:text>[30..50)</dmn:text>
</dmn:inputEntry>
<dmn:outputEntry id="_28B539E3-3895-43A8-9899-DC7F0BE4505E">
<dmn:text>5</dmn:text>
</dmn:outputEntry>
<dmn:annotationEntry>
<dmn:text/>
</dmn:annotationEntry>
</dmn:rule>
<dmn:rule id="_C680CA9F-8DC1-444B-85EC-3A8B90232937">
<dmn:inputEntry id="_044DF30B-2BB1-494D-9069-55AA4FA7FA4F">
<dmn:text>"speed"</dmn:text>
</dmn:inputEntry>
<dmn:inputEntry id="_C559940C-D41B-4B75-8391-5D2A0F84363B">
<dmn:text>&gt;= 50</dmn:text>
</dmn:inputEntry>
<dmn:outputEntry id="_573CA05C-5342-491C-A932-4FBBF8B86BD4">
<dmn:text>7</dmn:text>
</dmn:outputEntry>
<dmn:annotationEntry>
<dmn:text/>
</dmn:annotationEntry>
</dmn:rule>
<dmn:rule id="_623D26DF-9E3E-4465-99E8-0299F0CF4A0A">
<dmn:inputEntry id="_5CDBDBA0-7D1B-4F56-975D-DB13BADC1B6A">
<dmn:text>"parking"</dmn:text>
</dmn:inputEntry>
<dmn:inputEntry id="_3E8EE9EF-F3DA-4D08-8F3F-9FFE709A818D">
<dmn:text>-</dmn:text>
</dmn:inputEntry>
<dmn:outputEntry id="_9ACE44CD-00AD-4C85-81B4-05C08121C703">
<dmn:text>99</dmn:text>
</dmn:outputEntry>
<dmn:annotationEntry>
<dmn:text/>
</dmn:annotationEntry>
</dmn:rule>
</dmn:decisionTable>
</dmn:decision>
<dmn:decision id="_8FCDEB99-91C7-48CE-A758-F959FEB715F4" name="Should be suspended?">
<dmn:extensionElements/>
<dmn:question>Should the driver be suspended due to points on his driver license?</dmn:question>
<dmn:allowedAnswers>Yes,No</dmn:allowedAnswers>
<dmn:variable id="_BCAD67CA-55AD-453B-A678-D255AD3D5A96" name="Should be suspended?" typeRef="string"/>
<dmn:informationRequirement id="_7E87532A-4881-4D7E-AC5B-1AF31BF8D2E0">
<dmn:requiredInput href="#_D6443A31-609A-47DC-B488-0E4F4363ED15"/>
</dmn:informationRequirement>
<dmn:informationRequirement id="_C07E7195-45C8-4A64-B9E5-66A7C9A08508">
<dmn:requiredDecision href="#_ECD60FAA-C040-4F0E-9980-9E76FCA74C11"/>
</dmn:informationRequirement>
<dmn:context id="_4F62BD87-21E2-44A4-974E-89AAD56B4E57">
<dmn:contextEntry>
<dmn:variable id="_FC00857B-7E0B-47D1-842C-FCC61C42912D" name="Total Points" typeRef="number"/>
<dmn:literalExpression id="_283DA010-FBB5-426A-B02A-206833ED93BE">
<dmn:text>Driver.Points + Fine.Points</dmn:text>
</dmn:literalExpression>
</dmn:contextEntry>
<dmn:contextEntry>
<dmn:literalExpression id="_9749F126-3C35-4B0A-82E7-166D58626D98">
<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="_3F96C870-847B-4EC6-815B-CB4460A16ED2" name="DRG">
<di:extension>
<kie:ComponentsWidthsExtension>
<kie:ComponentWidths dmnElementRef="_BEED9B06-D731-45C3-B610-B102F5F0AC19">
<kie:width>50</kie:width>
<kie:width>100</kie:width>
<kie:width>264</kie:width>
<kie:width>100</kie:width>
<kie:width>100</kie:width>
</kie:ComponentWidths>
<kie:ComponentWidths dmnElementRef="_4F62BD87-21E2-44A4-974E-89AAD56B4E57">
<kie:width>50</kie:width>
<kie:width>100</kie:width>
<kie:width>300</kie:width>
</kie:ComponentWidths>
<kie:ComponentWidths dmnElementRef="_283DA010-FBB5-426A-B02A-206833ED93BE">
<kie:width>300</kie:width>
</kie:ComponentWidths>
<kie:ComponentWidths dmnElementRef="_9749F126-3C35-4B0A-82E7-166D58626D98">
<kie:width>300</kie:width>
</kie:ComponentWidths>
</kie:ComponentsWidthsExtension>
</di:extension>
<dmndi:DMNShape id="dmnshape-drg-_D6443A31-609A-47DC-B488-0E4F4363ED15" dmnElementRef="_D6443A31-609A-47DC-B488-0E4F4363ED15" 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="201" y="351.3421052631579" width="100" height="50"/>
<dmndi:DMNLabel/>
</dmndi:DMNShape>
<dmndi:DMNShape id="dmnshape-drg-_DA82A0C1-B34B-45A6-9682-71B046D5BE52" dmnElementRef="_DA82A0C1-B34B-45A6-9682-71B046D5BE52" 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="481" y="495" width="100" height="50"/>
<dmndi:DMNLabel/>
</dmndi:DMNShape>
<dmndi:DMNShape id="dmnshape-drg-_ECD60FAA-C040-4F0E-9980-9E76FCA74C11" dmnElementRef="_ECD60FAA-C040-4F0E-9980-9E76FCA74C11" 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="482" y="346" width="100" height="50"/>
<dmndi:DMNLabel/>
</dmndi:DMNShape>
<dmndi:DMNShape id="dmnshape-drg-_8FCDEB99-91C7-48CE-A758-F959FEB715F4" dmnElementRef="_8FCDEB99-91C7-48CE-A758-F959FEB715F4" 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="387" y="208" width="100" height="50"/>
<dmndi:DMNLabel/>
</dmndi:DMNShape>
<dmndi:DMNEdge id="dmnedge-drg-_3E588A8E-F6A6-420E-87E5-6EDCDCB36684-AUTO-TARGET" dmnElementRef="_3E588A8E-F6A6-420E-87E5-6EDCDCB36684">
<di:waypoint x="531" y="520"/>
<di:waypoint x="532" y="346"/>
</dmndi:DMNEdge>
<dmndi:DMNEdge id="dmnedge-drg-_7E87532A-4881-4D7E-AC5B-1AF31BF8D2E0-AUTO-TARGET" dmnElementRef="_7E87532A-4881-4D7E-AC5B-1AF31BF8D2E0">
<di:waypoint x="251" y="376.3421052631579"/>
<di:waypoint x="437" y="208"/>
</dmndi:DMNEdge>
<dmndi:DMNEdge id="dmnedge-drg-_C07E7195-45C8-4A64-B9E5-66A7C9A08508" dmnElementRef="_C07E7195-45C8-4A64-B9E5-66A7C9A08508">
<di:waypoint x="532" y="371"/>
<di:waypoint x="437" y="258"/>
</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