diff --git a/README.md b/README.md index e431246..7d290d0 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,35 @@ This webserver also exposes the follwing paths: - `/full_update`: send a `POST` here to run the full_update script. Note that this will not delete any files (yet). +## Resource IRIs + +Every IRI gg2rdf mints for a Plazi resource uses the `https://` scheme: + +| Resource | IRI | +| ------------------------- | ------------------------------------------------------- | +| treatment | `https://treatment.plazi.org/id/` | +| material citation | `https://tb.plazi.org/GgServer/dwcaRecords/.mc.` | +| taxon name | `https://taxon-name.plazi.org/id//` | +| taxon concept | `https://taxon-concept.plazi.org/id//` | +| publication without a DOI | `https://publication.plazi.org/id/` | + +`https://` is canonical: it is the scheme that resolves on every Plazi host, and +it is the scheme the loaders (`turtle-hook`, `turtle-hook-nq`) name their graphs +with, so a treatment and the graph it lands in share one IRI. A `httpUri` +attribute TreatmentBank supplies with `http://` is rewritten to `https://` when +it points at a Plazi host; identifiers of other publishers (DOIs, GBIF) are +taken as they are. + +Vocabulary namespaces are a different matter and stay as they are — `trt:` is +`http://plazi.org/vocab/treatment#`, alongside `dwc:`, `cito:` and `fabio:`, +which are `http://` by convention. Changing a vocabulary namespace breaks every +consumer's prefix declarations and belongs to a redesign of the ontologies, not +to this pipeline. + +Output produced before this change (plazi/gg2rdf#33) carries `http://` subjects. +Rewriting a store that holds such data in place, without replaying every file, +is described in turtle-hook's README. + ## Usage Build as a docker container. diff --git a/src/gg2rdf.ts b/src/gg2rdf.ts index e5c5ad8..d459fd6 100644 --- a/src/gg2rdf.ts +++ b/src/gg2rdf.ts @@ -233,7 +233,7 @@ export function gg2rdf( * * replaces and */ function makeTreatment() { - const t = new Subject(URI(`http://treatment.plazi.org/id/${id}`)); + const t = new Subject(URI(`https://treatment.plazi.org/id/${id}`)); if (treatmentTaxon) { const taxon = treatmentTaxon.el; @@ -772,16 +772,21 @@ export function gg2rdf( /** replaces */ function makeCitedMaterial(c: Element): string { const mcId = c.getAttribute("id"); - const httpUri = c.getAttribute("httpUri"); + // TreatmentBank still hands out http:// for its own resources; https:// is + // the canonical scheme for everything under plazi.org (see issue #33) + const httpUri = c.getAttribute("httpUri")?.replace( + /^http:\/\/(?=[a-z0-9-]+\.plazi\.org\/)/, + "https://", + ); const gbifOccurrenceId = c.getAttribute("ID-GBIF-Occurrence"); const specimenCode = c.getAttribute("specimenCode"); const uri = mcId - ? URI(`http://tb.plazi.org/GgServer/dwcaRecords/${id}.mc.${mcId}`) + ? URI(`https://tb.plazi.org/GgServer/dwcaRecords/${id}.mc.${mcId}`) : (gbifOccurrenceId ? URI(`https://www.gbif.org/occurrence/${gbifOccurrenceId}`) : (httpUri ? URI(httpUri) : URI( - `http://treatment.plazi.org/id/${id}/${partialURI(specimenCode)}`, + `https://treatment.plazi.org/id/${id}/${partialURI(specimenCode)}`, "_", ))); @@ -1247,7 +1252,7 @@ export function gg2rdf( /** replaces */ function taxonNameBaseURI({ kingdom }: { kingdom: string }) { - return `http://taxon-name.plazi.org/id/${ + return `https://taxon-name.plazi.org/id/${ kingdom ? partialURI(kingdom) : "INVALID" }`; } @@ -1374,7 +1379,7 @@ export function gg2rdf( * * replaces */ function taxonConceptBaseURI({ kingdom }: { kingdom: string }) { - return `http://taxon-concept.plazi.org/id/${kingdom}`; + return `https://taxon-concept.plazi.org/id/${kingdom}`; } /** returns valid turtle uri @@ -1423,7 +1428,7 @@ export function gg2rdf( const doiID: string | undefined = doc.getAttribute("ID-DOI"); if (!doiID) { return URI( - `http://publication.plazi.org/id/${ + `https://publication.plazi.org/id/${ partialURI(doc.getAttribute("masterDocId")) }`, );