IF Commons GitHub

integrations/pure/export-html

An HTML view of an ontology for people who read it in a browser and not in TypeScript (commons 0019-mizan-integrations FR-010, 0012-ontology): its classes, properties and code lists with their definitions, and the basis of each term, so that the ontology can be read outside TypeScript without a tool. One self-contained page, written deterministically from the data it is given, with its CSS embedded, readable in a light and a dark scheme and at a phone's width.

Every text is escaped. The page says it is generated and from what, and carries the ontology's IRI and version IRI where it has them.

import { exportHtmlView } from "./export-html.ts";
exportHtmlView({ title: "Mizan", iri: "https://x/o", classes: [], properties: [], codeLists: [], terms: [] }, "generated by a tool").startsWith("<!doctype html>"); // true

Source: commons/mizan/src/integrations/pure/export-html.ts

1 of 5 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.

ViewTermtypeno test imports it
type ViewTerm = {
  readonly curie: string;
  readonly label: string;
  readonly definition?: string;
  readonly domain?: string;
  readonly range?: string;
};

What the page shows of a class or a property.

ViewCodeListtypeno test imports it
type ViewCodeList = {
  readonly name: string;
  readonly members: readonly { readonly code: string; readonly label: string; readonly definition?: string }[];
};

What the page shows of a code list: its name and its members.

ViewBasistypeno test imports it
type ViewBasis = {
  readonly curie: string;
  readonly basis: string;
  readonly standardTerm?: string;
  readonly relation?: string;
  readonly justification?: string;
};

What the page shows of the basis of a term.

OntologyViewtypeno test imports it
type OntologyView = {
  readonly title: string;
  readonly iri: string;
  readonly versionIri?: string;
  readonly classes: readonly ViewTerm[];
  readonly properties: readonly ViewTerm[];
  readonly codeLists: readonly ViewCodeList[];
  readonly terms: readonly ViewBasis[];
};

Everything the page is made from.

exportHtmlViewfunction
function exportHtmlView(v: OntologyView, generated: string): string

The ontology as one HTML page; generated says what generated it, as the page's own note.

Imported by 19 tests of the run (19 passed, 0 failed): the library's results

Titles, headings, exports, tables, columns and requirements. Esc closes.