Getting list of owl:Thing's sub-classes

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Getting list of owl:Thing's sub-classes

Hugo Ferreira
Hi,

I would like to load an ontology programmatically, obtain the "top"
owl:Thing  and then obtain all of its subclasses i.e: effectively list
all top-level classes.

The use of:
         OWLNamedClass top = model.getOWLThingClass();
or
         OWLNamedClass top = model.getOWLNamedClass("owl:Thing");

does not return a "OWLNamedClass" typed object as does:

        OWLNamedClass top = model.getOWLNamedClass("VegetarianPizza");


How can I get a list of all top level classes?

TIA,
Hugo F.


-------------------------------------------------------------------------
To unsubscribe go to http://protege.stanford.edu/community/subscribe.html

Reply | Threaded
Open this post in threaded view
|

Re: Getting list of owl:Thing's sub-classes

Tania Tudorache
Hugo,

you can use the following call to get all subclasses of owl:Thing:

    owlModel.getOWLThingClass().getNamedSubclasses()

This will probably return more than what you want (also RDFSNamedClasses
- that are by default hidden in Protege GUI). You can iterate through
the collection and get only the OWLNamedClasses.

Tania



Hugo Ferreira wrote:

> Hi,
>
> I would like to load an ontology programmatically, obtain the "top"
> owl:Thing  and then obtain all of its subclasses i.e: effectively list
> all top-level classes.
>
> The use of:
>         OWLNamedClass top = model.getOWLThingClass();
> or
>         OWLNamedClass top = model.getOWLNamedClass("owl:Thing");
>
> does not return a "OWLNamedClass" typed object as does:
>
>     OWLNamedClass top = model.getOWLNamedClass("VegetarianPizza");
>
>
> How can I get a list of all top level classes?
>
> TIA,
> Hugo F.
>
>
> -------------------------------------------------------------------------
> To unsubscribe go to http://protege.stanford.edu/community/subscribe.html
>
>

-------------------------------------------------------------------------
To unsubscribe go to http://protege.stanford.edu/community/subscribe.html

Reply | Threaded
Open this post in threaded view
|

Re: Getting list of owl:Thing's sub-classes

Hugo Ferreira
Hi Tania,

Tania Tudorache wrote:

> Hugo,
>
> you can use the following call to get all subclasses of owl:Thing:
>
>    owlModel.getOWLThingClass().getNamedSubclasses()
>
> This will probably return more than what you want (also RDFSNamedClasses
> - that are by default hidden in Protege GUI). You can iterate through
> the collection and get only the OWLNamedClasses.
>

Exactly what I was trying. So happens that I had a bug 8-{

Thanks,
Hugo F.

> Tania
>
>
>
> Hugo Ferreira wrote:
>
>> Hi,
>>
>> I would like to load an ontology programmatically, obtain the "top"
>> owl:Thing  and then obtain all of its subclasses i.e: effectively list
>> all top-level classes.
>>
>> The use of:
>>         OWLNamedClass top = model.getOWLThingClass();
>> or
>>         OWLNamedClass top = model.getOWLNamedClass("owl:Thing");
>>
>> does not return a "OWLNamedClass" typed object as does:
>>
>>     OWLNamedClass top = model.getOWLNamedClass("VegetarianPizza");
>>
>>
>> How can I get a list of all top level classes?
>>
>> TIA,
>> Hugo F.
>>
>>
>> -------------------------------------------------------------------------
>> To unsubscribe go to http://protege.stanford.edu/community/subscribe.html
>>
>>
>
> -------------------------------------------------------------------------
> To unsubscribe go to http://protege.stanford.edu/community/subscribe.html
>
>

-------------------------------------------------------------------------
To unsubscribe go to http://protege.stanford.edu/community/subscribe.html