3
votes

I'm a Java developer just getting started with linked data/RDF. I can create triples, put them in a triple store, query them, etc, but it's very awkward. Most of my code is focused on the mechanics of RDF and I'd really like to work with this data in a way that's more idiomatic Java.

How can I convert a POJO to/from RDF triples with Jena without hand-coding everything?


I'd like something that can convert a pile of triples with a defined structure back and forth between a Java POJO and RDF. Like JAXB or and ORM does for XML and a relational database, respectively.

Also, I can't be locked in too closely a particular triple store. I'd really like something that works with the Apache Jena API, since that seems to be the closest to an "industry standard." Also the project architect told me to use that, since the triple stores they're investigating all support it.


Stuff I've looked at:

I try out one library that sort of does what I want, but it made some weird choices and I don't really think it will work for me.

Elmo/Alibaba also sounds promising, but it looks like it only works with the Sesame triple store and it also sounds like it may carry a big giant framework and/or server along with it. Has anyone had any success using it with Jena? I haven't actually tried it out.

2
FWIW Sesame is an industry-standard vendor-neutral API for triple stores, just as Jena is. Isn't it nice that you have two standards to choose from? :)Jeen Broekstra
Also: not sure where you're getting that Alibaba "carries a big giant framework and/or server with it", because it's pretty much just a small bunch of Java libraries built on top of the Sesame APIs, which you can very easily include in your own app.Jeen Broekstra
All that being said: questions asking for tool recommendations are considered off-topic here on StackOverflow, as they often attract spam or opinionated answers. So this question is likely to be closed for that reason. I know it's tricky with such a broad subject, but can you try and reformulate in terms of what the problem is, and what you've done sofar to solve it?Jeen Broekstra
Regarding the meta, if a question cannot be asked that could result in the answer "tool X does what you need," then SO is getting pretty useless. If people want to answer with non-tool techniques for easily converting between POJOs and RDF, they're welcome to.Kaypro II
Well, your question is too broad (because you haven't actually tried anything) as well as asking for tool recommendation rather than describing a specific problem. Either way it's offtopic. See stackoverflow.com/help/on-topic . Whether or not you consider that a stupid rule is up to you of course - I'm merely informing you that this is a problem with your question, and that for that reason you are unlikely to get many good answers.Jeen Broekstra

2 Answers

7
votes

There's Empire which is a partial implementation of JPA 1.0 for Object-Triple mapping. It supports Jena, Sesame, and Stardog out of the box, and is pretty easy to add support for other databases.

There's also Pinto which is more akin to Jackson. It's more lightweight than Empire and just does round-tripping to/from RDF & Java beans. It will soon be the engine inside of Empire.

Disclaimer: I'm the author of both.

0
votes

Another possible tool to look at is OLGA - an Ontology SDK. See https://ecostruxure.github.io/OLGA/ .