use of org.apache.jena.graph.impl.GraphWithPerform in project jena by apache.
the class GraphUtil method deleteIteratorWorkerDirect.
/**
* Delete the triples supplied by an iterator. This function is not "concurrent
* modification" safe; it assumes it can use the iterator while deleting from the
* graph.
*/
private static void deleteIteratorWorkerDirect(Graph graph, Iterator<Triple> it) {
if (OldStyle && graph instanceof GraphWithPerform) {
GraphWithPerform g = (GraphWithPerform) graph;
it.forEachRemaining(g::performDelete);
} else {
it.forEachRemaining(graph::delete);
}
}
use of org.apache.jena.graph.impl.GraphWithPerform in project jena by apache.
the class GraphUtil method delete.
public static void delete(Graph graph, Triple[] triples) {
if (OldStyle && graph instanceof GraphWithPerform) {
GraphWithPerform g = (GraphWithPerform) graph;
for (Triple t : triples) g.performDelete(t);
graph.getEventManager().notifyDeleteArray(graph, triples);
} else {
for (Triple t : triples) graph.delete(t);
}
}
use of org.apache.jena.graph.impl.GraphWithPerform in project jena by apache.
the class GraphUtil method addIteratorWorkerDirect.
private static void addIteratorWorkerDirect(Graph graph, Iterator<Triple> it) {
if (OldStyle && graph instanceof GraphWithPerform) {
GraphWithPerform g = (GraphWithPerform) graph;
it.forEachRemaining(g::performAdd);
} else {
it.forEachRemaining(graph::add);
}
}
use of org.apache.jena.graph.impl.GraphWithPerform in project jena by apache.
the class GraphWithPerformContractTest method testPerformAdd_Triple.
@ContractTest
public void testPerformAdd_Triple() {
GraphWithPerform g = (GraphWithPerform) graphWith(producer.newInstance(), "S P O; S2 P2 O2");
g.getEventManager().register(GL);
txnBegin(g);
g.performAdd(triple("S3 P3 O3"));
txnCommit(g);
GL.assertEmpty();
assertTrue(g.contains(triple("S3 P3 O3")));
}
use of org.apache.jena.graph.impl.GraphWithPerform in project jena by apache.
the class GraphWithPerformContractTest method testPerformDelete_Triple.
@ContractTest
public void testPerformDelete_Triple() {
GraphWithPerform g = (GraphWithPerform) graphWith(producer.newInstance(), "S P O; S2 P2 O2");
g.getEventManager().register(GL);
txnBegin(g);
g.performDelete(triple("S2 P2 O2"));
txnCommit(g);
GL.assertEmpty();
assertFalse(g.contains(triple("S2 P2 O2")));
}
Aggregations