IF Commons GitHub

integrations/pure/export-dcat

The DCAT writer (commons 0019-mizan-integrations FR-018): a catalog of the ontologies a repository publishes, each a dcat:Dataset with the files generated from it as dcat:Distributions (their title, media type and download URL, and the license), as DCAT 3 in canonical Turtle, so that a data portal or a harvester finds the ontology and every form of it without reading the repository.

Written with the kernel's Turtle writer, so the same catalog gives the same bytes. The IRIs of the catalog's entries are made from the catalog's IRI: a dataset <catalog>#dataset-<id> and a distribution <catalog>#distribution-<id>-<file name>. A media type is written as its IANA URI (https://www.iana.org/assignments/media-types/text/turtle) for dcat:mediaType and dcterms:format, as DCAT 3 recommends, and the media type's text is not repeated. The ontology's own IRI and version are the dataset's dcterms:identifier and dcat:version. There is no date, as a date would make the same catalog different by the day.

import { exportDcat } from "./export-dcat.ts";
exportDcat({ iri: "https://x/catalog", title: "C", license: "https://x/l", publisher: { iri: "https://x/", name: "X" }, downloadBase: "https://x/files/", datasets: [] }); // { kind: "ok", value: "...a dcat:Catalog..." }

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

3 of 8 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.DcatCatalogInputtypeno test imports it
type DcatCatalogInput = { readonly iri: string; readonly title: string; readonly description?: string; /** The I… (485 characters)
type DcatCatalogInput = {
  readonly iri: string;
  readonly title: string;
  readonly description?: string;
  /** The IRI of the license of the catalog and of what it lists. */
  readonly license: string;
  readonly publisher: { readonly iri: string; readonly name: string };
  /** The URL a file's path is added to, for its download URL; it ends in `/`. */
  readonly downloadBase: string;
  readonly datasets: readonly DcatDatasetInput[];
  readonly comments?: readonly string[];
};

A catalog of the ontologies a repository publishes.

integrations.DcatDatasetInputtypeno test imports it
type DcatDatasetInput = {
  /** What makes the dataset's IRI (`mizan`). */
  readonly id: string;
  /** The ontology's IRI. */
  readonly ontologyIri: string;
  readonly versionInfo?: string;
  readonly title: string;
  readonly description?: string;
  readonly distributions: readonly DcatDistributionInput[];
};

One published ontology and the files generated from it.

integrations.DcatDistributionInputtypeno test imports it
type DcatDistributionInput = { /** The file's path below the download base (`generated/mizan.auto.ttl`). */ readonly… (406 characters)
type DcatDistributionInput = {
  /** The file's path below the download base (`generated/mizan.auto.ttl`). */
  readonly file: string;
  readonly title: string;
  readonly description?: string;
  /** The IANA media type, `text/turtle`. */
  readonly mediaType: string;
  /** The IRI of a specification the file conforms to (the SHACL recommendation for a shapes file). */
  readonly conformsTo?: string;
};

One file generated from an ontology.

integrations.exportDcatfunctionno test imports it
function exportDcat(c: DcatCatalogInput): Result<string, readonly string[]>

The catalog as DCAT 3 Turtle, or what stops it (an IRI that does not parse, a media type that is not one), one sentence each.

DcatCatalogInputtype
type DcatCatalogInput = { readonly iri: string; readonly title: string; readonly description?: string; /** The I… (485 characters)
type DcatCatalogInput = {
  readonly iri: string;
  readonly title: string;
  readonly description?: string;
  /** The IRI of the license of the catalog and of what it lists. */
  readonly license: string;
  readonly publisher: { readonly iri: string; readonly name: string };
  /** The URL a file's path is added to, for its download URL; it ends in `/`. */
  readonly downloadBase: string;
  readonly datasets: readonly DcatDatasetInput[];
  readonly comments?: readonly string[];
};

A catalog of the ontologies a repository publishes.

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

DcatDatasetInputtype
type DcatDatasetInput = {
  /** What makes the dataset's IRI (`mizan`). */
  readonly id: string;
  /** The ontology's IRI. */
  readonly ontologyIri: string;
  readonly versionInfo?: string;
  readonly title: string;
  readonly description?: string;
  readonly distributions: readonly DcatDistributionInput[];
};

One published ontology and the files generated from it.

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

DcatDistributionInputtypeno test imports it
type DcatDistributionInput = { /** The file's path below the download base (`generated/mizan.auto.ttl`). */ readonly… (406 characters)
type DcatDistributionInput = {
  /** The file's path below the download base (`generated/mizan.auto.ttl`). */
  readonly file: string;
  readonly title: string;
  readonly description?: string;
  /** The IANA media type, `text/turtle`. */
  readonly mediaType: string;
  /** The IRI of a specification the file conforms to (the SHACL recommendation for a shapes file). */
  readonly conformsTo?: string;
};

One file generated from an ontology.

exportDcatfunction
function exportDcat(c: DcatCatalogInput): Result<string, readonly string[]>

The catalog as DCAT 3 Turtle, or what stops it (an IRI that does not parse, a media type that is not one), one sentence each.

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

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