How testing if an RDFResource is an enumerated class (second sent)

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

How testing if an RDFResource is an enumerated class (second sent)

Arnaud Renouf
I send an another time my question cause I did'nt receive any answer.
Is it so easy ??
"
Hi
I use the Owl api and I want to test if a resource (RDFResource
instance) is an enumerated class.
I try :
"RDFResource valueType = (RDFResource)it.next(); //get the resource from
an iterator on classes
if(valueType instanceof OWLEnumeratedClass) then ...
It seems that it is not good like that : if my resource is an enumerated
class the test stay false.

An idea ??

Thanks
"


--
-----------------------------------------------------
# Arnaud Renouf
# Doctorant (3eme annee)
# Laboratoire GREYC, Equipe Image
# Tel: 02 31 45 27 06
# e-mail: arnaud.renouf <at> greyc.ensicaen.fr
# page perso: http://www.greyc.ensicaen.fr/~arenouf/
-----------------------------------------------------


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

Reply | Threaded
Open this post in threaded view
|

Re: How testing if an RDFResource is an enumerated class (second sent)

Matthew Horridge
Hi Arnaud,

> I send an another time my question cause I did'nt receive any answer.
> Is it so easy ??
> "
> Hi
> I use the Owl api and I want to test if a resource (RDFResource
> instance) is an enumerated class.
> I try :
> "RDFResource valueType = (RDFResource)it.next(); //get the resource  
> from
> an iterator on classes
> if(valueType instanceof OWLEnumeratedClass) then ...
> It seems that it is not good like that : if my resource is an  
> enumerated
> class the test stay false.

This should work.

Can you put some break points in your code so that you can find out  
exactly what Java class valueType is an instance of? Failing this,  
just put a println statement in, something like

System.out.println(valueType.getClass().getName());

Another way around this would be to use the OWLModelVisitor (probably  
OWLModelVisitorAdapter and override the method that visits an  
OWLEnumeratedClass)

Cheers,

Matthew


> An idea ??
>
> Thanks
> "
>
>
> --
> -----------------------------------------------------
> # Arnaud Renouf
> # Doctorant (3eme annee)
> # Laboratoire GREYC, Equipe Image
> # Tel: 02 31 45 27 06
> # e-mail: arnaud.renouf <at> greyc.ensicaen.fr
> # page perso: http://www.greyc.ensicaen.fr/~arenouf/
> -----------------------------------------------------
>
>
> ----------------------------------------------------------------------
> ---
> 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: How testing if an RDFResource is an enumerated class (second sent)

Arnaud Renouf


Matthew Horridge wrote:

> Hi Arnaud,
>
>> I send an another time my question cause I did'nt receive any answer.
>> Is it so easy ??
>> "
>> Hi
>> I use the Owl api and I want to test if a resource (RDFResource
>> instance) is an enumerated class.
>> I try :
>> "RDFResource valueType = (RDFResource)it.next(); //get the resource from
>> an iterator on classes
>> if(valueType instanceof OWLEnumeratedClass) then ...
>> It seems that it is not good like that : if my resource is an enumerated
>> class the test stay false.
>
> This should work.
>
> Can you put some break points in your code so that you can find out
> exactly what Java class valueType is an instance of? Failing this,
> just put a println statement in, something like
>
> System.out.println(valueType.getClass().getName());
I tried that and I have this :
"--Class SaturationQualifier :
edu.stanford.smi.protegex.owl.model.impl.DefaultOWLNamedClass"
the class SaturationQualifier is defined as an OWLEnumeratedClass in the
owl file :
"
 <owl:Class rdf:ID="SaturationQualifier">
    <owl:equivalentClass>
      <owl:Class>
        <owl:oneOf rdf:parseType="Collection">
          <SaturationQualifier rdf:ID="moderate"/>
          <SaturationQualifier rdf:ID="vivid"/>
          <SaturationQualifier rdf:ID="strong"/>
          <SaturationQualifier rdf:ID="grayish"/>
        </owl:oneOf>
      </owl:Class>
    </owl:equivalentClass>
    <rdfs:subClassOf>
      <owl:Class rdf:ID="ColorQualifier"/>
    </rdfs:subClassOf>
  </owl:Class>
"
So do you see where is the problem ?

--
-----------------------------------------------------
# Arnaud Renouf
# Doctorant (3eme annee)
# Laboratoire GREYC, Equipe Image
# Tel: 02 31 45 27 06
# e-mail: arnaud.renouf <at> greyc.ensicaen.fr
# page perso: http://www.greyc.ensicaen.fr/~arenouf/
-----------------------------------------------------


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

Reply | Threaded
Open this post in threaded view
|

Re: How testing if an RDFResource is an enumerated class (second sent)

Matthew Horridge

On 4 May 2006, at 14:49, Arnaud Renouf wrote:

>
>
> Matthew Horridge wrote:
>> Hi Arnaud,
>>
>>> I send an another time my question cause I did'nt receive any  
>>> answer.
>>> Is it so easy ??
>>> "
>>> Hi
>>> I use the Owl api and I want to test if a resource (RDFResource
>>> instance) is an enumerated class.
>>> I try :
>>> "RDFResource valueType = (RDFResource)it.next(); //get the  
>>> resource from
>>> an iterator on classes
>>> if(valueType instanceof OWLEnumeratedClass) then ...
>>> It seems that it is not good like that : if my resource is an  
>>> enumerated
>>> class the test stay false.
>>
>> This should work.
>>
>> Can you put some break points in your code so that you can find  
>> out exactly what Java class valueType is an instance of? Failing  
>> this, just put a println statement in, something like
>>
>> System.out.println(valueType.getClass().getName());
> I tried that and I have this :
> "--Class SaturationQualifier :  
> edu.stanford.smi.protegex.owl.model.impl.DefaultOWLNamedClass"
> the class SaturationQualifier is defined as an OWLEnumeratedClass  
> in the owl file :
> "
> <owl:Class rdf:ID="SaturationQualifier">
>    <owl:equivalentClass>
>      <owl:Class>
>        <owl:oneOf rdf:parseType="Collection">
>          <SaturationQualifier rdf:ID="moderate"/>
>          <SaturationQualifier rdf:ID="vivid"/>
>          <SaturationQualifier rdf:ID="strong"/>
>          <SaturationQualifier rdf:ID="grayish"/>
>        </owl:oneOf>
>      </owl:Class>
>    </owl:equivalentClass>
>    <rdfs:subClassOf>
>      <owl:Class rdf:ID="ColorQualifier"/>
>    </rdfs:subClassOf>
>  </owl:Class>
> "
> So do you see where is the problem ?

Yes.

You need to get the equivalent classes of SaturationQualifier and  
then process those.

Matthew


>
> --
> -----------------------------------------------------
> # Arnaud Renouf
> # Doctorant (3eme annee)
> # Laboratoire GREYC, Equipe Image
> # Tel: 02 31 45 27 06
> # e-mail: arnaud.renouf <at> greyc.ensicaen.fr
> # page perso: http://www.greyc.ensicaen.fr/~arenouf/
> -----------------------------------------------------
>
>
> ----------------------------------------------------------------------
> ---
> 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: How testing if an RDFResource is an enumerated class (second sent)

Arnaud Renouf

>
> Yes.
>
> You need to get the equivalent classes of SaturationQualifier and then
> process those.
>
> Matthew
How can I get the equivalent class ? Is there any method from the API ?

--
-----------------------------------------------------
# Arnaud Renouf
# Doctorant (3eme annee)
# Laboratoire GREYC, Equipe Image
# Tel: 02 31 45 27 06
# e-mail: arnaud.renouf <at> greyc.ensicaen.fr
# page perso: http://www.greyc.ensicaen.fr/~arenouf/
-----------------------------------------------------


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

Reply | Threaded
Open this post in threaded view
|

Re: How testing if an RDFResource is an enumerated class (second sent)

Arnaud Renouf


Arnaud Renouf wrote:

>
>>
>> Yes.
>>
>> You need to get the equivalent classes of SaturationQualifier and
>> then process those.
>>
>> Matthew
> How can I get the equivalent class ? Is there any method from the API ?
>
It is good now. I use the getEquivalentClasses from RDFSClass and use
the test : "instanceof OWLEnumeratedClass".

Thanks for this so quick response.


--
-----------------------------------------------------
# Arnaud Renouf
# Doctorant (3eme annee)
# Laboratoire GREYC, Equipe Image
# Tel: 02 31 45 27 06
# e-mail: arnaud.renouf <at> greyc.ensicaen.fr
# page perso: http://www.greyc.ensicaen.fr/~arenouf/
-----------------------------------------------------


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