Upgrade to Pro — share decks privately, control downloads, hide ads and more …

[KieLive#11] DMN for Developers, by Guilherme C...

[KieLive#11] DMN for Developers, by Guilherme Carreiro

In this live-stream session you'll learn how DMN works and how you can bring the future of business rules implementation to your application

About this Event

When business decisions get more complex, it's essential to have more eyes revisiting it. However, sometimes the eyes that hold most of the business logic acknowledgment are not the same holding the technical skills for double-checking or even changing the implementation.

In this kind of scenario, the DMN shines as an excellent tool. DMN allows developers and business stakeholders to have a single source of communication and execution. Join us in this live-stream to learn how DMN works and how you can bring the future to your application!

Link to the live streaming: http://red.ht/KieLive11

About the invited speaker:

Guilherme Carreiro, aka karreiro, is part of the KIE team since 2016 and currently the DMN Tooling lead. He's also the author of the learn-dmn-in-15-minutes.com course and frequently presents talks at conferences about his work. If you want to check more about him, he's an old-school-blogger at karreiro.com.

KIE Community

December 08, 2020
Tweet

More Decks by KIE Community

Other Decks in Technology

Transcript

  1. <dmn:definitions xmlns:dmn="http://www.omg.org/spec/DMN/20180521/MODEL/" xmlns="https://kiegroup.org/dmn/_E6FF622D-0C55-43F4-9977-857E17D7AFFA" 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=“_A152369F-877B-4665-AB7E-5EE390DE73D8" name=“a"

    typeLanguage=“http://www.omg.org/spec/DMN/20180521/FEEL/" namespace="https://kiegroup.org/dmn/_E6FF622D-0C55-43F4-9977-857E17D7AFFA"> <dmn:extensionElements/> <dmn:itemDefinition id="_056212A1-BB5A-47FA-9574-EC1762018642" name="AAA" isCollection="false"> <dmn:typeRef>string</dmn:typeRef> </dmn:itemDefinition> <dmn:decision id="_DCE44CA9-CC71-4E38-87A6-6713F9FE8453" name="Decision-1"> <dmn:extensionElements/> <dmn:variable id="_C0ED662E-262E-4CE3-B3F1-B91B0E9D7AB7" name="Decision-1" typeRef="AAA"/> <dmn:literalExpression id="_595FE190-B7DA-44F3-9E76-9032963CD23F"> <dmn:text>"123"</dmn:text> </dmn:literalExpression> </dmn:decision> <dmndi:DMNDI> <dmndi:DMNDiagram id="_1F36C95C-A58A-4904-ACD6-0A882EDEE885" name="DRG"> <di:extension> <kie:ComponentsWidthsExtension> <kie:ComponentWidths dmnElementRef="_595FE190-B7DA-44F3-9E76-9032963CD23F"> <kie:width>300</kie:width> </kie:ComponentWidths> </kie:ComponentsWidthsExtension> </di:extension> <dmndi:DMNShape id="dmnshape-drg-_DCE44CA9-CC71-4E38-87A6-6713F9FE8453" dmnElementRef="_DCE44CA9-CC71-4E38-87A6-6713F9FE8453" isCollapsed="false"> <dmndi:DMNStyle> <dmndi:FillColor red="255" green="255" blue="255"/> <dmndi:StrokeColor red="0" green="0" blue="0"/> Everyone
  2. <dmn:definitions xmlns:dmn="http://www.omg.org/spec/DMN/20180521/MODEL/" xmlns="https://kiegroup.org/dmn/_E6FF622D-0C55-43F4-9977-857E17D7AFFA" 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=“_A152369F-877B-4665-AB7E-5EE390DE73D8" name=“a"

    typeLanguage=“http://www.omg.org/spec/DMN/20180521/FEEL/" namespace="https://kiegroup.org/dmn/_E6FF622D-0C55-43F4-9977-857E17D7AFFA"> <dmn:extensionElements/> <dmn:itemDefinition id="_056212A1-BB5A-47FA-9574-EC1762018642" name="AAA" isCollection="false"> <dmn:typeRef>string</dmn:typeRef> </dmn:itemDefinition> <dmn:decision id="_DCE44CA9-CC71-4E38-87A6-6713F9FE8453" name="Decision-1"> <dmn:extensionElements/> <dmn:variable id="_C0ED662E-262E-4CE3-B3F1-B91B0E9D7AB7" name="Decision-1" typeRef="AAA"/> <dmn:literalExpression id="_595FE190-B7DA-44F3-9E76-9032963CD23F"> <dmn:text>"123"</dmn:text> </dmn:literalExpression> </dmn:decision> <dmndi:DMNDI> <dmndi:DMNDiagram id="_1F36C95C-A58A-4904-ACD6-0A882EDEE885" name="DRG"> <di:extension> <kie:ComponentsWidthsExtension> <kie:ComponentWidths dmnElementRef="_595FE190-B7DA-44F3-9E76-9032963CD23F"> <kie:width>300</kie:width> </kie:ComponentWidths> </kie:ComponentsWidthsExtension> </di:extension> <dmndi:DMNShape id="dmnshape-drg-_DCE44CA9-CC71-4E38-87A6-6713F9FE8453" dmnElementRef="_DCE44CA9-CC71-4E38-87A6-6713F9FE8453" isCollapsed="false"> <dmndi:DMNStyle> <dmndi:FillColor red="255" green="255" blue="255"/> <dmndi:StrokeColor red="0" green="0" blue="0"/> Everyone DMN engine
  3. <dmn:definitions xmlns:dmn="http://www.omg.org/spec/DMN/20180521/MODEL/" xmlns="https://kiegroup.org/dmn/_E6FF622D-0C55-43F4-9977-857E17D7AFFA" 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=“_A152369F-877B-4665-AB7E-5EE390DE73D8" name=“a"

    typeLanguage=“http://www.omg.org/spec/DMN/20180521/FEEL/" namespace="https://kiegroup.org/dmn/_E6FF622D-0C55-43F4-9977-857E17D7AFFA"> <dmn:extensionElements/> <dmn:itemDefinition id="_056212A1-BB5A-47FA-9574-EC1762018642" name="AAA" isCollection="false"> <dmn:typeRef>string</dmn:typeRef> </dmn:itemDefinition> <dmn:decision id="_DCE44CA9-CC71-4E38-87A6-6713F9FE8453" name="Decision-1"> <dmn:extensionElements/> <dmn:variable id="_C0ED662E-262E-4CE3-B3F1-B91B0E9D7AB7" name="Decision-1" typeRef="AAA"/> <dmn:literalExpression id="_595FE190-B7DA-44F3-9E76-9032963CD23F"> <dmn:text>"123"</dmn:text> </dmn:literalExpression> </dmn:decision> <dmndi:DMNDI> <dmndi:DMNDiagram id="_1F36C95C-A58A-4904-ACD6-0A882EDEE885" name="DRG"> <di:extension> <kie:ComponentsWidthsExtension> <kie:ComponentWidths dmnElementRef="_595FE190-B7DA-44F3-9E76-9032963CD23F"> <kie:width>300</kie:width> </kie:ComponentWidths> </kie:ComponentsWidthsExtension> </di:extension> <dmndi:DMNShape id="dmnshape-drg-_DCE44CA9-CC71-4E38-87A6-6713F9FE8453" dmnElementRef="_DCE44CA9-CC71-4E38-87A6-6713F9FE8453" isCollapsed="false"> <dmndi:DMNStyle> <dmndi:FillColor red="255" green="255" blue="255"/> <dmndi:StrokeColor red="0" green="0" blue="0"/> Everyone DMN engine
  4. <dmn:definitions xmlns:dmn="http://www.omg.org/spec/DMN/20180521/MODEL/" xmlns="https://kiegroup.org/dmn/_E6FF622D-0C55-43F4-9977-857E17D7AFFA" 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=“_A152369F-877B-4665-AB7E-5EE390DE73D8" name=“a"

    typeLanguage=“http://www.omg.org/spec/DMN/20180521/FEEL/" namespace="https://kiegroup.org/dmn/_E6FF622D-0C55-43F4-9977-857E17D7AFFA"> <dmn:extensionElements/> <dmn:itemDefinition id="_056212A1-BB5A-47FA-9574-EC1762018642" name="AAA" isCollection="false"> <dmn:typeRef>string</dmn:typeRef> </dmn:itemDefinition> <dmn:decision id="_DCE44CA9-CC71-4E38-87A6-6713F9FE8453" name="Decision-1"> <dmn:extensionElements/> <dmn:variable id="_C0ED662E-262E-4CE3-B3F1-B91B0E9D7AB7" name="Decision-1" typeRef="AAA"/> <dmn:literalExpression id="_595FE190-B7DA-44F3-9E76-9032963CD23F"> <dmn:text>"123"</dmn:text> </dmn:literalExpression> </dmn:decision> <dmndi:DMNDI> <dmndi:DMNDiagram id="_1F36C95C-A58A-4904-ACD6-0A882EDEE885" name="DRG"> <di:extension> <kie:ComponentsWidthsExtension> <kie:ComponentWidths dmnElementRef="_595FE190-B7DA-44F3-9E76-9032963CD23F"> <kie:width>300</kie:width> </kie:ComponentWidths> </kie:ComponentsWidthsExtension> </di:extension> <dmndi:DMNShape id="dmnshape-drg-_DCE44CA9-CC71-4E38-87A6-6713F9FE8453" dmnElementRef="_DCE44CA9-CC71-4E38-87A6-6713F9FE8453" isCollapsed="false"> <dmndi:DMNStyle> <dmndi:FillColor red="255" green="255" blue="255"/> <dmndi:StrokeColor red="0" green="0" blue="0"/> User DMN engine DMN editor in 4 steps
  5. 3 Vioaltion Type String Actual Speed Number Speed Limit Number

    Fine Amount Number Name Number String Driver Age Number Name String Points Number
  6. 3

  7. 3

  8. 3

  9. 4

  10. def create @violation = Violation.new(violation_params) respond_to do |format| if @violation.save

    result = DmnModel.execute(@violation) # Execute via REST API driver = @violation.driver driver.points += result['Fine']['Points'] driver.suspended = result['Should be suspended?'] == 'YES' driver.save! format.html { redirect_to @violation, notice: 'Violation was successfully created.' } else format.html { render :new } end end end
  11. def create @violation = Violation.new(violation_params) respond_to do |format| if @violation.save

    result = DmnModel.execute(@violation) # Execute via REST API driver = @violation.driver driver.points += result['Fine']['Points'] driver.suspended = result['Should be suspended?'] == 'YES' driver.save! format.html { redirect_to @violation, notice: 'Violation was successfully created.' } else format.html { render :new } end end end
  12. <dmn:definitions xmlns:dmn="http://www.omg.org/spec/DMN/20180521/MODEL/" xmlns="https://kiegroup.org/dmn/_E6FF622D-0C55-43F4-9977-857E17D7AFFA" 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=“_A152369F-877B-4665-AB7E-5EE390DE73D8" name=“a"

    typeLanguage=“http://www.omg.org/spec/DMN/20180521/FEEL/" namespace="https://kiegroup.org/dmn/_E6FF622D-0C55-43F4-9977-857E17D7AFFA"> <dmn:extensionElements/> <dmn:itemDefinition id="_056212A1-BB5A-47FA-9574-EC1762018642" name="AAA" isCollection="false"> <dmn:typeRef>string</dmn:typeRef> </dmn:itemDefinition> <dmn:decision id="_DCE44CA9-CC71-4E38-87A6-6713F9FE8453" name="Decision-1"> <dmn:extensionElements/> <dmn:variable id="_C0ED662E-262E-4CE3-B3F1-B91B0E9D7AB7" name="Decision-1" typeRef="AAA"/> <dmn:literalExpression id="_595FE190-B7DA-44F3-9E76-9032963CD23F"> <dmn:text>"123"</dmn:text> </dmn:literalExpression> </dmn:decision> <dmndi:DMNDI> <dmndi:DMNDiagram id="_1F36C95C-A58A-4904-ACD6-0A882EDEE885" name="DRG"> <di:extension> <kie:ComponentsWidthsExtension> <kie:ComponentWidths dmnElementRef="_595FE190-B7DA-44F3-9E76-9032963CD23F"> <kie:width>300</kie:width> </kie:ComponentWidths> </kie:ComponentsWidthsExtension> </di:extension> <dmndi:DMNShape id="dmnshape-drg-_DCE44CA9-CC71-4E38-87A6-6713F9FE8453" dmnElementRef="_DCE44CA9-CC71-4E38-87A6-6713F9FE8453" 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="172" y="154" width="100" height="50"/> <dmndi:DMNLabel/> Thank you! karreiro.com/talks