Hi,
I am using TDB and I'd like to be notified when a triple is added or deleted
to/from a Graph. I am not sure what is the best way to achieve this.

Here is a first attempt (which is not working):

        InputStream in = ...
        DatasetGraphTDB dsg = TDBFactory.createDatasetGraph();

        GraphListener listener = new MyListener();
        dsg.getDefaultGraph().getEventManager().register(listener);
        Iterator<Node> iter = dsg.listGraphNodes();
        while ( iter.hasNext() ) {
                Graph graph = dsg.getGraph(iter.next());
                graph.getEventManager().register(listener);
        }

        TDBLoader.load(dsg, in, false);

MyListener extends GraphListenerBase implements GraphListener.

I don't understand why, even for triples added to the default graph, it
seems the addEvent(Triple t) and the deleteEvent(Triple t) methods in
MyListener are not called.

Is there a better alternative?

I found an EventManager in the ARQ's org.openjena.atlas.event package.
However, I don't think that is actually used to deliver events to
listeners as data is added/removed to/from a Jena Graph.

Thanks,
Paolo

Reply via email to