buildMatrixfunctionfunction buildMatrix(model: LayeredModel): MatrixThe matrix of a model: a row for each annotation of each element of its first layer and a cell for each instance.
The matrix of requirement by instance (commons 0033-kanon FR-023): for each annotation of each element of Governance, and for each instance (dialect) of the model, how it ends: expressed, carried or unexpressed with its reason, or dropped where it ends in none (a finding). A typed value, and its two renderings for the documentation lens: Markdown and JSON.
Pure and total. The rows are made from the same reading of the dispositions as the check of dropped annotations (accountOf), so a dropped cell is exactly a kanon/dropped finding. A row is keyed by the element's ElementId and the annotation's name, which are those of the LayeredModel the documentation generator reads, so that a page can link a row to its element. The columns are the model's instances in their order; a model with no instances has no columns and each row has no cells.
import { buildMatrix, matrixMarkdown, type LayeredModel } from "@intellectual-frontiers/kanon";
declare const model: LayeredModel;
matrixMarkdown(buildMatrix(model));buildMatrixfunctionfunction buildMatrix(model: LayeredModel): MatrixThe matrix of a model: a row for each annotation of each element of its first layer and a cell for each instance.
cellTextfunctionno test imports itfunction cellText(cell: Cell): stringThe words of a cell, for a table: expressed (by X), carried (by X), unexpressed: the reason, dropped.
Matrixtypeno test imports ittype Matrix = {
readonly model: string;
readonly instances: readonly InstanceName[];
readonly rows: readonly MatrixRow[];
};The matrix of a model: its instances and the rows.
MatrixCelltypeno test imports ittype MatrixCell = { readonly instance: InstanceName; readonly cell: Cell };One cell of a row: the instance and how the annotation ends for it.
MatrixRowtypeno test imports ittype MatrixRow = {
readonly element: ElementId;
readonly name: string;
readonly annotation: string;
readonly cells: readonly MatrixCell[];
};One row: an annotation of an element of Governance, with a cell for each instance of the matrix, in its order.
matrixJsonfunctionfunction matrixJson(matrix: Matrix): stringThe matrix as JSON text, two spaces to a level and a final newline: the matrix is plain data, so this is the value itself.
matrixMarkdownfunctionfunction matrixMarkdown(matrix: Matrix): stringThe matrix as a Markdown table, for the documentation lens: one row for each annotation, one column for each instance, then a line of totals.
matrixTotalsfunctionfunction matrixTotals(matrix: Matrix): Readonly<Record<"carried" | "dropped" | "expressed" | "unexpressed", number>>How many cells end each way: a registry with an entry for every outcome.