Java Data Binding / Data-driven approach
Posted by Martin Homik | Posted in Java, Semantic Web, WebApp | Posted on 04-12-2007
0
I have to write this article for myself, because I am very forgetful. In a world dominated by so many technical terms and products it is not easy to find the right sources and solution. In my case, the following scenario is present: I want to have a web application including a database storage and remote services. This incorporates a set of classes, a database schema and a XML representation of my data model. In addition, the xml representation can comply to some well-known XSD standard or it can be formulated in some Semantic Web language such as OWL. Because so many components interact with each other they share a common data model but each component uses its own representation of the information.
- The relation database uses a database schema formulated in SQL
- The Java classes comply to a Java specification.
- Semantic Triple stores base on RDFS and/or on OWL
- Web Services communicate via WSDL.
- And finally there also exist XSD definitions of a data model for interoperability.
The ultimate question is, how can I select one representation and generate all other representations? This approach is data-driven.
Hibernate Tools allow to create a set of POJOs from a database schema and vice versa a database schema from a set of JPA annotated classes. AppFuse applies HibernateTools for database creation from POJOs. POJOs also serve as sources for generation of WSDL files. Java XML Binding frameworks such as JAXB, JaxMe, or XMLBeans help to create POJOs from XSD files. POJOs created by these tools can be streamed to XML files that correspond to the origin XSD. And finally, RDFReactor can take an OWL file and create a POJO which can be used for persisting into a triple store.
So, you see the flow is not easy, as it is interrupted. While you can create POJOs with Java XML Binding tools, these POJOs are not annoted by JPAs such that an automatic generation of a database schema is not possible. In any case, if a solution exists that unifies all streams then it should be an easy-to-use approach. And this is hard to find.
Java XML Binding:
- JAXB This is a reference implementation. There is a lot action here and the hige community.
- JaxMe 2 In my opinion, this started as an ambitious project but lost much motivation. I do not know whether it cas been stopped, but the last news message is from 2006. A pity, because it delivered a “complete” approach tying POJOs/Beans, XML files, and (XML) databases together.
- XMLBeans Though still one of the most active projects, I always considered this as a package monster. Good for Java/XML Binding.
- Castor provides Java-to-XML binding, Java-to-SQL persistence, and more.
- JibX is a fast Java XML Binding framework.
Java Database Binding:
- Hibernate Tools; needs JPA annotation
- Castor provides Java-to-XML binding, Java-to-SQL persistence, and more.
Java RDF/OWL Binding:
- Jastor This an open source Java code generator that emits Java Beans from Web Ontologies (OWL) enabling convenient, type safe access and eventing of RDF stored in a Jena Semantic Web Framework model. As mentioned it is programmed against Jena making an application dependent on a particular RDF Triple Store.
- RDFReactor RDFReactor views the RDF data model through object-oriented Java proxies. It makes using RDF easy for Java developers. It is independent of a specific RDF store. It is still under development and rather a research project.
Application Frameworks
- AppFuse
- IBM semantic Application Layer / Boca It seems as if work on this interesting project stopped in Feb 2007.
Further Reading:
- Wikipedia on XML Bindin
- Article on Java XML Binding
- Another article
- A series of Java and XML data binding articles.

