Skip to content

Function: applyRdfMapping() ​

ts
function applyRdfMapping(
   sourceData, 
   mapping, 
   options?
): object;

Defined in: application/services/transformers/rdf/rdf-mapping-engine.ts:1072

Applies a declarative mapping document to source data and returns JSON-LD of the form { '@context', '@graph' }. The graph holds the root node and, when any rule targets record.*, a secondary record node. The mapping's context replaces the default context.

Parameters ​

ParameterTypeDescription
sourceDataanyDocument data, read through each rule's JSON-pointer source.
mappinganyMapping document with rules and optional context, rootType, recordType, recordTopicProp and vocab.
options?RdfMappingOptions-

Returns ​

object

Example ​

ts
const entry = findRdfMapping('ds:datasheet-v2', 'dcat-ap');
if (entry) {
    const jsonLd = applyRdfMapping(doc.data, entry.mapping, { rootUri: 'https://example.org/ds/1' });
}