Dear SPARQLers, I'm trying to fetch the most specific properties for a class, and I'm stuck. I want to pull out all the properties that apply for a given class (including those inherited from superclasses), except those properties that have subproperties in the result set.
For example, if I have a class Population with one of its properties being atLocation, and a subclass of Population called Refugees. Refugees has a property currentLocation, which is a subProperty of atLocation. So what I want is a generic query that would give me only atLocation if I put in Population, and only currentLocation if I put in Refugees. What I have is this: prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> prefix ex: <http://example.org/vocabulary#> SELECT DISTINCT ?prop WHERE { ex:Refugee rdfs:subClassOf* ?domain . ?prop rdfs:domain ?domain . ?subprop rdfs:domain ?domain . FILTER NOT EXISTS { ?subprop rdfs:subPropertyOf ?prop . } } ORDER BY ?prop This gives me both atLocation and currentLocation, though. Is this possible in one query at all? Any ideas on how to solve this appreciated! - Carsten
