jBPM DMN Explained – Knowledge Source, Knowledge Model, Decision, Decision Service, Input Data & Text Annotation (with Examples)

DMN (Decision Model and Notation) in jBPM is used to model and automate business decisions in a clear, auditable, and business-friendly way.

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:

calculateScore(income, age) = (income / 1000) + (age * 2)

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

Input Data: - age : number - income : number - creditScore : number

⭐ 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 ScoreIncomeDecision
≥ 750≥ 30000APPROVE
≥ 650≥ 20000REVIEW
< 650AnyREJECT

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)

  1. Input Data provides raw values

  2. Decision evaluates rules

  3. Knowledge Model supplies reusable logic

  4. Decision Service exposes decisions

  5. Knowledge Source documents authority

  6. Text Annotation explains reasoning


⭐ 8. Comparison Table – DMN Elements in jBPM

DMN ElementPurposeExecutableReusableExample Use
Knowledge SourceDocuments rule origin❌ No❌ NoPolicy, law reference
Knowledge Model (BKM)Reusable logic✅ Yes✅ YesScore calculation
Input DataRaw inputs❌ No✅ YesAge, Income
DecisionMakes decision✅ Yes❌ Usually NoApprove/Reject
Decision ServiceExposes decisions✅ Yes✅ YesLoan API
Text AnnotationDocumentation❌ No❌ NoBusiness 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 SourceWhy rules exist

  • Knowledge ModelReusable logic

  • DecisionFinal outcome

  • Decision ServiceDecision API

  • Input DataFacts

  • Text AnnotationExplanation

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).


Comments

Popular posts from this blog

jBPM Installation Guide: Step by Step Setup

Scopes of Signal in jBPM

OOPs Concepts in Java | English | Object Oriented Programming Explained