问题
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:
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"))
}
来源:https://stackoverflow.com/questions/6325407/querying-dbpedia-for-english-only-description-with-sparql