Template:Labelled

From Wikidata
Jump to navigation Jump to search
Documentation icon Template documentation[view · edit · history · purge ]

Help:Partial query to retrieve item labels in some language.

Variable naming[edit]

The default label variable is of the form « ?<itemName>Label<langcode> ». For example « ?PlopLabelEn » in the first usage example below.

Usage[edit]

    ?plop rdfs:label ?plopLabelEn filter (lang(?plopLabelEn) = "en")
{{sparql|query=

select ?plop ?plopLabelEn ?plopLabelJa {
  # Items with an english labels and a japanese label
  {{Labelled|?plop|en}}
  {{Labelled|?plop|ja}}
} limit 1000

}}
select ?plop ?plopLabelEn ?plopLabelJa {
  # Items with an english labels and a japanese label
  
     ?plop rdfs:label ?plopLabelEn filter (lang(?plopLabelEn) = "en")
  
     ?plop rdfs:label ?plopLabelJa filter (lang(?plopLabelJa) = "ja")
} limit 1000
Try it!


Get the label of an item in some language, without using the query service.

Template parameters[Edit template data]

This template prefers inline formatting of parameters.

ParameterDescriptionTypeStatus
item1

item variable or constant.

Suggested values
?item
Example
?item or wd:Q5
Unknownrequired
langcode2

Wikidata labels language code

Suggested values
en
Example
en
Auto value
{{int:lang}}
Stringrequired
filterfilter

optional sparql filter (or other kind of sparql code) to add .

Example
filter (strstarts(?itemLabelEn, "L")
Unknownoptional

 This partial query generates a SPARQL variable based on parameter(s):

  • 1 : [item or itemvar]
  • 2 : [langcode or langcodevar]
  1. 1=item|2=langcode : wd:Q5
  2. 1=item|2=langcodevar : wd:Q5
  3. 1=itemvar|2=langcode : ?itemLabelFr
  4. 1=itemvar|2=langcodevar : ?itemLabellang


See also[edit]

    ? rdfs:label ? filter (lang(?) = "en")