use of org.apache.jena.sparql.modify.request.UpdateDataInsert in project jena by apache.
the class UpdateBuilderTest method testInsert_Triple.
@Test
public void testInsert_Triple() {
Triple t = new Triple(s, p, o);
UpdateBuilder builder = new UpdateBuilder();
builder.addInsert(t);
Update update = builder.build();
assertTrue(update instanceof UpdateDataInsert);
UpdateDataInsert udi = (UpdateDataInsert) update;
List<Quad> quads = udi.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());
}
use of org.apache.jena.sparql.modify.request.UpdateDataInsert in project jena by apache.
the class UpdateBuilderTest method testInsertValueReplacement.
@Test
public void testInsertValueReplacement() {
Var v = Var.alloc("v");
UpdateBuilder builder = new UpdateBuilder();
builder.addInsert(v, p, o);
builder.setVar(v, s);
Update update = builder.build();
assertTrue(update instanceof UpdateDataInsert);
UpdateDataInsert udi = (UpdateDataInsert) update;
List<Quad> quads = udi.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());
}
Aggregations