SPARQL:查询多种语言的Wikidata标签 [英] SPARQL: Querying Wikidata labels for more than one language
本文介绍了SPARQL:查询多种语言的Wikidata标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试从Wikidata的SPARQL端点获取多种语言的标签。下面给出了here示例:
SELECT ?country ?country_EN ?country_DE ?country_FR
WHERE {
?country wdt:P31 wd:Q185441. # member state of the European Union
SERVICE wikibase:label { bd:serviceParam wikibase:language "en".
?country rdfs:label ?country_EN.
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "de".
?country rdfs:label ?country_DE.
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "fr".
?country rdfs:label ?country_FR.
}
}
但是,这将返回以下错误:
未知错误:任何组中只能有一个"最后运行"加入
是否有解决方案可以获得多种语言的标签?
推荐答案
rdfs:label
可以直接使用,不需要wikibase:label
服务:
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")}.
}
这篇关于SPARQL:查询多种语言的Wikidata标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文