SELECT ?personName, ?countryName
WHERE {
?person rdf:type <http://dbpedia.org/ontology/Person> .
?person rdfs:label ?personName .
?person <http://dbpedia.org/ontology/birthplace> ?country .
?country rdf:type <http://dbpedia.org/ontology/Country> .
?country rdfs:label ?countryName .
FILTER (lang(?personName) = "en")
FILTER (lang(?countryName) = "en")
}
This query can be bundled as a GET request for HTML results [2] or
JSON [3] and other formats which you can see at [1].
dbpedia limites results to 1000 rows, so the trick to getting *all*
the results would be to use the ORDER BY, LIMIT and OFFSET operators:
SELECT ?personName ?countryName
WHERE {
?person rdf:type <http://dbpedia.org/ontology/Person> .
?person rdfs:label ?personName .
?person <http://dbpedia.org/ontology/birthplace> ?country .
?country rdf:type <http://dbpedia.org/ontology/Country> .
?country rdfs:label ?countryName .
FILTER (lang(?personName) = "en")
FILTER (lang(?countryName) = "en")
}
ORDER BY ?personName
OFFSET 0
LIMIT 1000
As a proof of concept I just wrote a little python script [4] that
will walk through the results, and print out something like:
Aaron Ledgister : England
Aaron Lennon : England
Aaron Lescott : England
Aaron Liffchak : England
Aaron Lockett : England
Aaron Mauger : New Zealand
Aaron McGruder : United States
Aaron McLean : England
Aaron Mokoena : South Africa
Aaron Morris : Wales
Aaron Moses-Garvey : England
Aaron Murphy : England
Aaron Nash : Northern Ireland
Aaron O'Connor : England
Aaron Paye : United States
Aaron Payne : Australia
Aaron Pedersen : Australia
Aaron Pryor : United States
This is really just the tip of the iceberg though. There's a lot of
rich data hiding in dbpedia, which you can learn about by just trying
out some SPARQL in the web-based query interface [1]. I imagine if
this information isn't what you want you could adjust the query to
find what you need. Understanding how to walk around in the dbpedia
data set and the Linked Data universe is a pretty useful investment of
your time I think. If you have time to spare :-)
//Ed
[1] http://dbpedia.org/sparql/
[2] http://tinyurl.com/nr4y5h
[3] http://tinyurl.com/lmoqjt
[4] http://inkdroid.org/bzr/experiments/people_places.py