查询DBpedia仅提供英语描述使用SPARQL

问题描述

| 我正在使用此SPARQL查询查询dbpedia.org,以获取有关Big Ben的描述:
select ?desc 
where {
<http://dbpedia.org/resource/Big_Ben> <http://www.w3.org/2000/01/rdf-schema#comment> ?desc
}
这将返回至少10种不同语言的描述列表。如何指定我只想要英语描述?     

解决方法

        您需要知道的键是str()和lang()将值的文本和语言分开,因此您可以执行以下操作:
select str(?desc) 
where {
  <http://dbpedia.org/resource/Big_Ben> <http://www.w3.org/2000/01/rdf-schema#comment> ?desc
  FILTER (langMatches(lang(?desc),\"en\"))
}
    

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...