我正在使用此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"))
- }