Owl2Java – A Java Code Generator for OWL

The elevator speech: Based on the jena semantic web framework owl2java is a code generator to work with OWL ontologies from java. Ontologies are accessed natively via java classes, methods and attributes. A native interface for the object orierented database db4o with support for transparent persistence can be generated from the internal meta model. Where possible, the implementation adheres to the OWL DL standard and also offers some support for constructs that normally require a reasoner.

Interested? Have a look at this post outlining current developments.

The project consists of two different blocks of functionality, namely

  • Owl2Jena – transparent access to a ontology via a jena based java api
  • Owl2Db4o – transformation of ontologies to db4o compliant object models with instance mapping

This plugin was developed as part of my PHD-Thesis at the Chair of Naval Architecture at the University of Rostock and is published under the GPL 2.0.

Owl2Jena

Similar to alternative projects like Kazuki or RdfReactor owl2java generates a Java API from a given ontology schema for the handling of OWL instance data. This allows to reuse existing information from an ontology from java. For an alternative approach based on annotated java classes, see e. g. JenaBean.

Also, Owl2Java includes a generator to transform OWL ontologies into a db4o objects and instance data. A tool for automatic mapping of instance data is included.

Based on Jena 2 the API allows for the seamless integration of OWL ontologies into applications and makes persistent data stored in an ontology available transparently.

Think Java Objects and not Statements or Triples

This means, you use native java objects and interact with the ontology via person.setName(“Homer Simpson”). Triples or statements are avoided. All actions on the API are directly translated into the corresponding triple constructs of the Jena DB. Using one of the local or remote database options of Jena distributed systems can be developed easily.

Comfortable editing environment

With ontology editors like Protege or Topbraid Composer developing data models and manipulating instance data in a common environment is possible.

Owl2Db4o

Working, yet not nearly as polished as Owl2Jena, this component maps ontologies to a db4o compliant class hierarchy with support for transparent persistence. Using an auto-generated java class instance data can be transformed from OWL to db4o.

Further information

Owl2Jena

Owl2Db4o

Installation

Owl2java is free for non-commercial use and published under the GPL license.

The main generator components can be found in de.incunabulum.owl2java.core. Owl2Java and Owl2Db4o can be used from within Topbraid Composer using the plugins found in de.incunabulum.owl2java.plugin.

To install, just copy the jars provided below into your eclipse plugins folder.

Downloads

Version 1.0.0 – Initial public release. This release includes a fully working jena code generator for transparent access to an OntModel. A first stab at a db4o generator with automatic instance mapping is included, too.

Version 1.0.2 (2009/02/19) – Minor changes. The code generation templates have been improved, so that the number of compiler warnings is reduced. These jars contain the full source code.

Updated versions can be found on my eclipse update site: http://mz.incunabulum.de/eclipse. The source is available in my public svn repository svn://incunabulum.de/projects.