trompamusic/ce-api

json-ld: only add items to context if they're used in this document

Opened this issue · 0 comments

We have some hard-coded url -> prefixes for the contexts that we use:

const scopedContexts = {
dc: 'http://purl.org/dc/terms/',
prov: 'http://www.w3.org/ns/prov#',
skos: 'http://www.w3.org/2004/02/skos/core#',
rdf: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
bib: 'https://bib.schema.org/'
}

We should only return these mappings if the prefix is used in the document that is being returned