Template:Labelled
Jump to navigation
Jump to search
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]
{{Labelled|?plop|en}}
?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
Get the label of an item in some language, without using the query service.
Parameter | Description | Type | Status | |
---|---|---|---|---|
item | 1 | item variable or constant.
| Unknown | required |
langcode | 2 | Wikidata labels language code
| String | required |
filter | filter | optional sparql filter (or other kind of sparql code) to add .
| Unknown | optional |
This partial query generates a SPARQL variable based on parameter(s):
- 1 : [item or itemvar]
- 2 : [langcode or langcodevar]
- 1=item|2=langcode : wd:Q5
- 1=item|2=langcodevar : wd:Q5
- 1=itemvar|2=langcode : ?itemLabelFr
- 1=itemvar|2=langcodevar : ?itemLabellang
See also[edit]
The above documentation is transcluded from Template:Labelled/doc (edit | history). Editors can experiment in this template's sandbox (create | mirror) and testcases (create) page. Please add categories to the /doc subpage. Subpages of this template. |
? rdfs:label ? filter (lang(?) = "en")