@lde/dataset
Classes for working with DCAT Datasets and Distributions.
Installation
sh
npm install @lde/datasetAPI
The package exports:
Dataset– a DCAT dataset withiri,title,description,language,license,creator,publisherand itsdistributions.getDownloadDistributions()returns the downloadable (non-SPARQL) distributions, preferring compressed ones.DatasetArguments– the options object theDatasetconstructor takes; onlyirianddistributionsare required.CreatorandPublisher– an agent’siriplus its language-mappedname.Distribution– a DCAT distribution withaccessUrl,mediaType(an IANA media type URI per DCAT-AP 3.0, or a plain content type for convenience),mimeType,compressFormat,byteSize,lastModifiedand more. The staticDistribution.sparql(endpoint, namedGraph?)creates a SPARQL distribution.isSparql()–truewhen the distribution’sconformsTois the SPARQL 1.1 Protocol URI (https://www.w3.org/TR/sparql11-protocol/) or itsmimeTypeisapplication/sparql-queryorapplication/sparql-results+json.compressMimeType– plain content type derived fromcompressFormat(e.g.application/gzip), orundefinedwhen no compression format is declared.compressedMimeType– the full content type a server is expected to send for the compressed download:mimeTypewith the compression suffix appended (e.g.application/n-quads+gzip), orundefinedwhen no media type or no recognised compression format is declared.namedGraphandsubjectFilter– optional fields narrowing a SPARQL distribution: the named graph to query, and a SPARQL pattern fragment that pipeline queries splice in to restrict the subjects they select.
IANA_MEDIA_TYPE_PREFIX– thehttps://www.iana.org/assignments/media-types/prefix that turns a plain content type into a DCAT-AP 3.0 media type URI.RdfFormatandrdfFormatToFileExtension()– RDF serialization formats and their file extensions.rdfMediaTypes,sparqlMediaTypesandcompressionMediaTypes– media type constants for matching distributions. Note thatcompressionMediaTypesincludesapplication/octet-stream: servers commonly label compressed bodies as opaque bytes, so consumers matching a declared RDF media type should ignore it like the gzip/zip types.skolemIri()andhashSuffix()– mint deterministic IRIs for otherwise-anonymous structural nodes, instead of blank nodes whose labels are not preserved across separately serialised documents.assertSafeIri()– throw if an IRI contains characters that could break out of a SPARQL<…>IRI reference.
Most exports carry JSDoc, so your editor shows inline documentation as you use them.