Turns an explain map — the decision from evaluate, or a single check's
from stroopwafel.datalog/eval-check — into nodes and edges. Pure data
transformation — no authorization logic.
Nodes:
:decision — the result and its reason (the root of a decision),
plus the :error when a limit or an arity mismatch
denied before any check ran:check — a check, with its block and result:policy — an evaluated policy: index, id, effect, result:fact — a fact, with its origin sets and whether a block stated it:derivation — one rule application: rule, block, the origin set it
produced, and bindings:missing-fact — the query of a check that found no matchEdges:
:check → check, decision :policy → policy:because / :rejected-by / :missing → fact:because → fact:derived-by → derivation:uses → fact (the facts the rule body matched)Each fact is one node however many paths reach it, so circular
derivations (:explain? :all) show up as edges back to an existing node.
A derivation node keeps one rule application's premises together, so two
derivations of the same fact stay distinct.
Turns an explain map — the decision from `evaluate`, or a single check's
from `stroopwafel.datalog/eval-check` — into nodes and edges. Pure data
transformation — no authorization logic.
Nodes:
- `:decision` — the result and its reason (the root of a decision),
plus the `:error` when a limit or an arity mismatch
denied before any check ran
- `:check` — a check, with its block and result
- `:policy` — an evaluated policy: index, id, effect, result
- `:fact` — a fact, with its origin sets and whether a block stated it
- `:derivation` — one rule application: rule, block, the origin set it
produced, and bindings
- `:missing-fact` — the query of a check that found no match
Edges:
- decision `:check` → check, decision `:policy` → policy
- check `:because` / `:rejected-by` / `:missing` → fact
- matched policy `:because` → fact
- fact `:derived-by` → derivation
- derivation `:uses` → fact (the facts the rule body matched)
Each fact is one node however many paths reach it, so circular
derivations (`:explain? :all`) show up as edges back to an existing node.
A derivation node keeps one rule application's premises together, so two
derivations of the same fact stay distinct.(explain->graph explain)Converts an explain map — a decision or a single check — into a graph.
The resulting graph contains:
|||
|:-|:-
|:root | root node id
|:nodes | map of node-id -> node
|:edges | list of directed edges with semantic labels.
Converts an explain map — a decision or a single check — into a graph. The resulting graph contains: ||| |:-|:- |`:root` | root node id |`:nodes` | map of node-id -> node |`:edges` | list of directed edges with semantic labels.
(next-node-id counter)Returns a tuple of:
[node-id next-counter]
Node ids are deterministic keywords (:n1, :n2, ...).
Returns a tuple of: ```clojure [node-id next-counter] ``` Node ids are deterministic keywords (:n1, :n2, ...).
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |