sparql - Selecting languages with specific ISO code -
i want retrieve full language name given isocode language abbreviation. sparql query follows (with hard-coded language "fr"@en
):
prefix dbpprop: <http://dbpedia.org/property/> prefix dbo: <http://dbpedia.org/ontology/> select ?language ?isocode { ?language dbpprop:iso ?isocode. ?language dbo:language. filter (?isocode="fr"@en) }
running through online dbpedia endpoint yields 0 results — though expect retrieve "french". code used work year or 2 ago (if not totally mistaken). since no errors pop up, bit @ loss. french language dbpedia resource contains both language , iso property.
rather filtering, can search languages want directly. e.g.:
select ?language { ?language dbpprop:iso "fr"@en . ?language dbpedia-owl:language . }
the results
language http://dbpedia.org/resource/canadian_french http://dbpedia.org/resource/new_england_french http://dbpedia.org/resource/french_language http://dbpedia.org/resource/colonial_french
if want ?isocode
variable bound "fr"@en
, can use values
clause specify (and others, too, if want). e.g.:
select ?language ?isocode { values ?isocode { "fr"@en "fro"@en "fra"@en } ?language dbpprop:iso ?isocode . ?language dbpedia-owl:language . }
if want filter, can still too. e.g.:
select ?language ?isocode { ?language dbpprop:iso ?isocode . ?language dbpedia-owl:language . filter ( str(?isocode) = "fr" && langmatches( lang(?isocode), "en" ) ) }
Comments
Post a Comment