- From: Johann Petrak <johann.petrak@jpetrak.com>
- Date: Thu, 27 Aug 2009 13:36:59 +0100
- To: public-sparql-dev@w3.org
I have a triple store that contains triples representing an OWL-Lite ontology. All the facts that can be derived from that ontology are explicitly asserted. The question is now: is it possible to make a SPARQL query that will retrieve a list of top classes? A top class would be defined as something that has rdf:type owl:Class and is not rdfs:subClassOf a *different* class other than owl:Thing or rdfs:Resource. A different class is a class that is not directly or indirectly related via a owl:equivalentClass relationship. Every class is a subclass of owl:Thing, of itself, and of all classes that are related via owl:equivalentClass. The problem are the equivalent classes. The following query will find all the top classes, but incorrectly remove any class that is an equivalent class of some other class: SELECT DISTINCT ?cl WHERE { ?cl a owl:Class } OPTIONAL { ?cl rdfs:subClassOf ?sc . FILTER (?cl != ?sc && ?sc != owl:Thing && ?sc != rdfs:Resource) } FILTER (!bound(?sc)) Is there any way to accomplish this in a single SPARQL query? And if not, what would the approach for doing this with least performance effort in multiple queries? Since SERQL supports nested selects and the minus, any etc. operators, this can be done in one SERQL query.
Received on Friday, 28 August 2009 09:11:27 UTC