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

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

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

Graph.clear介绍

[英]Remove all the statements from this graph.
[中]删除此图中的所有语句。

代码示例

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

@Override
public Model removeAll()
{ 
  getGraph().clear();
  return this; 
}

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

@Override
public Model removeAll()
{ 
  getGraph().clear();
  return this; 
}

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

@Override
protected Graph emptyGraph() {
  graph.clear() ;
  return graph ;
}

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

@Override
protected Graph emptyGraph() {
  graph.clear() ;
  return graph ;
}

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

@Override
public void clear()
{
  base.clear() ;
  getEventManager().notifyEvent(this, GraphEvents.removeAll ) ;   
}

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

/** Clear a graph - this leaves the storage choice and setup in-place */ 
  protected void clearGraph(Target target) {
    Graph g = target.graph() ;
    g.getPrefixMapping().clearNsPrefixMap() ;
    g.clear() ;
  }
}

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

@SuppressWarnings("deprecation")
@Override
protected final long writeOutput(Writer writer) {
  if (this.g.size() == 0)
    return 0;
  RDFDataMgr.write(writer, this.g, this.getRdfLanguage());
  this.g.clear();
  return this.g.size();
}

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

@Override
public void clear() {
  // Delete all triples in the default graph 
  getDefaultGraph().clear() ;
  // Now remove the named graphs (but don't clear them - they may be shared).
  List<Node> gnList = Iter.toList(listGraphNodes()) ;
  for ( Node gn : gnList ) {
    removeGraph(gn) ;
  }
}

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

public void testRemoveAllEvent()
{
  Graph g = getAndRegister( L );
  g.clear();
  L.assertHas( new Object[] { "someEvent", g, GraphEvents.removeAll } );        
}

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

protected void defaultGraphData(DatasetGraph gStore, Graph data) {
  Graph g = gStore.getDefaultGraph() ;
  g.clear() ;
  GraphUtil.addInto(g, data) ;
}

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

@Override
public void clear()
{
  getRawGraph().clear() ;
  discardState();
  rebind();
  getEventManager().notifyEvent( this, GraphEvents.removeAll );
}

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

@Override
public void clear()
{
  getRawGraph().clear() ;
  discardState();
  rebind();
  getEventManager().notifyEvent( this, GraphEvents.removeAll );
}

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

@Before public void before()
{ 
  try {
    graph.clear() ;
  } catch (Exception ex)
  {
    Log.warn(this, "before() : "+ex.getMessage(), ex) ;
    // Problem - reset.
    beforeClass() ;
  }
  
}

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

@Test(expected = UnsupportedOperationException.class)
public void noClearingDefaultGraph() {
  emptyDsg().getDefaultGraph().clear();
}

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

@Test(expected = UnsupportedOperationException.class)
public void noClearingANamedGraph() {
  Node graphName = NodeFactory.createBlankNode();
  emptyDsg().getGraph(graphName).clear();
}

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

public void testRemoveAll( String triples )
{
  Graph g = getGraph();
  graphAdd( g, triples );
  g.clear();
  assertTrue( g.isEmpty() );
}

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

public void testRemoveAll( String triples )
{
  Graph g = getGraph();
  graphAdd( g, triples );
  g.clear();
  assertTrue( g.isEmpty() );
}

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

protected void namedGraphData(DatasetGraph gStore, Node uri, Graph data) {
  Graph g = gStore.getGraph(uri) ;
  if ( g == null ) {
    gStore.addGraph(uri, GraphFactory.createJenaDefaultGraph()) ;
    g = gStore.getGraph(uri) ;
  } else
    g.clear() ;
  GraphUtil.addInto(g, data) ;
}

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

@Test public void linkAdd_01() {
  Graph graph = SSE.parseGraph("(graph (:s :p :o))") ;
  Node g = SSE.parseNode(":g") ;
  DatasetGraph dsg = emptyDataset() ;
  dsg.addGraph(g, graph);
  graph.clear(); 
  assertTrue(graph.isEmpty()) ;
  assertTrue(dsg.getGraph(g).isEmpty()) ;
}

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

@Test public void copyAdd_01() {
    Graph graph = SSE.parseGraph("(graph (:s :p :o))") ;
    Node g = SSE.parseNode(":g") ;
    DatasetGraph dsg = emptyDataset() ;
    dsg.addGraph(g, graph);
    graph.clear(); 
    assertTrue(graph.isEmpty()) ;
    assertFalse(dsg.getGraph(g).isEmpty()) ;
  }
}

相关文章