SPARQL Examples – Order By

Posted on Aug 31, 2017 (last modified Jun 3, 2021)

Order by the highest population
Here’s a similar query for DBPedia – this time, ordered by highest population first and filtered by language (“en”).

PREFIX type: <http://dbpedia.org/class/yago/> PREFIX prop: <http://dbpedia.org/property/> SELECT ?country_name ?population WHERE { ?country a type:LandlockedCountries ; rdfs:label ?country_name ; prop:populationEstimate ?population . FILTER (?population > 15000000 && langMatches(lang(?country_name), "en")) . } ORDER BY DESC(?population)