Thanks for the nice explanation. Though I’m not using any inferencing
mechanism in Protege, Classes like <#CheeseyPizza>, <#NonVegetarianPizza>
etc etc are shown as subclasses of <#Pizza>. Is it correct to consider them
as subclass?

Actually I was writing a code which could build the same taxonomy of
classes, (starting from a given class as input) as shown in protege. So
when in order to list subclasses of <#Pizza>, I get only <#NamedPizza> as
its subclass. So should I consider <#CheeseyPizza> as a subclass too?

A minimal version Screenshot of Pizza.owl is attached herewith.

On Tue, Dec 22, 2015 at 5:10 PM, Dave Reynolds <[email protected]>
wrote:

> On 22/12/15 11:06, Dibyanshu Jaiswal wrote:
>
>> I am using the following function to get a list of all the equivalent
>> classes of a given class.
>>
>> *Inputs* :
>>
>>     1. myModel: is my jena OntModel.
>>     2. classURI : URI of the class for which I want to fetch the
>> equivalent
>>     classes.
>>
>> *Output* : List<String> containing the URIs of the equivalent classes.
>> *Function* :
>>
>> public static List<String> getEquivalentClasses(String classURI, OntModel
>> myModel){
>>          List<String> list = new ArrayList<String>();
>>          OntClass oc = myModel.getOntClass(classURI);
>>
>>          ExtendedIterator<OntClass> InstIt = oc.listEquivalentClasses();
>>          while (InstIt.hasNext())
>>          {
>>              oc=InstIt.next();
>>              if(oc.getURI()!=null)
>>              list.add(oc.getURI());
>>          }
>>
>>         return list;
>>      }
>>
>>
>>
>> I use the same logic to fetch a list of subclasses of a given class, which
>> works fine.
>>
>> But it doesn't works for Equivalent classes.
>>
>> I have tried this on the Pizza
>> <http://protege.stanford.edu/ontologies/pizza/pizza.owl> ontology, for
>> class Pizza and CheesyPizza. It has many equivalent classes when opened in
>> protege, but unable to list any via the OntClass.listEquivalentClasses()
>> API of Jena.
>>
>
> There are lots of owl:equivalentClass statements in that ontology but none
> of them are between pairs of named classes. In all cases the equivalent
> class is a bNode with no URI and so is excluded by your
> "if(oc.getURI()!=null)" test.
>
> Note also that protege may be using inference to deduce additional
> equivalent class relationships. You would need to use an equivalent
> inference set up in your OntModel to see those deduced equivalences.
>
> To my observation, the for example class CheeseyPizza is an equivalent to
>> Pizza class and further has some property restriction as "hasTopping some
>> CheeseTopping" , is this got something to do with it?
>>
>
> No. That owl:equivalentClass statement is saying that a #CheeseyPizza is
> equivalent to the intersection of Pizza and those restriction, it is not
> directly equivalent to #Pizza. Paraphrasing in Turtle it has:
>
>    <#CheeseyPizza> a owl:Class;
>       owl:equivalentClass  [
>          a owl:Class;
>          owl:intersectionOf (
>             <#Pizza>
>             [ a owl:Restriction;
>               owl:onProperty <#hasToppy>;
>               owl:someValuesFrom <#CheeseToppy>
>             ]
>          )
>       ]
>
> So the object of the owl:equivalentClass statement on #CheeseyPizza is a
> bNode:
>
>     [
>       a owl:Class;
>       owl:intersectionOf (
>          <#Pizza>
>          [ a owl:Restriction;
>            owl:onProperty <#hasToppy>;
>            owl:someValuesFrom <#CheeseToppy>
>          ]
>       )
>     ]
>
>
> and has no URI.
>
> Dave
>
>


-- 
*Dibyanshu Jaiswal*
Mb: +91 9038304989

Reply via email to