本文整理了Java中org.apache.jena.graph.Graph.delete()
方法的一些代码示例,展示了Graph.delete()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Graph.delete()
方法的具体详情如下:
包路径:org.apache.jena.graph.Graph
类名称:Graph
方法名:delete
[英]Delete the triple t (if possible) from the set belonging to this graph
[中]从属于此图的集合中删除三重t(如果可能)
代码示例来源:origin: apache/jena
@Override
public void delete(Triple t) throws DeleteDeniedException
{
graph.delete(t) ;
}
代码示例来源:origin: apache/jena
/**
Remove a triple from the difference: remove it from the left operand. [It could
be added to the right operand instead, but somehow that feels less satisfactory.]
*/
@Override public void performDelete( Triple t )
{ L.delete( t ); }
代码示例来源:origin: org.apache.jena/jena-core
/**
Add a triple to the difference: add it to the left operand, and remove it from the
right operand.
*/
@Override public void performAdd( Triple t )
{
L.add( t );
R.delete( t );
}
代码示例来源:origin: apache/jena
/**
* Remove the triple, ie, remove it from the adds, add it to the removals.
*/
@Override
public void performDelete(Triple t)
{
additions.delete(t) ;
if (base.contains(t))
deletions.add(t) ;
}
代码示例来源:origin: apache/jena
@Override
public void delete(final Triple t) throws DeleteDeniedException,
AuthenticationRequiredException {
checkUpdate();
checkDelete(t);
holder.getBaseItem().delete(t);
}
代码示例来源:origin: apache/jena
@Override
public void notifyDeleteIterator(Graph g, Iterator<Triple> it) {
while (it.hasNext()) copy.delete(it.next());
verify();
}
代码示例来源:origin: apache/jena
@Override
public void remove() {
super.remove(); // removes current
g.delete(current); // no-op.
}
};
代码示例来源:origin: org.apache.jena/jena-core
@Override
public void notifyDeleteTriple(Graph g, Triple t) {
copy.delete(t);
verify();
}
代码示例来源:origin: apache/jena
@Override
public void delete(Quad quad)
{
Graph g = fetchGraph(quad.getGraph()) ;
if ( g == null )
throw new JenaException("No such graph: "+quad.getGraph()) ;
g.delete(quad.asTriple()) ;
}
代码示例来源:origin: apache/jena
public void testDeleteTriple()
{
Graph g = getAndRegister( L );
g.delete( SPO );
L.assertHas( new Object[] { "delete", g, SPO} );
}
代码示例来源:origin: apache/jena
public void clearGraph()
{
if ( graph != null )
{
Iterator<Triple> iter = graph.find(Node.ANY, Node.ANY, Node.ANY) ;
List<Triple> triples = Iter.toList(iter) ;
for ( Triple t : triples )
graph.delete(t) ;
}
}
代码示例来源:origin: org.apache.jena/jena-core
public void testDeleteTriple()
{
Graph g = getAndRegister( L );
g.delete( SPO );
L.assertHas( new Object[] { "delete", g, SPO} );
}
代码示例来源:origin: apache/jena
protected void testSingleComponent( Graph g, DisjointUnion du )
{
graphAdd( g, "x R y; a P b; x Q b" );
assertIsomorphic( g, du );
graphAdd( g, "roses growOn you" );
assertIsomorphic( g, du );
g.delete( triple( "a P b" ) );
assertIsomorphic( g, du );
}
代码示例来源:origin: org.apache.jena/jena-core
public void testRemoveBoth()
{
Graph L = graphWith( "x R y; a P b" ), R = graphWith( "x R y; p Q r" );
Graph du = new DisjointUnion( L, R );
du.delete( triple( "x R y" ) );
assertIsomorphic( graphWith( "a P b" ), L );
assertIsomorphic( graphWith( "p Q r" ), R );
}
代码示例来源: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
@Test public void graph_add_delete_02()
{
Graph g = emptyGraph() ;
Triple t = triple(s1, p1, o1) ;
// reversed from above
g.delete(t) ;
g.add(t) ;
assertEquals(1, g.size()) ;
assertTrue("g does not contain t", g.contains(t)) ;
returnGraph(g) ;
}
代码示例来源:origin: apache/jena
@Test(expected=ConcurrentModificationException.class)
public void mrswGraph3()
{
Model m = create().getDefaultModel() ;
Resource r = m.createResource("x") ;
ExtendedIterator<Statement> iter1 = m.listStatements(r, null, (RDFNode)null) ;
assertNotNull(iter1.next()) ;
Triple t = SSE.parseTriple("(<y> <p> 99)") ;
m.getGraph().delete(t) ;
// Bad
iter1.hasNext();
}
代码示例来源:origin: apache/jena
@Test public void graph_add_delete_04()
{
Graph g = emptyGraph() ;
Triple t1 = triple(s1, p1, o1) ;
Triple t2 = triple(s2, p2, o2) ;
g.add(t1) ;
g.add(t2) ;
g.delete(t1) ;
assertEquals(1, g.size()) ;
assertTrue("g does not contain t2", g.contains(t2)) ;
returnGraph(g) ;
}
代码示例来源:origin: apache/jena
public void testListSubjects()
{
Set<Node> emptySubjects = listSubjects( getGraphWith( "" ) );
Graph g = getGraphWith( "x P y; y Q z" );
assertEquals( nodeSet( "x y" ), remove( listSubjects( g ), emptySubjects ) );
g.delete( triple( "x P y" ) );
assertEquals( nodeSet( "y" ), remove( listSubjects( g ), emptySubjects ) );
}
代码示例来源:origin: org.apache.jena/jena-core
public void testListSubjects()
{
Set<Node> emptySubjects = listSubjects( getGraphWith( "" ) );
Graph g = getGraphWith( "x P y; y Q z" );
assertEquals( nodeSet( "x y" ), remove( listSubjects( g ), emptySubjects ) );
g.delete( triple( "x P y" ) );
assertEquals( nodeSet( "y" ), remove( listSubjects( g ), emptySubjects ) );
}
内容来源于网络,如有侵权,请联系作者删除!