Skip to content

Mappers

mappers is used to inform what mappers that shall be used in the pipeline.

Mappers are utilized in either the fetch or convert transform (depending on batch or as stream mode)

Currently, there are five mappers which can be included in the configuration:

Mapper
addFormat Identify the mediatype for a distribution, and replace the current dcterms:format value with this mediatype
addPublicSector Check the metadata of the pipeline, if there is a psi tag, add a truth value to esterms:publicSector of the object
addPublisher From a provided graph, add a pre-defined publisher uri to a dataset and/or catalog
dataserviceMarks Identify what datasets that are served by a data service, and add relations from dataset to data service ,and vice versa
subCatalogs Check if a catalog has sub-catalogs. If so, load content of sub-catalogs into the graph, then merge content of the sub-catalogs into the "top" catalog

Configuration

Adding a mapper

mappers must be an array of strings, where each string corresponds to one of the pre-defined mappers. Choosing what mappers to include is done by including them in this list. Some mappers require individual configuration, see below.

module.exports = {
  mappers: ['addPublicSector', 'dataserviceMarks', 'addFormat', 'addPublisher', 'subCatalogs'],
};

Configuring a mapper

Some mappers need more configaration in order to work. Add the mapper to the configuration file, and pass a suitable configuration for it:

addFormat

addFormat mapper requires an object in which the context ID (in this case, 532) for the pipeline is declared.

module.exports = {
  addFormat: { 532: true },
};

addPublisher

addPublisher requires an object in which the context ID (in this case, 532) for the pipeline is declared as key, and the uri for the publisher to be added as value.

module.exports = {
  addPublisher: { 532: 'http://example.com' },
};