integrations.AnySchematypeno test imports ittype AnySchema = { readonly class: Named; readonly curie: string; readonly fields: Fields };A class schema as an exporter reads it: the class and its fields, whatever their types.
The first exporters (commons 0019-mizan-integrations FR-010): an ontology's class schemas and code lists written in forms other tools read, as text, deterministically, so that a generated file can be checked for staleness. A JSON Schema for the values of a class, SHACL shapes for its individuals, a SKOS concept scheme and a SQL table for a code list.
A class schema's fields give the shape: a one field is required, an optional one is not, a many one is an array; a plain string, boolean or integer keeps its type, a string that is one of a list of words is an enumeration, a string in a language is an object with its value and language, and a reference is an IRI (the kernel keeps the classes a reference may name for the compiler only, so a shape cannot state them).
import { exportSqlCodeList } from "./export.ts";
exportSqlCodeList("basis", [{ code: "Adopts", label: "adopts" }]); // { kind: "ok", ... } the CREATE TABLE and INSERTintegrations.AnySchematypeno test imports ittype AnySchema = { readonly class: Named; readonly curie: string; readonly fields: Fields };A class schema as an exporter reads it: the class and its fields, whatever their types.
integrations.CodeMembertypeno test imports ittype CodeMember = { readonly code: string; readonly label: string; readonly definition?: string };One member of a code list as the exporters read it.
integrations.exportJsonSchemafunctionno test imports itfunction exportJsonSchema(schema: AnySchema, id?: string | undefined): stringA JSON Schema (2020-12) for the values of a class's individuals, as text: its fields by name, the one fields required, nothing else allowed.
integrations.exportJsonSchemaDefsfunctionno test imports itfunction exportJsonSchemaDefs(schemas: readonly AnySchema[], id: string, comment: string): stringA JSON Schema document whose $defs are the schemas of several classes, by their local names: one file for an ontology's classes.
integrations.exportShaclfunctionno test imports itfunction exportShacl(schemas: readonly AnySchema[], shapes: { readonly prefix: string; readonly iri: string; }): stringSHACL node shapes for class schemas, as Turtle: each class a shape that targets it, each field a named property shape with its path, cardinality and datatype or node kind.
integrations.exportSkosfunctionno test imports itfunction exportSkos(list: { readonly schemeIri: string; readonly label: string; readonly conceptBase: string; readonly members: readonly CodeMember[]; }): stringA SKOS concept scheme for a code list, as Turtle: the scheme, and each member a concept with its notation, label and definition.
integrations.exportSqlCodeListfunctionno test imports itfunction exportSqlCodeList(table: string, members: readonly CodeMember[]): Result<string, readonly IntegrationFinding[]>A SQL table for a code list, as a CREATE TABLE and one INSERT per member in order, or the finding that its name is not one a table may have.
integrations.exportSssomfunctionno test imports itfunction exportSssom(set: { readonly setId: string; readonly license: string; readonly comment?: string | undefined; readonly curies: Readonly<Record<string, string>>; readonly mappings: readonly Mapping[]; }): Result<string, readonly IntegrationFinding[]>The mappings of an ontology as an SSSOM TSV (Simple Standard for Sequential Mappings): the metadata as commented YAML, then one row per mapping, each justified as manual curation, or the finding of an IRI that no prefix of the map shortens.
integrations.Mappingtypeno test imports ittype Mapping = {
readonly subject: string;
readonly relation: "exactMatch" | "closeMatch" | "narrowMatch" | "broadMatch" | "subClassOf" | "subPropertyOf";
readonly object: string;
};One mapping of a term of ours to a term of a standard, as SSSOM publishes it.
AnySchematypetype AnySchema = { readonly class: Named; readonly curie: string; readonly fields: Fields };A class schema as an exporter reads it: the class and its fields, whatever their types.
CodeMembertypeno test imports ittype CodeMember = { readonly code: string; readonly label: string; readonly definition?: string };One member of a code list as the exporters read it.
exportJsonSchemafunctionfunction exportJsonSchema(schema: AnySchema, id?: string | undefined): stringA JSON Schema (2020-12) for the values of a class's individuals, as text: its fields by name, the one fields required, nothing else allowed.
exportJsonSchemaDefsfunctionno test imports itfunction exportJsonSchemaDefs(schemas: readonly AnySchema[], id: string, comment: string): stringA JSON Schema document whose $defs are the schemas of several classes, by their local names: one file for an ontology's classes.
exportShaclfunctionfunction exportShacl(schemas: readonly AnySchema[], shapes: { readonly prefix: string; readonly iri: string; }): stringSHACL node shapes for class schemas, as Turtle: each class a shape that targets it, each field a named property shape with its path, cardinality and datatype or node kind.
exportSkosfunctionfunction exportSkos(list: { readonly schemeIri: string; readonly label: string; readonly conceptBase: string; readonly members: readonly CodeMember[]; }): stringA SKOS concept scheme for a code list, as Turtle: the scheme, and each member a concept with its notation, label and definition.
exportSqlCodeListfunctionfunction exportSqlCodeList(table: string, members: readonly CodeMember[]): Result<string, readonly IntegrationFinding[]>A SQL table for a code list, as a CREATE TABLE and one INSERT per member in order, or the finding that its name is not one a table may have.
exportSssomfunctionfunction exportSssom(set: { readonly setId: string; readonly license: string; readonly comment?: string | undefined; readonly curies: Readonly<Record<string, string>>; readonly mappings: readonly Mapping[]; }): Result<string, readonly IntegrationFinding[]>The mappings of an ontology as an SSSOM TSV (Simple Standard for Sequential Mappings): the metadata as commented YAML, then one row per mapping, each justified as manual curation, or the finding of an IRI that no prefix of the map shortens.
Mappingtypeno test imports ittype Mapping = {
readonly subject: string;
readonly relation: "exactMatch" | "closeMatch" | "narrowMatch" | "broadMatch" | "subClassOf" | "subPropertyOf";
readonly object: string;
};One mapping of a term of ours to a term of a standard, as SSSOM publishes it.