use of org.apache.jena.sparql.exec.UpdateExec in project jena by apache.
the class UpdateAction method execute$.
// All non-streaming updates come through here.
private static void execute$(UpdateRequest request, DatasetGraph datasetGraph, Binding inputBinding) {
UpdateExec uProc = UpdateExec.newBuilder().update(request).dataset(datasetGraph).initialBinding(inputBinding).build();
if (uProc == null)
throw new ARQException("No suitable update procesors are registered/able to execute your updates");
uProc.execute();
}
use of org.apache.jena.sparql.exec.UpdateExec in project jena by apache.
the class AbstractTestRDFLink method update_05.
@Test
public void update_05() {
UpdateRequest update = new UpdateRequest();
update.add("INSERT DATA { <urn:ex:s> <urn:ex:p> <urn:ex:o>}");
try (RDFLink link = link()) {
UpdateExecBuilder updateBuilder = link.newUpdate();
UpdateExec uExec = updateBuilder.update(update).build();
Txn.executeWrite(link, () -> uExec.execute());
}
}
use of org.apache.jena.sparql.exec.UpdateExec in project jena by apache.
the class AbstractTestUpdateGraph method testInsertData1.
@Test
public void testInsertData1() {
DatasetGraph gStore = getEmptyDatasetGraph();
defaultGraphData(gStore, graph1);
QuadDataAcc acc = new QuadDataAcc();
acc.addTriple(triple2);
UpdateDataInsert insert = new UpdateDataInsert(acc);
UpdateExec uProc = UpdateExec.dataset(gStore).update(insert).build();
uProc.execute();
assertFalse(graphEmpty(gStore.getDefaultGraph()));
assertTrue(graphContains(gStore.getDefaultGraph(), triple1));
assertTrue(graphContains(gStore.getDefaultGraph(), triple2));
}
use of org.apache.jena.sparql.exec.UpdateExec in project jena by apache.
the class AbstractTestUpdateGraph method testDeleteData1.
@Test
public void testDeleteData1() {
DatasetGraph gStore = getEmptyDatasetGraph();
defaultGraphData(gStore, graph1);
QuadDataAcc acc = new QuadDataAcc();
acc.addTriple(triple2);
UpdateDataDelete delete = new UpdateDataDelete(acc);
UpdateExec uProc = UpdateExec.dataset(gStore).update(delete).build();
uProc.execute();
assertFalse(graphEmpty(gStore.getDefaultGraph()));
assertTrue(graphContains(gStore.getDefaultGraph(), triple1));
assertFalse(graphContains(gStore.getDefaultGraph(), triple2));
}
use of org.apache.jena.sparql.exec.UpdateExec in project jena by apache.
the class AbstractTestUpdateGraph method testDeleteData2.
@Test
public void testDeleteData2() {
DatasetGraph gStore = getEmptyDatasetGraph();
defaultGraphData(gStore, graph1);
QuadDataAcc acc = new QuadDataAcc();
acc.addTriple(triple1);
UpdateDataDelete delete = new UpdateDataDelete(acc);
UpdateExec uProc = UpdateExec.dataset(gStore).update(delete).build();
uProc.execute();
assertTrue(graphEmpty(gStore.getDefaultGraph()));
assertFalse(graphContains(gStore.getDefaultGraph(), triple1));
}
Aggregations