Boxic.DMN.Authoring.DecisionTable (boxic_dmn v0.2.0)

Copy Markdown View Source

Immutable, ID-based editing operations for normalized decision tables.

Operations that add, remove, or move clauses update every rule at the same position so table arity remains structurally valid.

Summary

Functions

Adds an input clause and inserts :entry_text into every existing rule.

Adds an output clause and inserts :entry_text into every existing rule.

Adds a structurally complete rule at :position or at the end.

Moves an input clause and the corresponding entry in every rule.

Moves an output clause and the corresponding entry in every rule.

Moves a rule to a zero-based position.

Replaces one input entry, locating the decision, rule, and input by stable ID.

Replaces one output entry, locating the decision, rule, and output by stable ID.

Removes an input clause and its corresponding entry from every rule.

Removes an output clause and its corresponding entry from every rule.

Removes a rule by stable ID.

Changes the hit policy and validates any COLLECT aggregation.

Replaces an input clause with the same stable ID.

Replaces an output clause with the same stable ID.

Replaces an existing rule with the same stable ID after checking its arity.

Types

result()

@type result() :: {:ok, Boxic.DMN.Model.t()} | {:error, Boxic.DMN.AuthoringError.t()}

Functions

add_input(model, decision_id, input, opts \\ [])

Adds an input clause and inserts :entry_text into every existing rule.

The clause is appended unless a zero-based :position is supplied.

add_output(model, decision_id, output, opts \\ [])

Adds an output clause and inserts :entry_text into every existing rule.

The clause is appended unless a zero-based :position is supplied.

add_rule(model, decision_id, rule, opts \\ [])

Adds a structurally complete rule at :position or at the end.

move_input(model, decision_id, input_id, position)

@spec move_input(Boxic.DMN.Model.t(), String.t(), String.t(), non_neg_integer()) ::
  result()

Moves an input clause and the corresponding entry in every rule.

move_output(model, decision_id, output_id, position)

@spec move_output(Boxic.DMN.Model.t(), String.t(), String.t(), non_neg_integer()) ::
  result()

Moves an output clause and the corresponding entry in every rule.

move_rule(model, decision_id, rule_id, position)

@spec move_rule(Boxic.DMN.Model.t(), String.t(), String.t(), non_neg_integer()) ::
  result()

Moves a rule to a zero-based position.

put_input_entry(model, opts)

@spec put_input_entry(
  Boxic.DMN.Model.t(),
  keyword()
) :: result()

Replaces one input entry, locating the decision, rule, and input by stable ID.

put_output_entry(model, opts)

@spec put_output_entry(
  Boxic.DMN.Model.t(),
  keyword()
) :: result()

Replaces one output entry, locating the decision, rule, and output by stable ID.

remove_input(model, decision_id, input_id)

@spec remove_input(Boxic.DMN.Model.t(), String.t(), String.t()) :: result()

Removes an input clause and its corresponding entry from every rule.

remove_output(model, decision_id, output_id)

@spec remove_output(Boxic.DMN.Model.t(), String.t(), String.t()) :: result()

Removes an output clause and its corresponding entry from every rule.

remove_rule(model, decision_id, rule_id)

@spec remove_rule(Boxic.DMN.Model.t(), String.t(), String.t()) :: result()

Removes a rule by stable ID.

set_hit_policy(model, decision_id, hit_policy, aggregation \\ nil)

@spec set_hit_policy(Boxic.DMN.Model.t(), String.t(), String.t(), String.t() | nil) ::
  result()

Changes the hit policy and validates any COLLECT aggregation.

update_input(model, decision_id, input)

Replaces an input clause with the same stable ID.

update_output(model, decision_id, output)

Replaces an output clause with the same stable ID.

update_rule(model, decision_id, rule)

Replaces an existing rule with the same stable ID after checking its arity.