IF Commons GitHub

publish-ontology

Publish a typed ontology (commons 0019-mizan-integrations FR-010 to FR-019): one function that makes every file an ontology of Intellectual Frontiers is published as, from the typed values it is written in, so that Mizan's own ontology and each ontology a specification of commons defines (IFCCM, IFQS, IFR) are published the same way.

An ontology is described once, as an OntologyPublication; publishedFiles returns its files by path from commons' folder: canonical Turtle, RDF/XML, OWL 2 functional syntax, SHACL shapes, a JSON Schema, SKOS concept schemes and SQL tables for its code lists, SSSOM mappings to the standards it maps to, and an HTML view. Nothing here reads or writes a file: generate-ontology.ts does.

Spec: 0001-libraries FR-008

Source: commons/libraries/src/publish-ontology.ts

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

ExportRefusedclassno test imports it
class ExportRefused extends Error

The text of an exporter's result, or a thrown sentence naming what the ontology states that the form cannot hold.

MemberTypeWhat it is
namestring
messagestring
stack?string
cause?unknown
CodeListLiketypeno test imports it
type CodeListLike = Parameters<typeof membersOf>[0];

A code list as membersOf reads it.

listsOffunctionno test imports it
function listsOf(prefix: string, lists: readonly (readonly [string, Readonly<Record<string, { readonly values: { readonly label: { readonly value: string; }; readonly definition?: { readonly value: string; } | undefined; }; }>>])[]): readonly CodeListPublication[]

The code lists of an ontology, each by the name of its class, as the publication reads them: its SKOS scheme and its SQL table are named after it.

CodeListPublicationtypeno test imports it
type CodeListPublication = { readonly name: string; readonly table: string; readonly members: readonly CodeMember[] };

One code list of an ontology, with the name its SKOS scheme and its SQL table go by.

OntologyPublicationtypeno test imports it
type OntologyPublication = { /** The name its files go by: `generated/<name>.auto.ttl`, `generated/<name>-shapes.auto.… (2317 characters)
type OntologyPublication = {
  /** The name its files go by: `generated/<name>.auto.ttl`, `generated/<name>-shapes.auto.ttl`, and so on. */
  readonly name: string;
  /** The ontology's namespace IRI (ending in `#`) and the prefix it goes by. */
  readonly ns: { readonly prefix: string; readonly iri: string };
  /** The namespace of its individuals, which an SSSOM file declares as a prefix too. */
  readonly idNs: { readonly prefix: string; readonly iri: string };
  /** The prefixes a CURIE is made with in the HTML view, longest namespace first is not required: the first that matches wins. */
  readonly curies: readonly (readonly [string, string])[];
  /** The ontology's files of typed individuals. */
  readonly files: readonly OntologyFile[];
  /** The ontology's own header individual (`owl:Ontology`): its label, description, version information and version IRI. */
  readonly ontology: {
    readonly values: {
      readonly label?: Lang | undefined;
      readonly description?: Lang | undefined;
      readonly versionInfo?: string | undefined;
      readonly versionIri?: { readonly iri: string } | undefined;
    };
  };
  readonly classes: readonly EntityLike[];
  readonly properties: readonly PropertyLike[];
  /** The audit records of the terms (Mizan's own and, for Mizan, the packaging ontology's), which give the HTML view its bases and SSSOM its mappings. */
  readonly terms: readonly TermLike[];
  /** The shapes and schemas: the class schemas of the data the ontology holds. */
  readonly schemas: readonly AnySchema[];
  readonly lists: readonly CodeListPublication[];
  /** Where it is generated from, for the header comment: `commons/ontology/<name>/*.ts`. */
  readonly source: string;
  /** The command that writes the files again. */
  readonly run: string;
  /** The IRI of the SHACL shapes and of the JSON Schema, the SSSOM set and the prefix the shapes use. */
  readonly shapes: { readonly prefix: string; readonly iri: string };
  readonly schemasIri: string;
  readonly sssomSetId: string;
  /** Prefix to namespace pairs the SSSOM file declares besides the ontology's own. */
  readonly sssomCuries: Readonly<Record<string, string>>;
  /** The title of the HTML view. */
  readonly viewTitle: string;
  /** The license of the files: an IRI. */
  readonly license: string;
};

Everything an ontology is published from.

CC0constno test imports it
const CC0: "https://creativecommons.org/publicdomain/zero/1.0/"

The default license of what Intellectual Frontiers publishes as ontologies: CC0.

pathOffunctionno test imports it
function pathOf(name: string, suffix: string): string

The path of a generated file of an ontology, from commons' folder: generated/<name><suffix>.

distributionsOffunctionno test imports it
function distributionsOf(name: string, title: string): readonly { readonly file: string; readonly title: string; readonly mediaType: string; readonly conformsTo?: string | undefined; }[]

The files of an ontology, with their title, media type and what they conform to: its DCAT distributions (0019-mizan-integrations FR-018).

publishedFilesfunctionno test imports it
function publishedFiles(p: OntologyPublication): Promise<ReadonlyMap<string, string>>

Every file of an ontology (but its DCAT catalog entry, which generate-ontology.ts writes for them all), by its path from commons' folder.

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