@Override public void event(Object dest, Event event) { graph.getEventManager().notifyEvent( graph , GraphEvents.finishRead ) ; } } ;
public static void add(Graph graph, List<Triple> triples) { addIteratorWorkerDirect(graph, triples.iterator()) ; if ( OldStyle && graph instanceof GraphWithPerform ) graph.getEventManager().notifyAddList(graph, triples) ; }
public static void add(Graph graph, List<Triple> triples) { addIteratorWorkerDirect(graph, triples.iterator()) ; if ( OldStyle && graph instanceof GraphWithPerform ) graph.getEventManager().notifyAddList(graph, triples) ; }
void unregisterFrom(Graph g) { registered = false; inPlay = false; g.getEventManager().unregister(this); } void start() {
/** * Delete triples in {@code srcGraph} from {@code dstGraph} * by looping on {@code srcGraph}. * */ public static void deleteLoopSrc(Graph dstGraph, Graph srcGraph) { deleteIteratorWorker(dstGraph, findAll(srcGraph)) ; dstGraph.getEventManager().notifyDeleteGraph(dstGraph, srcGraph) ; }
/** Register the listener with this model by registering its GraphListener adaption with the underlying Graph. @param listener A ModelChangedListener to register for model events @return this model, for cascading */ @Override public Model register( ModelChangedListener listener ) { getGraph().getEventManager().register( adapt( listener ) ); return this; }
@Override public Model notifyEvent( Object e ) { getGraph().getEventManager().notifyEvent( getGraph(), e ); return this; } }
public static void delete(Graph graph, Iterator<Triple> it) { if ( OldStyle && graph instanceof GraphWithPerform ) { // Materialize for the notify. List<Triple> s = IteratorCollection.iteratorToList(it) ; deleteIteratorWorkerDirect(graph, s.iterator()); graph.getEventManager().notifyDeleteIterator(graph, s) ; } else deleteIteratorWorker(graph, it); }
/** Unregister the listener from this model by unregistering its GraphListener adaption from the underlying Graph. @param listener A ModelChangedListener to unregister from model events @return this model, for cascading */ @Override public Model unregister( ModelChangedListener listener ) { getGraph().getEventManager().unregister( adapt( listener ) ); return this; }
public static void add(Graph graph, Triple[] triples) { if ( OldStyle && graph instanceof GraphWithPerform ) { GraphWithPerform g = (GraphWithPerform)graph ; for (Triple t : triples ) g.performAdd(t) ; graph.getEventManager().notifyAddArray(graph, triples) ; } else { for (Triple t : triples ) graph.add(t) ; } }
public static void add(Graph graph, Iterator<Triple> it) { if ( OldStyle && graph instanceof GraphWithPerform ) { // Materialize for the notify. List<Triple> s = IteratorCollection.iteratorToList(it) ; addIteratorWorkerDirect(graph, s.iterator()); graph.getEventManager().notifyAddIterator(graph, s) ; } else addIteratorWorker(graph, it); }
public static void delete(Graph graph, Iterator<Triple> it) { if ( OldStyle && graph instanceof GraphWithPerform ) { // Materialize for the notify. List<Triple> s = IteratorCollection.iteratorToList(it) ; deleteIteratorWorkerDirect(graph, s.iterator()); graph.getEventManager().notifyDeleteIterator(graph, s) ; } else deleteIteratorWorker(graph, it); }
/** Add triples into the destination (arg 1) from the source (arg 2)*/ public static void addInto(Graph dstGraph, Graph srcGraph ) { if ( dstGraph == srcGraph && ! dstGraph.getEventManager().listening() ) return ; dstGraph.getPrefixMapping().setNsPrefixes(srcGraph.getPrefixMapping()) ; addIteratorWorker(dstGraph, findAll( srcGraph )); dstGraph.getEventManager().notifyAddGraph( dstGraph, srcGraph ); }
/** Add triples into the destination (arg 1) from the source (arg 2)*/ public static void addInto(Graph dstGraph, Graph srcGraph ) { if ( dstGraph == srcGraph && ! dstGraph.getEventManager().listening() ) return ; dstGraph.getPrefixMapping().setNsPrefixes(srcGraph.getPrefixMapping()) ; addIteratorWorker(dstGraph, findAll( srcGraph )); dstGraph.getEventManager().notifyAddGraph( dstGraph, srcGraph ); }
/** Test that we can safely unregister a listener that isn't registered. */ public void testEventUnregister() { getGraph().getEventManager().unregister( L ); }
/** Utility: get a graph, register L with its manager, return the graph. */ protected Graph getAndRegister( GraphListener gl ) { Graph g = getGraph(); g.getEventManager().register( gl ); return g; }
public void testRegisterTwice() { Graph g = getAndRegister( L ); g.getEventManager().register( L ); g.add( SPO ); L.assertHas( new Object[] {"add", g, SPO, "add", g, SPO} ); }
@Override public Graph getGraph() { final Graph graph = org.apache.jena.permissions.Factory.getInstance(eval, getName(), Factory.createDefaultGraph()); graph.getEventManager().register(new CheckChanges("simple tracking", graph)); return graph; } }
@ContractTest public void testDelete_Triple_FromNothing() { Graph g = producer.newInstance(); g.getEventManager().register(GL); txnBegin(g); g.delete(triple("quint rdf:subject S")); txnCommit(g); GL.assertContains("delete", g, triple("quint rdf:subject S")); }
@ContractTest public void testAdd_Triple() { Graph graph = producer.newInstance(); graph.getEventManager().register(GL); txnBegin(graph); graph.add(triple("S P O")); txnCommit(graph); GL.assertHasStart("add", graph, triple("S P O")); txnRun(graph, () -> assertTrue("Graph should contain <S P O>", graph.contains(triple("S P O")))); }