Multilingual
Label Service
The Wikidata label service is the easiest way to get human-readable names for entities in your preferred languages with automatic fallbacks.
How the Label Service Works
The label service automatically creates ?varLabel variables for
any ?var in your query. It retrieves the label in your specified
language, falling back to other languages if not available.
Basic Label Service Usage
SELECT ?lang ?langLabel
WHERE {
?lang wdt:P31 wd:Q9143 . # programming language
# This service creates ?langLabel automatically
SERVICE wikibase:label {
bd:serviceParam wikibase:language "en" .
}
}
LIMIT 20
Language Fallback Chains
Specify multiple languages separated by commas. The service tries each language in order and uses the first available label.
Fallback Chain: French → English → German
SELECT ?city ?cityLabel
WHERE {
?city wdt:P31 wd:Q515 ;
wdt:P17 wd:Q39 . # Switzerland
SERVICE wikibase:label {
# Try French first, then English, then German
bd:serviceParam wikibase:language "fr,en,de" .
}
}
LIMIT 20
Auto-Language Detection
SELECT ?item ?itemLabel
WHERE {
?item wdt:P31 wd:Q33506 . # museum
SERVICE wikibase:label {
# [AUTO_LANGUAGE] uses browser language
bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" .
}
}
LIMIT 10
Descriptions and Aliases
The service also creates ?varDescription and ?varAltLabel
(aliases) variables automatically.
Labels, Descriptions, and Aliases
SELECT ?lang ?langLabel ?langDescription ?langAltLabel
WHERE {
VALUES ?lang {
wd:Q2005 # JavaScript
wd:Q15777 # Python
wd:Q2407 # C++
}
SERVICE wikibase:label {
bd:serviceParam wikibase:language "en" .
}
}
Cultural Heritage Examples
Museums with Localized Names
SELECT ?museum ?museumLabel ?city ?cityLabel
WHERE {
?museum wdt:P31/wdt:P279* wd:Q207694 ; # art museum
wdt:P17 wd:Q38 ; # Italy
wdt:P131 ?city .
SERVICE wikibase:label {
# Italian first, then English
bd:serviceParam wikibase:language "it,en" .
}
}
LIMIT 30
Urban Examples
Cities in Local Language
SELECT ?city ?cityLabel ?country ?countryLabel
WHERE {
?country wdt:P31 wd:Q6256 ;
wdt:P36 ?city .
FILTER(?country IN (
wd:Q183, # Germany
wd:Q142, # France
wd:Q29, # Spain
wd:Q38 # Italy
))
SERVICE wikibase:label {
bd:serviceParam wikibase:language "de,fr,es,it,en" .
}
}
Best Practices
- Always include a fallback — End with
enas most entities have English labels - Use [AUTO_LANGUAGE] — For user-facing applications to respect browser settings
- Place service at end — The label service should typically be the last clause
- Request only what you need — If you don't need descriptions, don't include the variable