I'm currently looking for a way to query the DBPedia Infobox ondology database through the SPARQL endpoint to get a list of classes, subclasses of the selected class, and properties of this class. As far as I was able to find, you either need to know the property you are looking for, or look for something specific - all the examples I found are based on the idea that you want to find something specific (for example, the population of cities above a certain level and etc.), while I would like to build something where I can effectively βbrowseβ categories. For example, starting with the list of subclasses "owl: Thing" on this hierarchical class hierarchy and presenting the user with a list of subclasses of the selected subclass. It seems possible to view something like this using a wiki mapping, but it would be preferable to directly query the SPARQL endpoint.
Is there a simple SPARQL query that returns the available classes and properties of these classes?
Update: I came up with a way to get the class hierarchy, it seems, by iterating through this query:
SELECT ?subject WHERE { ?subject rdfs:subClassOf owl:Thing }
It returns a list of owl: Thing subclasses, and if I replace owl: Thing with one of the subclasses, I get a list of subclasses of this until there are no subclasses, after which I can select all resources that are of the type specified by the selected subclass. I'm still not quite sure how to get all the properties common to a subclass.
Update 2 is now closer. This request gets me all the properties (dbpedia: property children), which are also a country, as well as their names:
SELECT DISTINCT ?prop ?title WHERE { ?country ?prop ?value. ?country a <http://dbpedia.org/ontology/Country>. ?prop rdf:type rdf:Property. ?prop rdfs:label ?title }
In fact, everything that I really requested. The last thing I'm trying to do now is try to sort them by the number of pages on which they appear (presumably the most common properties will be of the greatest interest).
Paul
source share