IF Commons GitHub

integrations/pure/export-owl

The OWL 2 writer (commons 0019-mizan-integrations FR-017): an ontology's classes and properties as OWL 2 in functional syntax, as text, deterministically, so that an OWL tool (the OWL API, ROBOT, Protege) reads the vocabulary and a generated file can be checked for staleness.

Only what the typed schemas can state is written: a declaration of each class, object property and data property, SubClassOf, the domain and the range of a property, and the annotations rdfs:label, rdfs:comment and skos:definition (and, of the ontology, its label, description, version information and version IRI). The classes and the datatypes that a class or a property names and the ontology does not define (dcterms:Standard) are declared too, as OWL 2 asks of every entity an axiom uses; the datatypes of OWL 2's datatype map (xsd:string, xsd:integer, xsd:boolean) are not. Entities and axioms are in the order of their IRIs, so the same ontology gives the same bytes. What the ontology states and OWL cannot hold in this form, a datatype property whose range is a class or an object property whose range is a datatype, is a finding.

import { exportOwl } from "./export-owl.ts";
exportOwl({ iri: "https://x/o", prefixes: [], classes: [{ iri: "https://x/o#A", subClassOf: [] }], properties: [] }); // { kind: "ok", value: "Prefix(...)...Ontology(<https://x/o>...)" }

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

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

integrations.exportOwlfunctionno test imports it
function exportOwl(o: OwlOntologyInput): Result<string, readonly string[]>

The ontology as OWL 2 functional syntax, or what it states that OWL cannot hold in this form, one sentence each.

integrations.OwlClassInputtypeno test imports it
type OwlClassInput = {
  readonly iri: string;
  readonly label?: OwlText;
  readonly comment?: OwlText;
  readonly definition?: OwlText;
  readonly subClassOf: readonly string[];
};

A class the ontology defines.

integrations.OwlOntologyInputtypeno test imports it
type OwlOntologyInput = { readonly iri: string; readonly versionIri?: string; readonly label?: OwlText; readonly… (818 characters)
type OwlOntologyInput = {
  readonly iri: string;
  readonly versionIri?: string;
  readonly label?: OwlText;
  readonly description?: OwlText;
  readonly versionInfo?: string;
  /** The ontology's title (`dcterms:title`), which a quality report such as ROBOT's asks for. */
  readonly title?: string;
  /** The IRI of the ontology's license (`dcterms:license`). */
  readonly license?: string;
  /** Prefixes to declare, besides `owl`, `rdf`, `rdfs`, `xsd`, `skos` and `dcterms`, which are always declared as their standard IRIs. */
  readonly prefixes: readonly { readonly prefix: string; readonly iri: string }[];
  readonly classes: readonly OwlClassInput[];
  readonly properties: readonly OwlPropertyInput[];
  /** A comment for the head of the file, one line each. */
  readonly comments?: readonly string[];
};

Everything the document is made from.

integrations.OwlPropertyInputtypeno test imports it
type OwlPropertyInput = {
  readonly iri: string;
  readonly kind: "object" | "datatype";
  readonly label?: OwlText;
  readonly comment?: OwlText;
  readonly definition?: OwlText;
  readonly domain?: string;
  readonly range?: string;
};

A property the ontology defines: of objects (its range is a class) or of data (its range is a datatype).

integrations.OwlTexttypeno test imports it
type OwlText = { readonly value: string; readonly language?: string };

A text with its language, as an annotation's value.

exportOwlfunction
function exportOwl(o: OwlOntologyInput): Result<string, readonly string[]>

The ontology as OWL 2 functional syntax, or what it states that OWL cannot hold in this form, one sentence each.

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

OwlClassInputtypeno test imports it
type OwlClassInput = {
  readonly iri: string;
  readonly label?: OwlText;
  readonly comment?: OwlText;
  readonly definition?: OwlText;
  readonly subClassOf: readonly string[];
};

A class the ontology defines.

OwlOntologyInputtypeno test imports it
type OwlOntologyInput = { readonly iri: string; readonly versionIri?: string; readonly label?: OwlText; readonly… (818 characters)
type OwlOntologyInput = {
  readonly iri: string;
  readonly versionIri?: string;
  readonly label?: OwlText;
  readonly description?: OwlText;
  readonly versionInfo?: string;
  /** The ontology's title (`dcterms:title`), which a quality report such as ROBOT's asks for. */
  readonly title?: string;
  /** The IRI of the ontology's license (`dcterms:license`). */
  readonly license?: string;
  /** Prefixes to declare, besides `owl`, `rdf`, `rdfs`, `xsd`, `skos` and `dcterms`, which are always declared as their standard IRIs. */
  readonly prefixes: readonly { readonly prefix: string; readonly iri: string }[];
  readonly classes: readonly OwlClassInput[];
  readonly properties: readonly OwlPropertyInput[];
  /** A comment for the head of the file, one line each. */
  readonly comments?: readonly string[];
};

Everything the document is made from.

OwlPropertyInputtypeno test imports it
type OwlPropertyInput = {
  readonly iri: string;
  readonly kind: "object" | "datatype";
  readonly label?: OwlText;
  readonly comment?: OwlText;
  readonly definition?: OwlText;
  readonly domain?: string;
  readonly range?: string;
};

A property the ontology defines: of objects (its range is a class) or of data (its range is a datatype).

OwlTexttypeno test imports it
type OwlText = { readonly value: string; readonly language?: string };

A text with its language, as an annotation's value.

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