Jenabean: Bridging the Gap Between Java Objects and the Semantic Web
Join the DZone community and get the full member experience.Join For Free
The idea for Jenabean started when Cowan was an employee at Sabre Labs working on a web 2.0 project that had things like tags, users, comments, answers, and questions. The interrelated content was new to him so he tried to organize it with related data. Cowan found relational data to be rigid and intractable, so he started looking for new ways of storing data that were flexible and more adept to changes in the schema. He also wanted to find ways of storing data that were willing to accept no schema at all. Through some research, Cowan found what he was looking for in 'triple stores'.
Triple stores can receive data that is reduced down to a very simple structure called a "triple", which consists of a subject, a predicate (verb), and an object. Even complex data can be represented by starting with that simple structure. On top of the triple store is an RDF, which is a semantic web formal specification. Cowan thought he had found the answer to his problems with this data storage mechanism, but there were still some issues with coding.
"I began to write the app," he said, "and I found that I hand to write a lot of boiler-plate code between the Java web application and the triple store in order to retrieve data, show it to the user, and persist data back into the store. I realized that the impedance mismatch between my application, my objects, and the data store was very similar to the impedance mismatch that the object-relational mapping software intends to address." Cowan soon discovered that no one had written a binding between JavaBeans and the Jena RDF framework.
"I took it upon myself to write an open source project that would help people persist JavaBeans and query for those beans," said Cowan. "My intent was that it should work elegantly with MVC containers such as Struts, Stripes, and even things that are model-based like Grails." Cowan named his project "Jenabean" and gave it a liberal Apache License 2.0. Most of the applications that Cowan writes for the semantic web use Jenabean.
Cowan says many of the people who come to his talks are researchers, but he would like to see more application-minded developers become interested in new ways of storing data. He says that Jenabean doesn't require deep, somewhat academic knowledge of the semantic web to convert Java objects to RDF or convert RDF to objects. It's annotations based and there's no XML binding required. Jenabean is also based on plain old Java reflection, so it doesn't require a byte code interweaving library. Cowan said, "It just takes clean Java classes that have been annotated, and follows those annotations as directions for how your objects can be persisted into a graph store."
There's a lot of information on the internet being provided as linked data, said Cowan, and that information is provided as RDF or one of its manifestations. "The developer is going to have to parse these data structures and then merge that into their app, which is most likely a domain model in Java objects," said Cowan. "Jenabean allows you to consume these data sources directly into objects without having to write a lot of boiler-plate code between the data on the extranet and your application. It should save time for developers who want to consume semantic web information."
An overview of the Jenabean programming model is available for Java developers who want to get started with writing for the semantic web. You can download the Jenabean library here.