title: Getting DBPedia Infobox categories
body: <p>I'm currently looking for a way to query <a href="http://wiki.dbpedia.org/Ontology" rel="noreferrer">DBPedia's Infobox Onyology database</a> via the SPARQL endpoint to get a list of the classes, the subclasses of a selected class, and the properties of a given class. As far as I've been able to find, you either need to know the property that you are looking for or search for something specific - all the examples I've found seem predicated on the idea that you would want to search for something specific (like populations of cities above a certain elevation, etc), whereas I'd like to build something where I can effectively "browse" the categories. For example, starting with the list of subclasses of "owl:Thing" on <a href="http://www4.wiwiss.fu-berlin.de/dbpedia/dev/ontology.htm" rel="noreferrer">this class hierarchy chart</a> and presenting the user with the list of subclasses of a selected subclass. It seems possible to browse something like this via the mappings wiki, but it would be preferable to query the SPARQL endpoint directly.</p>
  
  <p>Is there some simple SPARQL query that would return the available classes and properties of those classes?</p>
  
  <p><strong>Update:</strong>
  I've come up with a way to get the class hierarchy it seems, by iterating through <a href="http://dbpedia.org/snorql/?query=SELECT+?subject+WHERE+%7B%0D%0A+++++?subject+rdfs%3asubClassOf+owl%3aThing%0D%0A%7D%0D%0A" rel="noreferrer">this query:</a></p>
  
  <pre><code>SELECT ?subject WHERE {
       ?subject rdfs:subClassOf owl:Thing
  }
  </code></pre>
  
  <p>Which returns a list of subclasses of owl:Thing, and if I replace owl:Thing with one of the subclasses, I get the list of subclasses of that, until there are no subclasses, at which point I can select all the resources which have a type given by the chosen subclass. I'm still not quite sure how to get all the properties common to the subclass, though.</p>
  
  <p><strong>Update 2</strong>
  Getting closer now. This query gets me all the properties (children of dbpedia:property) that are also a country, as well as their titles:</p>
  
  <pre><code>SELECT DISTINCT ?prop ?title WHERE {
       ?country ?prop ?value.
       ?country a &lt;http://dbpedia.org/ontology/Country&gt;.
       ?prop rdf:type rdf:Property.
       ?prop rdfs:label ?title
  }
  </code></pre>
  
  <p>Which is actually all I really asked for. The last thing I'm trying to do now is to try to order these by the number of pages in which they appear (presumably the most common properties will be the ones of greatest interest).</p>