查询DBpedia以获取仅英语的描述(使用SPARQL) [英] Querying DBpedia for English-only description (with SPARQL)
本文介绍了查询DBpedia以获取仅英语的描述(使用SPARQL)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用此SPARQL查询查询dbpedia.org:大笨钟的描述:
I'm querying dbpedia.org for a description of Big Ben with this SPARQL query:
select ?desc
where {
<http://dbpedia.org/resource/Big_Ben> <http://www.w3.org/2000/01/rdf-schema#comment> ?desc
}
这将返回至少10种不同语言的描述列表。我该如何指定我只想要英语描述?
This returns a list of descriptions in at least 10 different languages. How do I specify that I only want the English language description?
推荐答案
您需要知道的键是str()和lang()将值的文本和语言分开,因此您可以执行以下操作:
The keys you need to know are that str() and lang() pull apart the text and language of the value, so you can do this:
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"))
}
这篇关于查询DBpedia以获取仅英语的描述(使用SPARQL)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文