You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Umar Minhas <uf...@gmail.com> on 2015/07/30 04:23:31 UTC

Reading particular RDFS tags through the Jena API

Hi,

I am working with an OWL file. And lets say one of the classes is defined
as:

    <owl:Class rdf:about="EmployeeCompensation">
        <rdfs:alias>salary</rdfs:alias>
         <rdfs:alias>earning</rdfs:alias>
           ....
         < other properties defined ... omitted>
          ....
    </owl:Class>

The above example states that I have an OWL Class "EmployeeCompensation"
and I have defined "salary" and "earning" as synonyms for this class using
"rdfs:alias" tag.

How can I read all aliases for Class EmployeeCompensation using the Jena
API. Any help/pointers are much appreciated.

Thanks,
-Umar

Re: Reading particular RDFS tags through the Jena API

Posted by Umar Minhas <uf...@gmail.com>.
Thanks Martynas.

In my case, it is more like an annotation i.e., for my example, I do not
have classes defined for "earning" and "salary" as well. Which is what, I
think, you'd need to use equivalentClass?

Thanks for the pointer to SKOS -- I'll take a look.

Regards,
-Umar

On Thu, Jul 30, 2015 at 2:49 PM, Martynas Jusevičius <ma...@graphity.org>
wrote:

> Umar,
>
> could it be owl:equivalentClass?
> http://www.w3.org/TR/owl-ref/#equivalentClass-def
>
> SKOS vocabulary can also be useful: http://www.w3.org/TR/skos-primer/
>
>
> Martynas
> graphityhq.com
>
> On Thu, Jul 30, 2015 at 11:45 PM, Umar Minhas <uf...@gmail.com> wrote:
> > That worked like a charm. Thank you very much Dave!
> >
> > Generally speaking, is their a better (more standard) way of capturing
> > synonyms for concepts, properties etc. ?
> >
> > Regards,
> > -Umar
> >
> > On Thu, Jul 30, 2015 at 12:25 AM, Dave Reynolds <
> dave.e.reynolds@gmail.com>
> > wrote:
> >
> >> On 30/07/15 03:23, Umar Minhas wrote:
> >>
> >>> Hi,
> >>>
> >>> I am working with an OWL file. And lets say one of the classes is
> defined
> >>> as:
> >>>
> >>>      <owl:Class rdf:about="EmployeeCompensation">
> >>>          <rdfs:alias>salary</rdfs:alias>
> >>>           <rdfs:alias>earning</rdfs:alias>
> >>>             ....
> >>>           < other properties defined ... omitted>
> >>>            ....
> >>>      </owl:Class>
> >>>
> >>> The above example states that I have an OWL Class
> "EmployeeCompensation"
> >>> and I have defined "salary" and "earning" as synonyms for this class
> using
> >>> "rdfs:alias" tag.
> >>>
> >>
> >> There is no rdfs:alias. If you want to create a new metadata property
> for
> >> annotating classes it would better to do so in your own vocabulary.
> >>
> >> How can I read all aliases for Class EmployeeCompensation using the Jena
> >>> API. Any help/pointers are much appreciated.
> >>>
> >>
> >> Just like any other RDF query you can use listStatements,
> listProperties,
> >> etc.
> >>
> >> First, since rdfs:alias isn't a real thing and isn't in the RDFS
> >> vocabulary you'll need to create a property to allow you to refer to
> that,
> >> e.g.
> >>
> >> Property alias = ResourceFactory.createProperty(RDFS.getURI(), "alias");
> >>
> >> Then you can do things like:
> >>
> >>    for (StmtIterator i = myclass.listProperties(alias); i.hasNext();) {
> >>        System.out.println( i.next().getObject() )
> >>    }
> >>
> >> Dave
> >>
>

Re: Reading particular RDFS tags through the Jena API

Posted by Martynas Jusevičius <ma...@graphity.org>.
Umar,

could it be owl:equivalentClass?
http://www.w3.org/TR/owl-ref/#equivalentClass-def

SKOS vocabulary can also be useful: http://www.w3.org/TR/skos-primer/


Martynas
graphityhq.com

On Thu, Jul 30, 2015 at 11:45 PM, Umar Minhas <uf...@gmail.com> wrote:
> That worked like a charm. Thank you very much Dave!
>
> Generally speaking, is their a better (more standard) way of capturing
> synonyms for concepts, properties etc. ?
>
> Regards,
> -Umar
>
> On Thu, Jul 30, 2015 at 12:25 AM, Dave Reynolds <da...@gmail.com>
> wrote:
>
>> On 30/07/15 03:23, Umar Minhas wrote:
>>
>>> Hi,
>>>
>>> I am working with an OWL file. And lets say one of the classes is defined
>>> as:
>>>
>>>      <owl:Class rdf:about="EmployeeCompensation">
>>>          <rdfs:alias>salary</rdfs:alias>
>>>           <rdfs:alias>earning</rdfs:alias>
>>>             ....
>>>           < other properties defined ... omitted>
>>>            ....
>>>      </owl:Class>
>>>
>>> The above example states that I have an OWL Class "EmployeeCompensation"
>>> and I have defined "salary" and "earning" as synonyms for this class using
>>> "rdfs:alias" tag.
>>>
>>
>> There is no rdfs:alias. If you want to create a new metadata property for
>> annotating classes it would better to do so in your own vocabulary.
>>
>> How can I read all aliases for Class EmployeeCompensation using the Jena
>>> API. Any help/pointers are much appreciated.
>>>
>>
>> Just like any other RDF query you can use listStatements, listProperties,
>> etc.
>>
>> First, since rdfs:alias isn't a real thing and isn't in the RDFS
>> vocabulary you'll need to create a property to allow you to refer to that,
>> e.g.
>>
>> Property alias = ResourceFactory.createProperty(RDFS.getURI(), "alias");
>>
>> Then you can do things like:
>>
>>    for (StmtIterator i = myclass.listProperties(alias); i.hasNext();) {
>>        System.out.println( i.next().getObject() )
>>    }
>>
>> Dave
>>

Re: Reading particular RDFS tags through the Jena API

Posted by Umar Minhas <uf...@gmail.com>.
That worked like a charm. Thank you very much Dave!

Generally speaking, is their a better (more standard) way of capturing
synonyms for concepts, properties etc. ?

Regards,
-Umar

On Thu, Jul 30, 2015 at 12:25 AM, Dave Reynolds <da...@gmail.com>
wrote:

> On 30/07/15 03:23, Umar Minhas wrote:
>
>> Hi,
>>
>> I am working with an OWL file. And lets say one of the classes is defined
>> as:
>>
>>      <owl:Class rdf:about="EmployeeCompensation">
>>          <rdfs:alias>salary</rdfs:alias>
>>           <rdfs:alias>earning</rdfs:alias>
>>             ....
>>           < other properties defined ... omitted>
>>            ....
>>      </owl:Class>
>>
>> The above example states that I have an OWL Class "EmployeeCompensation"
>> and I have defined "salary" and "earning" as synonyms for this class using
>> "rdfs:alias" tag.
>>
>
> There is no rdfs:alias. If you want to create a new metadata property for
> annotating classes it would better to do so in your own vocabulary.
>
> How can I read all aliases for Class EmployeeCompensation using the Jena
>> API. Any help/pointers are much appreciated.
>>
>
> Just like any other RDF query you can use listStatements, listProperties,
> etc.
>
> First, since rdfs:alias isn't a real thing and isn't in the RDFS
> vocabulary you'll need to create a property to allow you to refer to that,
> e.g.
>
> Property alias = ResourceFactory.createProperty(RDFS.getURI(), "alias");
>
> Then you can do things like:
>
>    for (StmtIterator i = myclass.listProperties(alias); i.hasNext();) {
>        System.out.println( i.next().getObject() )
>    }
>
> Dave
>

Re: Reading particular RDFS tags through the Jena API

Posted by Dave Reynolds <da...@gmail.com>.
On 30/07/15 03:23, Umar Minhas wrote:
> Hi,
>
> I am working with an OWL file. And lets say one of the classes is defined
> as:
>
>      <owl:Class rdf:about="EmployeeCompensation">
>          <rdfs:alias>salary</rdfs:alias>
>           <rdfs:alias>earning</rdfs:alias>
>             ....
>           < other properties defined ... omitted>
>            ....
>      </owl:Class>
>
> The above example states that I have an OWL Class "EmployeeCompensation"
> and I have defined "salary" and "earning" as synonyms for this class using
> "rdfs:alias" tag.

There is no rdfs:alias. If you want to create a new metadata property 
for annotating classes it would better to do so in your own vocabulary.

> How can I read all aliases for Class EmployeeCompensation using the Jena
> API. Any help/pointers are much appreciated.

Just like any other RDF query you can use listStatements, 
listProperties, etc.

First, since rdfs:alias isn't a real thing and isn't in the RDFS 
vocabulary you'll need to create a property to allow you to refer to 
that, e.g.

Property alias = ResourceFactory.createProperty(RDFS.getURI(), "alias");

Then you can do things like:

    for (StmtIterator i = myclass.listProperties(alias); i.hasNext();) {
        System.out.println( i.next().getObject() )
    }

Dave