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

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

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

Graph.remove介绍

[英]Remove all triples that match by find(s, p, o)
[中]删除按查找匹配的所有三元组(s、p、o)

代码示例

代码示例来源:origin: org.aksw.commons/jena-jgrapht-bindings

@Override
public boolean removeVertex(Node v) {
  graph.remove(v, confinementPredicate, Node.ANY);
  graph.remove(Node.ANY, confinementPredicate, v);
  // FIXME Return proper result
  return true;
}

代码示例来源:origin: org.aksw.commons/jena-jgrapht-bindings

@Override
public Set<Triple> removeAllEdges(Node sourceVertex, Node targetVertex) {
  graph.remove(sourceVertex, confinementPredicate, targetVertex);
  return null;
}

代码示例来源:origin: vivo-project/Vitro

@Override
public void remove(Node arg0, Node arg1, Node arg2) {
  graph.remove(arg0, arg1, arg2);
}

代码示例来源:origin: vivo-project/Vitro

@Override
public void remove(Node arg0, Node arg1, Node arg2) {
  try {
    regenerateIfClosed();
    g.remove(arg0, arg1, arg2);
  } catch (Exception e) {
    regenerate();
    g.remove(arg0, arg1, arg2);
  }
}

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

@Override
public void remove(Node s, Node p, Node o)
{
  base.remove(s,p,o) ;
  getEventManager().notifyEvent(this, GraphEvents.remove(s, p, o) ) ;
}

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

@Override
public void remove(Node s, Node p, Node o)
{
  base.remove(s,p,o) ;
  getEventManager().notifyEvent(this, GraphEvents.remove(s, p, o) ) ;
}

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

@Override
public void remove(final BlankNodeOrIRI subject, final IRI predicate, final RDFTerm object) {
  graph.remove(toJenaPattern(subject), toJenaPattern(predicate),
      toJenaPattern(object));
}

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

@Override
public Model removeAll( Resource s, Property p, RDFNode o )
{
  getGraph().remove( asNode( s ), asNode( p ), asNode( o ) );
  return this;
}

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

@Override
public Model removeAll( Resource s, Property p, RDFNode o )
{
  getGraph().remove( asNode( s ), asNode( p ), asNode( o ) );
  return this;
}

代码示例来源:origin: org.aksw.commons/jena-jgrapht-bindings

@Override
public boolean removeEdge(Triple e) {
  if(!e.getPredicate().equals(confinementPredicate) && !confinementPredicate.equals(Node.ANY)) {
    throw new RuntimeException("Cannot remove edge outside of confinement - predicate must be: " + confinementPredicate + " but got " + e);
  }
  graph.remove(e.getSubject(), e.getPredicate(), e.getObject());
  return true;
}

代码示例来源:origin: vivo-project/Vitro

private void stageAddition(Triple t) {
  if(removalsGraph.contains(t)) {
    removalsGraph.remove(t.getSubject(), t.getPredicate(), t.getObject());
  } else {
    additionsGraph.add(t);
  }
}

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

@Override
public void remove( Node s, Node p, Node o )
{
  getRawGraph().remove( s, p, o );
  discardState();
  rebind();
  getEventManager().notifyEvent( this, GraphEvents.remove( s, p, o ) );
}

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

@Override
public void remove( Node s, Node p, Node o )
{
  getRawGraph().remove( s, p, o );
  discardState();
  rebind();
  getEventManager().notifyEvent( this, GraphEvents.remove( s, p, o ) );
}

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

@Test(expected = UnsupportedOperationException.class)
public void noRemovingFromANamedGraph() {
  Node graphName = NodeFactory.createBlankNode();
  emptyDsg().getGraph(graphName).remove(null, null, null);
}

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

public void testRemoveSomeEvent()
{
  Graph g = getAndRegister( L );
  Node S = node( "S" ), P = node( "??" ), O = node( "??" );
  g.remove( S, P, O );
  Object event = GraphEvents.remove( S, P, O );
  L.assertHas( new Object[] { "someEvent", g, event } );        
}

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

public void testRemoveSomeEvent()
{
  Graph g = getAndRegister( L );
  Node S = node( "S" ), P = node( "??" ), O = node( "??" );
  g.remove( S, P, O );
  Object event = GraphEvents.remove( S, P, O );
  L.assertHas( new Object[] { "someEvent", g, event } );        
}

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

@Test public void remove_01()
{
  Graph g = emptyGraph() ;
  Triple t1 = triple(s1, p1, o1) ;
  g.add(t1) ;
  g.remove(any, any, any) ;
  assertEquals(0, g.size()) ;
  returnGraph(g) ;
}

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

@Test public void remove_03()
{
  Graph g = emptyGraph() ;
  Triple t1 = triple(s1, p1, o1) ;
  g.add(t1) ;
  g.remove(s1, any, any) ;
  assertEquals(0, g.size()) ;
  returnGraph(g) ;
}

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

@Before
public void setUp() throws Exception {
  baseGraph = createGraph();
  baseGraph.remove(Node.ANY, Node.ANY, Node.ANY);
  securedGraph = org.apache.jena.permissions.Factory
      .getInstance(securityEvaluator,
          "http://example.com/securedGraph", baseGraph);
  s = NodeFactory.createURI("http://example.com/securedGraph/s");
  p = NodeFactory.createURI("http://example.com/securedGraph/p");
  o = NodeFactory.createURI("http://example.com/securedGraph/o");
  t = new Triple(s, p, o);
  baseGraph.add(t);
}

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

@Test public void remove_02()
{
  Graph g = emptyGraph() ;
  Triple t1 = triple(s1, p1, o1) ;
  g.add(t1) ;
  g.remove(s2, any, any) ;
  assertEquals(1, g.size()) ;
  assertTrue(g.contains(t1)) ;
  returnGraph(g) ;
}

相关文章