Skip to content

Instantly share code, notes, and snippets.

@dmarrazzo
Last active February 9, 2023 11:58
Show Gist options
  • Save dmarrazzo/fcc827393ce31fc4896d6b5cda62b83a to your computer and use it in GitHub Desktop.
Save dmarrazzo/fcc827393ce31fc4896d6b5cda62b83a to your computer and use it in GitHub Desktop.
Tutorial
<?xml version="1.0" encoding="UTF-8"?>
<dmn:definitions xmlns:dmn="http://www.omg.org/spec/DMN/20180521/MODEL/" xmlns="https://kiegroup.org/dmn/_1634073F-9433-44F1-B575-097FB410FEF2" 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="_D5CE1E36-CAA0-47FC-B04F-069AD65FC89E" name="Total Bonus" typeLanguage="http://www.omg.org/spec/DMN/20180521/FEEL/" namespace="https://kiegroup.org/dmn/_1634073F-9433-44F1-B575-097FB410FEF2">
<dmn:extensionElements/>
<dmn:itemDefinition id="_BDA79392-0FB5-4C68-AA46-83165F211051" name="tStringList" isCollection="true">
<dmn:typeRef>string</dmn:typeRef>
</dmn:itemDefinition>
<dmn:inputData id="_C15FB2B5-BF6B-43B9-B919-5AEBF6D1BC33" name="Products">
<dmn:extensionElements/>
<dmn:variable id="_DE6FB57C-10AF-4842-A748-A848132D5F0C" name="Products" typeRef="tStringList"/>
</dmn:inputData>
<dmn:decision id="_813CC25A-BE37-41B1-8612-3AE364B7DBBB" name="Total Bonus">
<dmn:extensionElements/>
<dmn:variable id="_C3312BB8-755D-4D17-9509-BAFA246353D7" name="Total Bonus" typeRef="number"/>
<dmn:informationRequirement id="_90996057-7DA1-4911-BDAC-38B405F1D0D6">
<dmn:requiredInput href="#_C15FB2B5-BF6B-43B9-B919-5AEBF6D1BC33"/>
</dmn:informationRequirement>
<dmn:knowledgeRequirement id="_2CCFB787-256F-4845-967B-A170D1731CFB">
<dmn:requiredKnowledge href="#_DA4518B4-3DFD-4C8C-A07A-0266B44C4558"/>
</dmn:knowledgeRequirement>
<dmn:context id="_E0D9E414-E155-431B-B84D-44754E813BB1">
<dmn:contextEntry>
<dmn:variable id="_EB27CF10-A5C9-48AB-8456-857185C061BB" name="bonus list" typeRef="tStringList"/>
<dmn:literalExpression id="_DC6D4CC4-F7E7-462B-8508-692D834740AD">
<dmn:text>for a product in Products
return bonus(a product)</dmn:text>
</dmn:literalExpression>
</dmn:contextEntry>
<dmn:contextEntry>
<dmn:literalExpression id="_69993558-DEBD-454A-A0C7-51F3169BFF0B">
<dmn:text>sum(bonus list)</dmn:text>
</dmn:literalExpression>
</dmn:contextEntry>
</dmn:context>
</dmn:decision>
<dmn:businessKnowledgeModel id="_DA4518B4-3DFD-4C8C-A07A-0266B44C4558" name="bonus">
<dmn:extensionElements/>
<dmn:variable id="_61B819A4-2769-4E36-8E34-7FC2B9030C75" name="bonus" typeRef="number"/>
<dmn:encapsulatedLogic id="_36C56A96-3BB4-4C7A-8310-7923F8D577D6" kind="FEEL">
<dmn:formalParameter id="_FC70351C-83B7-4E18-8865-E38CAAD5C997" name="product" typeRef="string"/>
<dmn:decisionTable id="_1E70DD3B-4700-4735-BCDF-4FF932010677" hitPolicy="UNIQUE" preferredOrientation="Rule-as-Row">
<dmn:input id="_8D50B563-BC3C-42B7-B1AE-77B028A53CF9">
<dmn:inputExpression id="_18990B2A-769E-45DF-B113-2F188EC53D6D" typeRef="string">
<dmn:text>product</dmn:text>
</dmn:inputExpression>
</dmn:input>
<dmn:output id="_48C95768-3E0B-4D0E-9E76-2423E830394D">
<dmn:defaultOutputEntry id="_57C417F3-23A4-46CA-8850-B618AF1A49DC">
<dmn:text>0</dmn:text>
</dmn:defaultOutputEntry>
</dmn:output>
<dmn:annotation name="annotation-1"/>
<dmn:rule id="_E1A39A7E-B5C2-44EF-A68A-2A9EFF57A97D">
<dmn:inputEntry id="_EE7A9BF9-492B-45CD-B00C-1974733384C3">
<dmn:text>"pen"</dmn:text>
</dmn:inputEntry>
<dmn:outputEntry id="_A03687E6-BB67-4343-B5FE-7869F487D5A0">
<dmn:text>1</dmn:text>
</dmn:outputEntry>
<dmn:annotationEntry>
<dmn:text/>
</dmn:annotationEntry>
</dmn:rule>
<dmn:rule id="_39D70F26-0A3B-48A8-8808-3BB8D1245B1D">
<dmn:inputEntry id="_A27D1527-8C89-40CC-B46F-4E4FB3F6518A">
<dmn:text>"book"</dmn:text>
</dmn:inputEntry>
<dmn:outputEntry id="_B8B26D32-A1BF-45BC-824C-69B026200D5C">
<dmn:text>2</dmn:text>
</dmn:outputEntry>
<dmn:annotationEntry>
<dmn:text/>
</dmn:annotationEntry>
</dmn:rule>
</dmn:decisionTable>
</dmn:encapsulatedLogic>
</dmn:businessKnowledgeModel>
<dmndi:DMNDI>
<dmndi:DMNDiagram id="_5B7B27E8-7AE1-44BF-ADB3-531B8111D6C6" name="DRG">
<di:extension>
<kie:ComponentsWidthsExtension>
<kie:ComponentWidths dmnElementRef="_E0D9E414-E155-431B-B84D-44754E813BB1">
<kie:width>50</kie:width>
<kie:width>100</kie:width>
<kie:width>300</kie:width>
</kie:ComponentWidths>
<kie:ComponentWidths dmnElementRef="_DC6D4CC4-F7E7-462B-8508-692D834740AD">
<kie:width>300</kie:width>
</kie:ComponentWidths>
<kie:ComponentWidths dmnElementRef="_69993558-DEBD-454A-A0C7-51F3169BFF0B">
<kie:width>300</kie:width>
</kie:ComponentWidths>
<kie:ComponentWidths dmnElementRef="_1E70DD3B-4700-4735-BCDF-4FF932010677">
<kie:width>50</kie:width>
<kie:width>100</kie:width>
<kie:width>100</kie:width>
<kie:width>100</kie:width>
</kie:ComponentWidths>
<kie:ComponentWidths dmnElementRef="_36C56A96-3BB4-4C7A-8310-7923F8D577D6">
<kie:width>50</kie:width>
<kie:width>370</kie:width>
</kie:ComponentWidths>
</kie:ComponentsWidthsExtension>
</di:extension>
<dmndi:DMNShape id="dmnshape-drg-_C15FB2B5-BF6B-43B9-B919-5AEBF6D1BC33" dmnElementRef="_C15FB2B5-BF6B-43B9-B919-5AEBF6D1BC33" 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="278" y="304" width="100" height="50"/>
<dmndi:DMNLabel/>
</dmndi:DMNShape>
<dmndi:DMNShape id="dmnshape-drg-_813CC25A-BE37-41B1-8612-3AE364B7DBBB" dmnElementRef="_813CC25A-BE37-41B1-8612-3AE364B7DBBB" 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="278" y="174" width="100" height="50"/>
<dmndi:DMNLabel/>
</dmndi:DMNShape>
<dmndi:DMNShape id="dmnshape-drg-_DA4518B4-3DFD-4C8C-A07A-0266B44C4558" dmnElementRef="_DA4518B4-3DFD-4C8C-A07A-0266B44C4558" 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="459" y="173" width="100" height="50"/>
<dmndi:DMNLabel/>
</dmndi:DMNShape>
<dmndi:DMNEdge id="dmnedge-drg-_90996057-7DA1-4911-BDAC-38B405F1D0D6-AUTO-SOURCE-AUTO-TARGET" dmnElementRef="_90996057-7DA1-4911-BDAC-38B405F1D0D6">
<di:waypoint x="328" y="304"/>
<di:waypoint x="328" y="224"/>
</dmndi:DMNEdge>
<dmndi:DMNEdge id="dmnedge-drg-_2CCFB787-256F-4845-967B-A170D1731CFB-AUTO-TARGET" dmnElementRef="_2CCFB787-256F-4845-967B-A170D1731CFB">
<di:waypoint x="509" y="198"/>
<di:waypoint x="378" y="199"/>
</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