entity.skosDictionary( graph as String, [lang as String], [options as String[]] ) as cts.entityDictionary
Construct an entity dictionary from a SKOS ontology loaded into the database as triples. The mapping from a SKOS ontology is as follows:
For best results it is strongly recommended you construct
ontologies using skos:ConceptScheme
with explicit
skos:inScheme
properties.
The following list describes the mapping from a SKOS ontology to entity dictionary entries. NOTE: The "skos" prefix here is shorthand for the namespace "http://www.w3.org/2004/02/skos/core#".
skos:Concept
becomes an entity.skos:ConceptScheme
provides an entity type.skos:prefLabel
becomes the entity's
normalized text.skos:prefLabel
plus any additional
labels (skos:altLabel
, skos:hiddenLabel
)
become entity text that will be used to match.skos:ConceptScheme
then that
scheme will provide the entity type; otherwise the graph URI will
be used as the entity type.rdfs:label
or dc:title
of the
concept scheme is used as the entity type, if one is available;
otherwise, the IRI of the concept scheme is used.skos:inScheme
Sskos:hasTopConcept
Cskos:hasTopConcept
C2 AND
C2 skos:narrowerTransitive
Cskos:topConceptOf
Sskos:broaderTransitive
C2
AND C2 skos:topConceptOf
Sskos:broaderTransitive
will be inferred from
skos:broader
if needed.
skos:narrowerTransitive
will be inferred
from skos:narrower
if needed.
If this function cannot derive an entity dictionary entries from the
graph, MarkLogic throws the exception XDMP-EMPTYEDICT
.
'use strict'; declareUpdate(); const entity = require('/MarkLogic/entity'); entity.dictionaryInsert('/ontology/people', entity.skosDictionary('http://example.com/people'));