Search in sources :

Example 1 with UpdateDataDelete

use of org.apache.jena.sparql.modify.request.UpdateDataDelete in project jena by apache.

the class UpdateBuilderTest method testDelete_Triple.

@Test
public void testDelete_Triple() {
    Triple t = new Triple(s, p, o);
    UpdateBuilder builder = new UpdateBuilder();
    builder.addDelete(t);
    Update update = builder.build();
    assertTrue(update instanceof UpdateDataDelete);
    UpdateDataDelete udd = (UpdateDataDelete) update;
    List<Quad> quads = udd.getQuads();
    assertEquals(1, quads.size());
    Quad q = quads.get(0);
    assertEquals(Quad.defaultGraphNodeGenerated, q.getGraph());
    assertEquals(s, q.getSubject());
    assertEquals(p, q.getPredicate());
    assertEquals(o, q.getObject());
}
Also used : Triple(org.apache.jena.graph.Triple) UpdateDataDelete(org.apache.jena.sparql.modify.request.UpdateDataDelete) Quad(org.apache.jena.sparql.core.Quad) UpdateBuilder(org.apache.jena.arq.querybuilder.UpdateBuilder) Update(org.apache.jena.update.Update) Test(org.junit.Test)

Example 2 with UpdateDataDelete

use of org.apache.jena.sparql.modify.request.UpdateDataDelete in project jena by apache.

the class UpdateBuilderTest method testDelete_SPO.

@Test
public void testDelete_SPO() {
    UpdateBuilder builder = new UpdateBuilder();
    builder.addDelete(s, p, o);
    Update update = builder.build();
    assertTrue(update instanceof UpdateDataDelete);
    UpdateDataDelete udd = (UpdateDataDelete) update;
    List<Quad> quads = udd.getQuads();
    assertEquals(1, quads.size());
    Quad q = quads.get(0);
    assertEquals(Quad.defaultGraphNodeGenerated, q.getGraph());
    assertEquals(s, q.getSubject());
    assertEquals(p, q.getPredicate());
    assertEquals(o, q.getObject());
}
Also used : UpdateDataDelete(org.apache.jena.sparql.modify.request.UpdateDataDelete) Quad(org.apache.jena.sparql.core.Quad) UpdateBuilder(org.apache.jena.arq.querybuilder.UpdateBuilder) Update(org.apache.jena.update.Update) Test(org.junit.Test)

Example 3 with UpdateDataDelete

use of org.apache.jena.sparql.modify.request.UpdateDataDelete in project jena by apache.

the class UpdateBuilderTest method testDelete_Quad.

@Test
public void testDelete_Quad() {
    UpdateBuilder builder = new UpdateBuilder();
    builder.addDelete(new Quad(g, s, p, o));
    Update update = builder.build();
    assertTrue(update instanceof UpdateDataDelete);
    UpdateDataDelete udd = (UpdateDataDelete) update;
    List<Quad> quads = udd.getQuads();
    assertEquals(1, quads.size());
    Quad q = quads.get(0);
    assertEquals(g, q.getGraph());
    assertEquals(s, q.getSubject());
    assertEquals(p, q.getPredicate());
    assertEquals(o, q.getObject());
}
Also used : Quad(org.apache.jena.sparql.core.Quad) UpdateDataDelete(org.apache.jena.sparql.modify.request.UpdateDataDelete) UpdateBuilder(org.apache.jena.arq.querybuilder.UpdateBuilder) Update(org.apache.jena.update.Update) Test(org.junit.Test)

Example 4 with UpdateDataDelete

use of org.apache.jena.sparql.modify.request.UpdateDataDelete in project jena by apache.

the class UpdateBuilderTest method testDelete_NodeTriple.

@Test
public void testDelete_NodeTriple() {
    Triple t = new Triple(s, p, o);
    UpdateBuilder builder = new UpdateBuilder();
    builder.addDelete(g, t);
    Update update = builder.build();
    assertTrue(update instanceof UpdateDataDelete);
    UpdateDataDelete udd = (UpdateDataDelete) update;
    List<Quad> quads = udd.getQuads();
    assertEquals(1, quads.size());
    Quad q = quads.get(0);
    assertEquals(g, q.getGraph());
    assertEquals(s, q.getSubject());
    assertEquals(p, q.getPredicate());
    assertEquals(o, q.getObject());
}
Also used : Triple(org.apache.jena.graph.Triple) UpdateDataDelete(org.apache.jena.sparql.modify.request.UpdateDataDelete) Quad(org.apache.jena.sparql.core.Quad) UpdateBuilder(org.apache.jena.arq.querybuilder.UpdateBuilder) Update(org.apache.jena.update.Update) Test(org.junit.Test)

Example 5 with UpdateDataDelete

use of org.apache.jena.sparql.modify.request.UpdateDataDelete in project jena by apache.

the class UpdateRequestSink method createDeleteDataSink.

@Override
public QuadDataAccSink createDeleteDataSink() {
    QuadDataAcc quads = new QuadDataAcc();
    send(new UpdateDataDelete(quads));
    return quads;
}
Also used : UpdateDataDelete(org.apache.jena.sparql.modify.request.UpdateDataDelete) QuadDataAcc(org.apache.jena.sparql.modify.request.QuadDataAcc)

Aggregations

UpdateDataDelete (org.apache.jena.sparql.modify.request.UpdateDataDelete)7 UpdateBuilder (org.apache.jena.arq.querybuilder.UpdateBuilder)6 Quad (org.apache.jena.sparql.core.Quad)6 Update (org.apache.jena.update.Update)6 Test (org.junit.Test)6 Triple (org.apache.jena.graph.Triple)2 Var (org.apache.jena.sparql.core.Var)1 QuadDataAcc (org.apache.jena.sparql.modify.request.QuadDataAcc)1