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's gravatar image

davidpl1985
836
accept rate: 0%

edited 26 Nov '12, 11:44


permanent link

answered 27 Nov '12, 07:10

AKSWMember's gravatar image

AKSWMember
1.5k38
accept rate: 25%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×1,305
×24
×6

question asked: 26 Nov '12, 11:38

question was seen: 1,218 times

last updated: 27 Nov '12, 07:10