SPARQL: Querying Wikidata labels for more than one language

后端 未结 2 881
孤街浪徒
孤街浪徒 2021-01-20 17:29

I am trying to get labels in multiple languages from Wikidata\'s SPARQL endpoint. The following example is given here:

SELECT ?country ?country_EN ?country_         


        
2条回答
  •  野性不改
    2021-01-20 17:35

    rdfs:label can be used directly without the wikibase:label service:

    SELECT ?country ?country_en ?country_de ?country_fr
       WHERE {
         ?country wdt:P31 wd:Q185441. # member state of the European Union
         OPTIONAL {?country rdfs:label ?country_en filter (lang(?country_en) = "en")}.
         OPTIONAL {?country rdfs:label ?country_de filter (lang(?country_de) = "de")}.
         OPTIONAL {?country rdfs:label ?country_fr filter (lang(?country_fr) = "fr")}.
    }
    

    Try it here

提交回复
热议问题