Querying DBpedia for English-only description (wit

2020-07-03 08:02发布

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
}

This returns a list of descriptions in at least 10 different languages. How do I specify that I only want the English language description?

1条回答
SAY GOODBYE
2楼-- · 2020-07-03 08:13

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"))
}
查看更多
登录 后发表回答