Hello,
I'm trying to get all the equivalent classes to a given class taking into account the hierarchy of classes.
In the ontology that I'm using for testing I have two classes defined like this:
<!-- http://mynamespace/onts/got.owl#Person -->
<owl:Class rdf:about="http://mynamespace/onts/got.owl#Person">
<owl:disjointWith rdf:resource="http://mynamespace/onts/got.owl#Sex"/>
</owl:Class>
<!-- http://mynamespace/onts/got.owl#Man -->
<owl:Class rdf:about="http://mynamespace/onts/got.owl#Man">
<owl:equivalentClass>
<owl:Class>
<owl:intersectionOf rdf:parseType="Collection">
<rdf:Description rdf:about="http://mynamespace/onts/got.owl#Person"/>
<owl:Restriction>
<owl:onProperty rdf:resource="http://mynamespace/onts/got.owl#hasSex"/>
<owl:someValuesFrom rdf:resource="http://mynamespace/onts/got.owl#Male"/>
</owl:Restriction>
</owl:intersectionOf>
</owl:Class>
</owl:equivalentClass>
</owl:Class>
If I try to retrieve the equivalents of the class Person I get the classes: Man and Woman. The Woman class definition is analogous to that one of Man, just changing the Sex.
However if I try to get the equivalents of Man I don't get any results. My guess is that it has something to do with the restrictions. If so, do you have any suggestions of how to include them in the query? Thanks in advance
Note: I'm using the following SPARQL query.
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT DISTINCT ?node
WHERE {
{
?node owl:equivalentClass <http://mynamespace/onts/got.owl#Man> .
FILTER (isURI(?node)) .
FILTER(!sameTerm(?node,<http://mynamespace/onts/got.owl#Man>))
}
UNION
{
?node owl:equivalentClass* <http://mynamespace/onts/got.owl#Man> .
FILTER (isURI(?node)) .
FILTER(!sameTerm(?node,<http://mynamespace/onts/got.owl#Man>))
}
UNION
{
?node owl:equivalentClass _:bnode .
_:bnode owl:intersectionOf _:bnode2 .
_:bnode2 rdf:rest*/rdf:first <http://mynamespace/onts/got.owl#Man> .
FILTER (isURI(?node)) .
FILTER(!sameTerm(?node,<http://mynamespace/onts/got.owl#Man>))
}
UNION
{
?node owl:equivalentClass _:bnode3 .
_:bnode3 owl:unionOf _:bnode4 .
_:bnode4 rdf:rest*/rdf:first <http://mynamespace/onts/got.owl#Man> .
FILTER (isURI(?node)) .
FILTER(!sameTerm(?node,<http://mynamespace/onts/got.owl#Man>))
}
}
asked
26 Nov '12, 11:38
davidpl1985
83●5
accept rate:
0%