org.apache.jena.graph.Graph.getEventManager()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(5.9k)|赞(0)|评价(0)|浏览(159)

本文整理了Java中org.apache.jena.graph.Graph.getEventManager()方法的一些代码示例,展示了Graph.getEventManager()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Graph.getEventManager()方法的具体详情如下:
包路径:org.apache.jena.graph.Graph
类名称:Graph
方法名:getEventManager

Graph.getEventManager介绍

[英]Answer this Graph's event manager.
[中]回答此图表的事件管理器。

代码示例

代码示例来源:origin: apache/jena

@Override
  public void event(Object dest, Event event)
  {
    graph.getEventManager().notifyEvent( graph , GraphEvents.finishRead ) ;
  }
} ;

代码示例来源:origin: apache/jena

public static void add(Graph graph, List<Triple> triples) {
  addIteratorWorkerDirect(graph, triples.iterator()) ;
  if ( OldStyle && graph instanceof GraphWithPerform )
    graph.getEventManager().notifyAddList(graph, triples) ;
}

代码示例来源:origin: org.apache.jena/jena-core

public static void add(Graph graph, List<Triple> triples) {
  addIteratorWorkerDirect(graph, triples.iterator()) ;
  if ( OldStyle && graph instanceof GraphWithPerform )
    graph.getEventManager().notifyAddList(graph, triples) ;
}

代码示例来源:origin: apache/jena

void unregisterFrom(Graph g) {
  registered = false;
  inPlay = false;
  g.getEventManager().unregister(this);
}
void start() {

代码示例来源:origin: apache/jena

/**
 * 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) ;
}

代码示例来源:origin: apache/jena

/**
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;
 }

代码示例来源:origin: apache/jena

@Override
     public Model notifyEvent( Object e )
     {
       getGraph().getEventManager().notifyEvent( getGraph(), e );
       return this;
     }
}

代码示例来源:origin: apache/jena

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);
}

代码示例来源:origin: org.apache.jena/jena-core

/**
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;
 }

代码示例来源:origin: org.apache.jena/jena-core

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) ; 
  }
}

代码示例来源:origin: org.apache.jena/jena-core

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);
}

代码示例来源:origin: org.apache.jena/jena-core

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);
}

代码示例来源:origin: apache/jena

/** 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 );
}

代码示例来源:origin: org.apache.jena/jena-core

/** 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 );
}

代码示例来源:origin: apache/jena

/**
  Test that we can safely unregister a listener that isn't registered.
 */
public void testEventUnregister()
{
  getGraph().getEventManager().unregister( L );
}

代码示例来源:origin: apache/jena

/**
  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;
}

代码示例来源:origin: apache/jena

public void testRegisterTwice()
{
  Graph g = getAndRegister( L );
  g.getEventManager().register( L );
  g.add( SPO );
  L.assertHas( new Object[] {"add", g, SPO, "add", g, SPO} );
}

代码示例来源:origin: apache/jena

@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;
  }
}

代码示例来源:origin: apache/jena

@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"));
}

代码示例来源:origin: apache/jena

@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"))));
}

相关文章