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

Reply via email to