ScratchyDisk.DmnEngine
2.2.0
dotnet add package ScratchyDisk.DmnEngine --version 2.2.0
NuGet\Install-Package ScratchyDisk.DmnEngine -Version 2.2.0
<PackageReference Include="ScratchyDisk.DmnEngine" Version="2.2.0" />
<PackageVersion Include="ScratchyDisk.DmnEngine" Version="2.2.0" />
<PackageReference Include="ScratchyDisk.DmnEngine" />
paket add ScratchyDisk.DmnEngine --version 2.2.0
#r "nuget: ScratchyDisk.DmnEngine, 2.2.0"
#:package ScratchyDisk.DmnEngine@2.2.0
#addin nuget:?package=ScratchyDisk.DmnEngine&version=2.2.0
#tool nuget:?package=ScratchyDisk.DmnEngine&version=2.2.0
ScratchyDisk.DmnEngine
A .NET rule engine that executes decisions defined in DMN (Decision Model and Notation) models. It evaluates decision tables, expression decisions, boxed expressions, business knowledge models and decision services from OMG-standard DMN XML files (versions 1.1, 1.3, 1.3ext, 1.4, 1.5 and 1.6), or from definitions built programmatically using a fluent API.
Expressions are evaluated using a full FEEL (Friendly Enough Expression Language) interpreter built on ANTLR4, supporting the complete expression language including if/then/else, for/in/return, quantifiers, list/context operations, ranges, and ~80 built-in functions.
Quick Start
var def = DmnParser.Parse(fileName);
var ctx = DmnExecutionContextFactory.CreateExecutionContext(def);
ctx.WithInputParameter("input name", inputValue);
var result = ctx.ExecuteDecision("decision name");
You can also create definitions programmatically using the DmnDefinitionBuilder fluent API instead of parsing DMN XML.
Key Features
- Full FEEL evaluator with ANTLR4 grammar, including first-class functions and declared-type conformance
- DMN 1.1 through 1.6 with auto-detection
- All standard decision table hit policies
- Boxed decision logic: contexts, relations, lists, invocations, conditionals, iterations, filters and nested decision tables
- Business knowledge models and decision services, invokable from expressions or directly
- DMN imports resolved across a folder of models (
DmnModelSet) - Decision requirement graphs (DRDs) with automatic dependency resolution
- Fluent builder API for programmatic definitions
- CLR interop from FEEL expressions
- Expression caching with configurable scope
- Thread-safe immutable definitions
- OMG DMN TCK runner with a committed conformance baseline
Documentation
Full documentation, architecture details, and tools (web-based testbed, CLI runner, TCK runner) are available in the readme at the GitHub repository. Conformance status and the baseline workflow are documented in docs/tck.md, and multi-model loading in docs/model-sets.md.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Antlr4.Runtime.Standard (>= 4.13.1)
- NLog (>= 6.2.2)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
# ScratchyDisk.DmnEngine 2.2.0
This is the first published release since 2.0.1 and includes all of 2.1.0.
## DMN 1.6
- DMN 1.6 models are supported through the `20240513/MODEL/` namespace and the `Parse16`/`ParseString16` entry points.
- FEEL 1.6 additions: descendant expressions (`...`), temporal `.value`, single-parameter rounding, `date and time(date, time, timezone)`, exponential and leading-dot numeric literals, and decimal-to-integer conversion.
- DMN 1.6 diagnostics are lenient by default, with an opt-in strict mode.
- FEEL 1.5 gaps are closed: `list replace`, `range(string)` and range expressions, `overlaps before/after`, temporal and range properties, IANA timezone strings, and corrected `round half down` / `decimal` rounding.
## Decisions and expressions
- Decision services and business knowledge models are first-class FEEL values: they can be invoked positionally or with named arguments, returned, passed as arguments and invoked again.
- Declared FEEL types are enforced on decisions, decision-table outputs, knowledge-model parameters/results and decision-service parameters/results, including item definitions and collections. A non-conforming value raises a DMN evaluation error instead of being silently coerced.
- Decision and knowledge-model bodies may be a context, relation, list, invocation or decision table, including nested tables and function definitions inside context entries.
- Decision-table input entries fall back to the full FEEL grammar, so Camunda-style `and`/`or` expressions work.
- FEEL names containing `-` resolve inside table expressions, and context keys may be quoted or contain spaces, operators and emoji.
## Imports and model sets
- `DmnModelSet` indexes a folder of DMN files by namespace and model name, so `import` elements resolve across files.
- Imported models are flattened with deterministic `mN.` prefixes and per-element aliases; import-qualified references in expressions, type references and knowledge requirements resolve to the flattened model.
- Input parameters named with an import namespace bind to the flattened model element.
## Reliability
- Iteration is bounded. Fractional range endpoints are an evaluation error, and `for`/`some`/`every`/boxed iteration stop with a clear error at `FeelEvaluationLimits.MaxIterationItems` (default 1,000,000) instead of exhausting memory.
- A nested decision table with the `ANY` hit policy rejects rules whose outputs disagree.
- Allowed output values are compared with invariant formatting, so `PRIORITY` and `OUTPUT ORDER` results do not depend on machine culture.
- DMN XML is read with DTD processing prohibited and no external resolver.
- `COLLECT LIST` results are visible to dependent decisions under the decision name, and `string(null)` propagates null.
## Tooling
- A DMN TCK conformance runner executes the OMG suite at a pinned commit and compares the results against a committed ratchet baseline.
- The test bed client uses Nuxt 4 and Vue 3.5.
- Runtime dependencies: Antlr4.Runtime.Standard 4.13.1 and NLog 6.2.2.