# dmn v0.1.0 - API Reference

## Modules

- [Dmn](Dmn.md): A DMN engine built on the FEEL library.
- [Dmn.Compiled](Dmn.Compiled.md): A compiled model: what `Dmn.compile/2` makes of a `Dmn.Model`, and what `Dmn.evaluate/4` runs.
- [Dmn.Compiler](Dmn.Compiler.md): Compiles a `Dmn.Model` to a `Dmn.Compiled`: a prepared FEEL expression for each element of the decision requirements graph, and the
plan that says what each reads.
- [Dmn.Compiler.Box](Dmn.Compiler.Box.md): The boxed expression that a part of a unit came from: what the source map (`Dmn.Compiler.Source`) knows of a range of the
virtual source besides the element and the place in it.
- [Dmn.Compiler.Checks](Dmn.Compiler.Checks.md): What the types of FEEL can say of a decision table before it runs (`Feel.Rules`).
- [Dmn.Compiler.Env](Dmn.Compiler.Env.md): What the compiler knows while it builds the syntax tree of one unit: the model, the types of its item definitions, and the names
that are in scope where it is.
- [Dmn.Compiler.Expression](Dmn.Compiler.Expression.md): Maps a boxed expression to a syntax tree of FEEL (DMN 1.6, 10.2.2: boxed expressions "can be mapped to FEEL text").
- [Dmn.Compiler.Fragment](Dmn.Compiler.Fragment.md): A text of the model, parsed as FEEL and put in the source of the unit.
- [Dmn.Compiler.Rename](Dmn.Compiler.Rename.md): Renames the reads of a name in a syntax tree of FEEL, where the tree reads it from outside.
- [Dmn.Compiler.Source](Dmn.Compiler.Source.md): The text that a unit is prepared from, and where each part of it came from.
- [Dmn.Compiler.Table](Dmn.Compiler.Table.md): Maps a decision table to its node of FEEL's syntax tree (DMN 1.6, clause 8; `Feel.AST`, "Decision tables").
- [Dmn.Compiler.Tree](Dmn.Compiler.Tree.md): The nodes of `Feel.AST` that the compiler builds, so that the code that maps a boxed expression says what it maps to and not how
a tuple is made.
- [Dmn.Compiler.Types](Dmn.Compiler.Types.md): The types of a model, as FEEL has them: the item definitions read into a `Feel.ItemDefinitions` (DMN 1.6, 7.3.3), and from them
the type, the allowed values and the type constraints of every variable (`Feel.ItemDefinitions.scope/2`).
- [Dmn.Compiler.Unit](Dmn.Compiler.Unit.md): The unit of a DRG element: what is prepared of it, and what it reads.
- [Dmn.Diagnostic](Dmn.Diagnostic.md): A report about a model: something found when it was compiled, or when it ran.
- [Dmn.Execution](Dmn.Execution.md): The preflight of a DMN call: what `Dmn.evaluate/4`, `evaluate_all/4`, `invoke/4` and `run/2` copy into their worker.
Internal: not a supported API.
- [Dmn.Extension](Dmn.Extension.md): A set of additions to DMN 1.6 that a caller switches on when it compiles a model (DD-28), as `Feel.Extension` is for FEEL (D-81 of `feel`).
- [Dmn.Extension.Dmn11Types](Dmn.Extension.Dmn11Types.md): The names that DMN 1.1 gave the date and time types (`:dmn_1_1_types`): `dateTime` is `date and time`, `dayTimeDuration` is
`days and time duration` and `yearMonthDuration` is `years and months duration`. DMN 1.2 renamed them to what FEEL calls them, and
`feel` knows only those; the models of the DMN TCK of that time (0007, 0036) still write the old ones.
- [Dmn.Features](Dmn.Features.md): What a caller switches on when it compiles a model, as one option: `features:` (DD-29).
- [Dmn.Imports](Dmn.Imports.md): Reads the models that a model imports, all of them, through the resolver the caller gave (`Dmn.Resolver`).
- [Dmn.Limits](Dmn.Limits.md): The bounds that `dmn` keeps on a model that comes from outside.
- [Dmn.Model](Dmn.Model.md): A DMN model as data: the `Definitions` of DMN 1.6 (clause 6.3.2), read from an XML document by `Dmn.Reader`.
- [Dmn.Model.BusinessKnowledgeModel](Dmn.Model.BusinessKnowledgeModel.md): A `businessKnowledgeModel` (DMN 1.6, 6.3.9): a function, `encapsulated_logic` (a `Dmn.Model.Expressions.FunctionDefinition`),
that decisions and other models invoke by the name of its `variable`.

- [Dmn.Model.Decision](Dmn.Model.Decision.md): A `decision` (DMN 1.6, 6.3.7): its `variable` (the name and the type of its value), the `requirements` it has, and its
decision logic, `expression`, which is any boxed expression or `nil` for none.

- [Dmn.Model.DecisionService](Dmn.Model.DecisionService.md): A `decisionService` (DMN 1.6, 6.3.10): a function whose parameters are `input_data` and `input_decisions`, and whose result
is that of the `output_decisions`, which may be computed from the `encapsulated_decisions`. The lists are references.

- [Dmn.Model.DecisionTable](Dmn.Model.DecisionTable.md): A `decisionTable` (DMN 1.6, clause 8.3).
- [Dmn.Model.DecisionTable.Input](Dmn.Model.DecisionTable.Input.md): An input clause: `expression` is the input expression (a `Dmn.Model.Expressions.LiteralExpression`, with its own
`type_ref`), and `input_values` are the `Dmn.Model.UnaryTests` that the values of the input are expected to satisfy.

- [Dmn.Model.DecisionTable.Output](Dmn.Model.DecisionTable.Output.md): An output clause: `name` (none for the one output of a table that has one), `type_ref`, `output_values` (the allowed outputs,
and their order for the priority policies) and `default_output_entry` (a literal expression).

- [Dmn.Model.DecisionTable.Rule](Dmn.Model.DecisionTable.Rule.md): A rule: `input_entries` (`Dmn.Model.UnaryTests`, one for each input), `output_entries` (`Dmn.Model.Expressions.LiteralExpression`,
one for each output) and `annotation_entries` (texts).

- [Dmn.Model.Expressions](Dmn.Model.Expressions.md): The boxed expressions of DMN 1.6 (clauses 7.3, 8.3 and 10.5): the decision logic of a decision, the encapsulated logic of a
business knowledge model, and what is inside them.
- [Dmn.Model.Expressions.Binding](Dmn.Model.Expressions.Binding.md): A `binding` of an invocation: the `parameter` of the called function, and `expression`, its value.
- [Dmn.Model.Expressions.Conditional](Dmn.Model.Expressions.Conditional.md): A `conditional`: `condition` (`if`), `then`, `otherwise` (`else`), each an expression or `nil`.
- [Dmn.Model.Expressions.Context](Dmn.Model.Expressions.Context.md): A `context`: its `entries`, in the order of the document.
- [Dmn.Model.Expressions.ContextEntry](Dmn.Model.Expressions.ContextEntry.md): A `contextEntry`: the `variable` it binds, and `value`, the expression of it. The entry of a context that has no variable is
the result of the context (DMN 1.6, 10.2.1.4).

- [Dmn.Model.Expressions.Filter](Dmn.Model.Expressions.Filter.md): A `filter`: the list `source` (`in`) and the expression `match` that selects its items.
- [Dmn.Model.Expressions.FunctionDefinition](Dmn.Model.Expressions.FunctionDefinition.md): A `functionDefinition`: `parameters` (the `formalParameter`s) and `body`. `kind` is `:feel`, or the kind of an external
function (`:java`, `:pmml`, `:onnx`), which the engine does not run.

- [Dmn.Model.Expressions.Invocation](Dmn.Model.Expressions.Invocation.md): An `invocation`: `function` is the expression of the called function (a literal expression with the name of a business knowledge
model, a decision service or a function in scope), and `bindings` bind its parameters by name.

- [Dmn.Model.Expressions.Iterator](Dmn.Model.Expressions.Iterator.md): A `for`, `some` or `every` (`kind`): `variable` is the `iteratorVariable`, `source` the expression of `in` (and
`source_type_ref` its `typeRef`), and `body` the expression of `return` (for `for`) or `satisfies` (for the quantifiers).

- [Dmn.Model.Expressions.ListExpression](Dmn.Model.Expressions.ListExpression.md): A `list`: its `items`, expressions, in order.
- [Dmn.Model.Expressions.LiteralExpression](Dmn.Model.Expressions.LiteralExpression.md): A `literalExpression`: `text` is the text of the expression, `nil` for none. `expression_language` is the URI the element
names (`nil` for that of the model). `imported_values` is the `importedValues` element when the text is not there, which
the engine does not read.

- [Dmn.Model.Expressions.Relation](Dmn.Model.Expressions.Relation.md): A `relation`: its `columns` (`Dmn.Model.InformationItem`) and its `rows`, each the list of the values of the columns.
- [Dmn.Model.FunctionItem](Dmn.Model.FunctionItem.md): A `functionItem` (DMN 1.6, 7.3.3): the type of a function, in an item definition. `output_type_ref` is the type of the result,
and `parameters` are the `Dmn.Model.InformationItem`s that the function takes.

- [Dmn.Model.Import](Dmn.Model.Import.md): An `import` (DMN 1.6, 6.3.3): the model with `namespace` is available under `name`. `location_uri` is a hint for a
`Dmn.Resolver` and is never opened by itself. It is a URI reference (RFC 3986): a relative one is resolved against the `base_uri` of the
model that has the import, which is what the resolver is given the importer for. An empty `name` imports into the default namespace
of the importing model.

- [Dmn.Model.InformationItem](Dmn.Model.InformationItem.md): An `InformationItem` (DMN 1.6, 7.3.4): a name with a type. It is the `variable` of a decision, an input data and a business
knowledge model, a parameter of a function, a column of a relation. `type_ref` is the name of a built-in type or of an item
definition, as `Dmn.Reader` normalized it (`Dmn.Reader` says how), or `nil` for no type, which is `Any`.

- [Dmn.Model.InputData](Dmn.Model.InputData.md): An `inputData` (DMN 1.6, 6.3.11): a named input of the model, with its `variable`.
- [Dmn.Model.ItemDefinition](Dmn.Model.ItemDefinition.md): An `itemDefinition` (DMN 1.6, 7.3.3): a type of the model. It has one of a `type_ref` (a built-in type or another item
definition), `components` (a context of them), and a `function_item`; or none of them, which is `Any`. `allowed_values` and
`type_constraint` are `Dmn.Model.UnaryTests`, and `is_collection` makes it a list of the type.

- [Dmn.Model.KnowledgeSource](Dmn.Model.KnowledgeSource.md): A `knowledgeSource` (DMN 1.6, 6.3.12): documentation of where a decision gets its authority. It has no logic.
- [Dmn.Model.Reference](Dmn.Model.Reference.md): A reference to an element: `href="#id"` is an element of the same model, `href="namespace#id"` one of the model with that
namespace, which a model imports (DMN 1.6, 6.3.3). An `id` is an `xsd:ID`, which has no `#`, and a namespace may have one
(`https://example.org/m#v2`), so the `id` is what follows the last `#`.

- [Dmn.Model.Requirement](Dmn.Model.Requirement.md): An information, knowledge or authority requirement (DMN 1.6, 6.3.13 to 6.3.15): `element` is the reference to what is
required, and `kind` says what kind of requirement it is.
- [Dmn.Model.UnaryTests](Dmn.Model.UnaryTests.md): A `UnaryTests` (DMN 1.6, 7.3.2): the text of a list of unary tests, such as the `allowedValues` of an item definition or an
`inputEntry` of a rule. `expression_language` is `nil` for that of the model.

- [Dmn.PreparedCall](Dmn.PreparedCall.md): A decision selected from a compiled model by `Dmn.prepare_call/3`, run with `Dmn.run/2`.
- [Dmn.Reader](Dmn.Reader.md): Reads a DMN model from the element tree of `Dmn.XML` into `Dmn.Model` structs.
- [Dmn.Resolver](Dmn.Resolver.md): How the models that a model imports are found.
- [Dmn.Result](Dmn.Result.md): What `Dmn.evaluate_all/4` gives: the values of the decisions that were asked for, and the diagnostics of every element that was run.
- [Dmn.Run](Dmn.Run.md): Runs a compiled model.
- [Dmn.XML](Dmn.XML.md): Reads an XML document that nobody vouches for.
- [Dmn.XML.Element](Dmn.XML.Element.md): An element of an XML document, as `Dmn.XML` reads it.

- Exceptions
  - [Dmn.Error](Dmn.Error.md): What is wrong with a model, as a value.

