sia*_*mii 12 rdf semantic-web sparql dbpedia
我正在使用此SPARQL查询查询dbpedia.org以获取有关Big Ben的描述:
select ?desc
where {
<http://dbpedia.org/resource/Big_Ben> <http://www.w3.org/2000/01/rdf-schema#comment> ?desc
}
Run Code Online (Sandbox Code Playgroud)
这将返回至少10种不同语言的描述列表.如何指定我只想要英文描述?
gle*_*ald 21
你需要知道的关键是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"))
}
Run Code Online (Sandbox Code Playgroud)