Skip to content

Instantly share code, notes, and snippets.

@ptgolden
Last active August 29, 2015 14:03
Show Gist options
  • Save ptgolden/5386feaf71cbeb5bb176 to your computer and use it in GitHub Desktop.
Save ptgolden/5386feaf71cbeb5bb176 to your computer and use it in GitHub Desktop.
DBPedia SPARQL query for countries
PREFIX dbo: <http://dbpedia.org/ontology/>
PREFIX dbprop: <http://dbpedia.org/property/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
SELECT ?place, ?label, ?geonamesURI, ?depiction WHERE {
?place a dbo:Country .
?place rdfs:label ?label .
?place foaf:depiction ?depiction .
FILTER langMatches(lang(?label), 'en') .
FILTER regex(str(?label), '^ge.*', 'i') .
OPTIONAL {
?place owl:sameAs ?geonamesURI .
FILTER regex(str(?geonamesURI), 'geonames\\.org')
}
}
ORDER BY DESC(?geonamesURI)
LIMIT 100
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment