I need to query my local Hibernate managed datastore for persisted objects based on criteria where the relevant data for the WHERE clause is in the Linked Open Data cloud.
Is there a way to read a Hibernate Session as RDF? If so, I can at least use the combined Dataset to decide what objects to retrieve from Hibernate.
Preferably the solution would expose the Hibernate Session as inside Jena as I'm familiar with it. In addition I'll need support for RDFS inferencing and SPARQL for retrieval.
Here's what I've found since posting the question:
There is no existing tool to triplify the Hibernate Session specifically. To implement one myself I need to implement Graph perhaps using GraphBase as a basis, or StageGenerator. The answer to the question is therefore "there isn't one", so I went on to consider how to implement it.
I need to decide whether to triplify objects already in the session (i.e. already accessed by some earlier query), rely on accessing the database or do both. If going to the database I also need to decide whether to load whole objects which will then be attached to the session or use projection to save bringing extra data into the heap at the expense of additional round-trips.
Using Graph is apparently essential for supporting inferencing, though its slower than using ARQs StageGenerator since that can query a set of triple patterns, however this makes it essential to always use SPARQL which seems a bit inflexible.
So far, the optimum solution appears to be:
There is another SPI called OpExecutor which may help to push FILTER resolution into the database, therefore improving performance further.
At the moment I've taken this on as a side project, which I may well release as LGPL software.