What do you mean by 'all the datatype properties of a class'? All
datatype properties for which the class has been specified in their
domain? Datatype properties for which a cardinality of greater than zero
has been specified for that class? Or classes that have someValue or
hasValue restrictions for that property? Also, in OWL any property with
a domain of owl:Thing (e.g. all properties) may be a potential
candidate. There are other possibilities - and a reasoner would be
required to deduce them.
Properties are not necessarily 'inherited' in the way that you might
expect. For example, stating that a property has a domain of a
particular class, X, does not imply the property has a domain of any of
the subclasses of X (though the Protégé-OWL GUI may give that impression).
A simple example illustrates this:
Assume we have a class Person with subclasses Parent and
ChildlessPerson, property hasChild with a domain and range of Person.
Define Parents as all Persons that have a child and ChildlessPerson as
any person that is not a parent. Even though it is true that hasChild
has domain Person it is not true that hasChild has domain
ChildlessPerson. Intuitively, Person has an associated hasChild property
but its subclass ChildlessPerson should not inherit this property
because it has a restriction that explicitly states that it is not in
its domain.
SPARQL is an RDF query language and has no understanding of OWL
semantics (and one could argue that it has very little understanding of
RDF semantics either). Using it to query OWL ontologies is fraught with
difficulties. Even if you could try to enumerate the possible ways of
defining 'all the datatype properties of a class' the resulting SPARQL
query would be absurd.
Martin, Tim
Gustavo Felhberg wrote:
>Hi guys,
>>I need to make a SPARQL query to get all the datatype properties of a
>class. Until now I just got the direct datatype properties but I also
>need the inherited ones. For example, I have a class Producer with a
>datatype property called "name" and a specialized class Team
>(specialization of Producer) with a datatype property "numberOfElements".
>>I need to make a query that if I ask the class Team, it shows me the
>properties "name" and "numberOfElements".
>>The query I made to get the direct properties are:
>>SELECT DISTINCT ?x ?z
>>WHERE {
>> ?x rdfs:subClassOf ?y.
>> ?y owl:onProperty ?z.
>> ?z ?a owl:DatatypeProperty. # this ?a means nothing
>> } ORDER BY ?x
>>>Thanks a lot.
>>Gustavo Felhberg
>_______________________________________________
>protege-owl mailing list
>protege-owl at lists.stanford.edu>https://mailman.stanford.edu/mailman/listinfo/protege-owl>>Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03>>>