Modification in SPARQL query for retrieving items with labels or default!. language!main/resources/Queries/query_for_item.rq, in retrieve item labels and descriptions.

This commit is contained in:
Mincheng 2024-10-15 15:34:01 +11:00
parent e3f2a6c1ee
commit 952ed1d700

View file

@ -23,6 +23,7 @@ WHERE {
BIND(COALESCE(?itemLabelPreferredLanguage, ?itemLabelAnyLanguage, "?") as ?label)
# Get the description in the preferred language of the user, or any other language if no description is available in that language.
# This ensures that the query first tries to fetch the label in the user's preferred language, and if it's unavailable, it falls back to English
OPTIONAL {?item schema:description ?itemDescriptionPreferredLanguage. FILTER (LANG(?itemDescriptionPreferredLanguage) = "${LANG}" || LANG(?itemDescriptionPreferredLanguage) = "en")}
OPTIONAL {?item schema:description ?itemDescriptionAnyLanguage}
BIND(COALESCE(?itemDescriptionPreferredLanguage, ?itemDescriptionAnyLanguage, "?") as ?description)