jBPM DMN Explained – Knowledge Source, Knowledge Model, Decision, Decision Service, Input Data & Text Annotation (with Examples)
At the heart of DMN is the Decision Requirements Diagram (DRD), which is built from specific elements:
-
Knowledge Source
-
Knowledge Model (Business Knowledge Model)
-
Decision
-
Decision Service
-
Input Data
-
Text Annotation
This guide explains what each element means, when to use it, and how they work together—with examples and a comparison table.
⭐ 1. DMN Knowledge Source
🔹 What is a Knowledge Source?
A Knowledge Source documents where a decision’s logic comes from.
It represents:
-
Laws and regulations
-
Company policies
-
External standards
-
Expert knowledge
⚠️ Important:
A Knowledge Source does not execute logic. It is documentation only.
🔹 Example
“Loan approval rules are based on RBI guidelines and internal bank policy.”
⭐ 2. DMN Knowledge Model (Business Knowledge Model – BKM)
🔹 What is a Knowledge Model?
A Knowledge Model (BKM) represents reusable decision logic—usually written as a function or expression.
It is used when:
-
Logic is shared across multiple decisions
-
You want modular and reusable rules
🔹 Example
A function to calculate eligibility score:
This function can be reused by multiple decisions.
⭐ 3. DMN Input Data
🔹 What is Input Data?
Input Data represents raw information required to make a decision.
✔ Comes from process variables
✔ Has no logic
✔ Acts as a decision input
🔹 Example
-
Applicant Age
-
Monthly Income
-
Credit Score
⭐ 4. DMN Decision
🔹 What is a Decision?
A Decision is the core executable element in DMN.
It:
-
Uses Input Data
-
May call Knowledge Models (BKMs)
-
Produces an output
🔹 Example – Loan Approval Decision Table
| Credit Score | Income | Decision |
|---|---|---|
| ≥ 750 | ≥ 30000 | APPROVE |
| ≥ 650 | ≥ 20000 | REVIEW |
| < 650 | Any | REJECT |
This decision returns: APPROVE, REVIEW, or REJECT.
⭐ 5. DMN Decision Service
🔹 What is a Decision Service?
A Decision Service groups one or more decisions and exposes them as a single callable unit.
Think of it as:
An API endpoint for decisions
🔹 Why use Decision Services?
✔ Hide internal decision logic
✔ Expose only selected inputs/outputs
✔ Improve reusability and security
🔹 Example
Decision Service: LoanEligibilityService
Inputs:
-
age
-
income
-
creditScore
Outputs:
-
loanDecision
-
riskCategory
⭐ 6. DMN Text Annotation
🔹 What is Text Annotation?
A Text Annotation is a comment or explanation attached to DMN elements.
✔ No execution
✔ Improves readability
✔ Helps auditors and business users
🔹 Example
“Applicants below 650 credit score are rejected as per risk policy v2.1.”
⭐ 7. How These Elements Work Together (Flow)
-
Input Data provides raw values
-
Decision evaluates rules
-
Knowledge Model supplies reusable logic
-
Decision Service exposes decisions
-
Knowledge Source documents authority
-
Text Annotation explains reasoning
⭐ 8. Comparison Table – DMN Elements in jBPM
| DMN Element | Purpose | Executable | Reusable | Example Use |
|---|---|---|---|---|
| Knowledge Source | Documents rule origin | ❌ No | ❌ No | Policy, law reference |
| Knowledge Model (BKM) | Reusable logic | ✅ Yes | ✅ Yes | Score calculation |
| Input Data | Raw inputs | ❌ No | ✅ Yes | Age, Income |
| Decision | Makes decision | ✅ Yes | ❌ Usually No | Approve/Reject |
| Decision Service | Exposes decisions | ✅ Yes | ✅ Yes | Loan API |
| Text Annotation | Documentation | ❌ No | ❌ No | Business explanation |
⭐ 9. Real jBPM Example – Loan Approval
Scenario:
-
BPMN process collects user data
-
jBPM DMN evaluates eligibility
DMN Structure:
-
Input Data → Age, Income, Credit Score
-
Knowledge Model → Risk Score Calculation
-
Decision → Loan Decision
-
Decision Service → LoanEligibilityService
-
Knowledge Source → Bank Policy
-
Text Annotation → Rule explanation
✔ Clean separation of process and decision
✔ Easy to change rules without touching BPMN
⭐ 10. Best Practices for jBPM DMN
✔ Use Knowledge Models for reusable logic
✔ Use Decision Services for integration
✔ Keep Input Data simple and typed
✔ Add Text Annotations for auditability
✔ Reference Knowledge Sources for compliance
✔ Avoid putting complex logic directly in BPMN
✔ Version DMN files carefully
👉 Watch “DMN” in Action:
A live demo showing all components of DMN:
🎬 YouTube: Learn IT with Shikha video 1
🎬 YouTube: Learn IT with Shikha video 2
👉 Source code: LearnITWithShikha/DMNExamples
🎉 Conclusion
jBPM DMN provides a powerful, structured, and business-friendly way to model decisions.
-
Knowledge Source → Why rules exist
-
Knowledge Model → Reusable logic
-
Decision → Final outcome
-
Decision Service → Decision API
-
Input Data → Facts
-
Text Annotation → Explanation
Used together, these elements create maintainable, auditable, and scalable decision models that integrate seamlessly with BPMN workflows.
💼 Professional Support Available
If you are facing issues in real projects related to enterprise backend development or workflow automation, I provide paid consulting, production debugging, project support, and focused trainings.
Technologies covered include Java, Spring Boot, PL/SQL, Azure, and workflow automation (jBPM, Camunda BPM, RHPAM).
📧 Contact: ishikhanirankari@gmail.com | info@realtechnologiesindia.com
🌐 Website: IT Trainings | Digital metal podium
Comments
Post a Comment