Hello Andy and other Jena enthusiasts,
Huge thanks to Andy for the prompt answer to my initial question.
Andy wrote:
You will need to get the DatasetGraph, wrap it in a
DatasetGraphMonitor and put back the Dataset layer.
Thank you for the pointer to DatasetGraphMonitor, it is definitely what
I was looking for!
The results I have so far are that, still using Jena 2.10.1 (but also
comparing source with
v2.11.1 using GrepCode.com):
1) DatasetGraphMonitor does not implement Transactional. So if I want
to both monitor and support transactions, it seems I will need to make
a class extending DatasetGraphMonitor, which implements Transactional
by simply delegating to the result of getWrapped(). Or perhaps Andy
meant something more sophisticated by “put back the Dataset layer”?
I am using:
com.hp.hpl.jena.query.DatasetFactory.create(monitoringDsetGraph),
to create a new wrapping dataset around my DatasetGraphMonitor. It looks
like that would return a transactional DatasetImpl *if* monitoringDsetGraph
were Transactional.
2) The DatasetGraphMonitor does deliver Quads to my DatasetChanges
listener during SPARQL
Update, but does not hear any Quads that arrive through the Model
interface, or from a LOAD
request sent through com.hp.hpl.jena.sparql.modify.request.UpdateLoad.
(If that is not
expected behavior, then I can try it with latest Jena). As I noted
before, both of the latter do trigger the ModelChangedListener. So it
seems that we now have two disjoint
streams of monitoring available, with exactly one of them notified for
each change,
depending on the pathway used to modify the graphs. If I wanted a universal
Dataset-contents-change-monitor, it seems I would need to listen on
both of these
channels:
DatasetChanges registered with DatasetGraphMonitor
- monitors entire Dataset with a single registration
- hears changes only from SPARQL Update (or any other
adds/deletes made through the
DatasetGraph/Quad pathway - such as from _____).
ModelChangedListener registered with separate Models retrieved
from Dataset
- monitors a single model/graph, for each registration
- hears changes only from Model API and ARQ-UpdateLoad (and
SPARQL-HTTP-put?)
Is this summary correct? I don't know an easy way to find out
conclusively about the
SPARQL-HTTP-put and minor variations of that form of update. Are they
equivalent (for
monitoring purposes) to
com.hp.hpl.jena.sparql.modify.request.UpdateLoad? As noted
above, the latter seems to go through the model path, not the quad-store path.
Stu B22
http://glue.ai