views:

136

answers:

4

Hi,
I have an ontology file (in RDF) which expresses the entities in the app that I am writing. I am using Jena, and can access the Concepts and create/access the resources by directly manipulating triples.

To make things easier, I created a set of Java classes, one for each type of resource in my ontology, keeping in mind their inheritances, and properties. E.g.

public class Agent{
}

and

public class Person extends Agent{
  private String name;
}

If the ontology contains two types of resources, Agent and Person, with the latter being a subclass of the former.

I realized that the process of creating these classes (and the methods to extract them) are very monotonous. If I was writing an application on databases, I would have used a config file for Hibernate and let it take care of the details.

My question is: Is there a tool available that will take an ontology (in an RDF file) as input, and create a set of Java files representing the Concepts in the ontology, as in the example above? (or if Jena itself can do this, and I am missing something)

Thanks.

A: 

Did u checked JRDF? There are other code generation tools available too.. Check here.

Teja Kantamneni
Thanks.From the JRDF page"Future features may include:An RDF to Java object API (similar to Hibernate or Sesame's Elmo),"So I think this is not yet supported. Will check out RDFReactor, Kazuki, and Owl2Java from the other page.
Animesh
+1  A: 

Protege supports RDF import and java export. I've used it in the past for getting ontology data into java programs and it's worked reasonably.

Paul Rubel
Thanks. I assume you mean using the BeanGenerator plugin at http://sharon.cselt.it/projects/jade/doc/tutorials/beangenerator/beangenerator.html . I will try it.
Animesh
A: 

While going through the links provided above, I chanced upon the Trispresso Project, which provides a nice summary of the relevant tools and their features, including multiple inheritance and code generation. Thought it would make a good answer to my own question.

Animesh
A: 

There are tools such as Bouml and Andromda with which you may generate Java from XMI UML serialization.

Furthermore, work has been done towards integrating UML with RDF: http://infolab.stanford.edu/~melnik/rdf/uml/.

So I guess you could find a way to transform your RDF to XMI then to generate Java from XMI, given you first map your initial RDF schema to RDF/UML.

Also I just found this paper: Automatic Mapping of OWL Ontologies into Java which I did not read so I cannot comment.

Amyn Bennamane