Filip Drools DMN

From Training Material
Jump to navigation Jump to search

DMN⌘

  • Decision Model and Notation
  • OMG Specification (version 1.2 published in January 2019)
  • https://www.omg.org/spec/DMN
  • The purpose of DMN is to provide the constructs that are needed to model decisions, so that organizational decision-making can be readily depicted in diagrams, accurately defined by business analysts, and (optionally) automated.

Decision-making⌘

DMN provides Decision Requirements Diagrams:

  • Business process models will define tasks within business processes where decision-making is required to occur
  • Decision Requirements Diagrams will define the decisions to be made in those tasks, their interrelationships, and their requirements for decision logic
  • Decision logic will define the required decisions in sufficient detail to allow validation and/or automation.

Two levels of modeling decisions⌘

ClipCapIt-140805-154318.PNG

Decision Model and Notation Beta 1, Figure 1: Aspects of modeling

Drools + DMN example

swaager

ClipCapIt-191217-184611.PNG
ClipCapIt-191217-185120.PNG
  • change Parameter content type to application/json
  • Use the Deployment Unit name for a containerid
ClipCapIt-191217-185506.PNG
  • Use name and Namespace from your DMN model
ClipCapIt-191217-185305.PNG
  • paste json request and execute

json request

{
	"model-namespace":"https://kiegroup.org/dmn/_DEF37C97-81DD-490A-8B67-C3FF395D87AE",
	"model-name":"CarRental1",
	"dmn-context":{
		"CarType":"Lux"		
	}
	
}

server response

{
 "type" : "SUCCESS",
 "msg" : "OK from container 'DMNtest_1.0.0-SNAPSHOT'",
 "result" : {
   "dmn-evaluation-result" : {
     "messages" : [ ],
     "model-namespace" : "https://kiegroup.org/dmn/_DEF37C97-81DD-490A-8B67-C3FF395D87AE",
     "model-name" : "CarRental1",
     "decision-name" : [ ],
     "dmn-context" : {
       "CarType" : "Lux",
       "Calculate price" : 200
     },
     "decision-results" : {
       "_DC576EEE-1286-4B82-9112-85EF6F50BF40" : {
         "messages" : [ ],
         "decision-id" : "_DC576EEE-1286-4B82-9112-85EF6F50BF40",
         "decision-name" : "Calculate price",
         "result" : 200,
         "status" : "SUCCEEDED"
       }
     }
   }
 }
}

DMN cheat sheet⌘

File:CheatSheet-DMN-en-EMEA.pdf

Drools & DMN⌘

https://www.drools.org/learn/dmn.html

"Drools DMN engine provides full runtime support for DMN models at Conformance level 3, meaning 100% of the features in the Standard."

https://access.redhat.com/documentation/en-us/red_hat_process_automation_manager/7.2/html/designing_a_decision_service_using_dmn_models/dmn-model-creating-proc_dmn-models