Iterate Over All Resources Of A Class In DBpedia Using SPARQL

You do now know DBpedia? Well, you should give a it a try. It offers a lot of data from Wikipedia in a machine-readable form.

For a new project a need to be able to iterate over all the entities/instances a specific class has. Sometimes things are obvious, but hey, here we go:

PREFIX ontology: <>
SELECT ?person ?property ?value
?person rdf:type ontology:Book .
?person ?property ?value .
ORDER BY ASC(?person)

The output is not comparable to a RDBMS. In SPARQL properties of an instance correspond to a row in the result. One instance is formed by several properties through grouping by the same URI. Additionally, if you use LIMIT & PAGESET, be aware that they cut by properties and not by instances. Meaning, you have to have you implementation make aware of this.

Leave a Comment

comments powered by Disqus