Label Resolution and Full-Text Search¤
Introduction¤
Label resolution translates resource identifiers (URI/IRI) into human readable labels. This resolution and, by extension, the full text search is configurable for different scenarios.
Configuration¤
eccenca Explore backend (DataPlatform) offers three configuration options:
labelProperties(line 2)languagePreferences(line 5) andlanguagePreferencesAnyLangFallback(line 8).
These properties define not only which properties and languages should be considered, but also the precedence of properties and languages over each other.
The retrieval process can be simplified to the following procedure:
- When determining the label for a resource, the property is the primary criterion and the language the secondary one. In other words, the complete list of preferred languages is evaluated for the first property before Explore backend (DataPlatform) moves on to the next property.
- Consequently, for a resource with the default settings above, the candidates are tried in this order:
- An english value for
rdfs:labelis searched. - A literal of the property
rdfs:labelwithout a language tag is searched (which is why there is an entry""). - An english value of
skos:prefLabelis searched. - A literal of the property
skos:prefLabelwithout a language tag is searched. - If nothing is found and
languagePreferencesAnyLangFallbackistrue, a value in any remaining language is used, again honoring the property precedence (see Example). - If still nothing is found, Explore backend (DataPlatform) tries to create a prefixed URI, otherwise the last segment of the resource identifier is used.
- An english value for
Additionally, in case more than one label could be retrieved for the same property and language, for example by conflicting values, the alphabetically first entry is used.
Property precedence beats language precedence
Because the property is the primary criterion, a value of an earlier property is preferred over a better-matching language on a later property. This especially affects untagged literals: an entry "" in languagePreferences matches a literal without a language tag, so if an earlier property carries such an untagged literal, it wins over a later property that has a value in a preferred language.
Consider the following configuration and resource:
proxy:
labelProperties:
- "http://www.w3.org/2004/02/skos/core#notation"
- "http://www.w3.org/2000/01/rdf-schema#label"
- "http://www.w3.org/2004/02/skos/core#prefLabel"
languagePreferences:
- "en"
- "de"
- ""
The resolved label is notation: skos:notation is the first property, and although it has no en or de value, its untagged literal is matched by the "" language preference, so the search never reaches rdfs:label. To make rdfs:label win here, either list it before skos:notation in labelProperties, or remove the "" entry from languagePreferences (which lets skos:notation fall through to rdfs:label "label en"@en).
Example¤
How labels are resolved is best explained using these default settings and some examples.
:Resource1 rdfs:label "Leipzig"@en.
:Resource2 :someOtherProperty "Berlin"@en.
:Resource3 rdfs:label "Stuttgart"@de
:Resource4 rdfs:label "Hanover"@en
:Resource4 rdfs:label "Another Label for Hanover"@en
- For
:Resource1the label will beLeipzigas the englishrdfs:labelwill be retrieved. - For
:Resource2the label cannot be retrieved from the Knowledge Graph since no known property is used. Hence the fallback. - For
:Resource3the label will be retrieved asStuttgart, if thelanguagePreferencesAnyLangFallbackistrue.- While there is a well-known property used, none of the used languages match. Using the fallback, the alphabetically first match is retrieved in this case.
- For
:Resource4multiple label candidates could be determined.- In this case,
Another Label for Hanoveris retrieved as it is the first value in the alphanumerical comparison.
- In this case,
Client API¤
The label resolution functionality can also be used by client systems.
This functionality is exposed as an API endpoint (<dp_url>/api/explore/title).