Search in sources :

Example 1 with UpdateDataInsert

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

the class UpdateRequestSink method createInsertDataSink.

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

Example 2 with UpdateDataInsert

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

the class UpdateBuilderTest method testInsert_Quad.

@Test
public void testInsert_Quad() {
    UpdateBuilder builder = new UpdateBuilder();
    builder.addInsert(new Quad(g, s, p, o));
    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(g, q.getGraph());
    assertEquals(s, q.getSubject());
    assertEquals(p, q.getPredicate());
    assertEquals(o, q.getObject());
}
Also used : Quad(org.apache.jena.sparql.core.Quad) UpdateDataInsert(org.apache.jena.sparql.modify.request.UpdateDataInsert) UpdateBuilder(org.apache.jena.arq.querybuilder.UpdateBuilder) Update(org.apache.jena.update.Update) Test(org.junit.Test)

Example 3 with UpdateDataInsert

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

the class UpdateBuilderTest method testInsert_NodeTriple.

@Test
public void testInsert_NodeTriple() {
    Triple t = new Triple(s, p, o);
    UpdateBuilder builder = new UpdateBuilder();
    builder.addInsert(g, 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(g, q.getGraph());
    assertEquals(s, q.getSubject());
    assertEquals(p, q.getPredicate());
    assertEquals(o, q.getObject());
}
Also used : Triple(org.apache.jena.graph.Triple) Quad(org.apache.jena.sparql.core.Quad) UpdateDataInsert(org.apache.jena.sparql.modify.request.UpdateDataInsert) UpdateBuilder(org.apache.jena.arq.querybuilder.UpdateBuilder) Update(org.apache.jena.update.Update) Test(org.junit.Test)

Example 4 with UpdateDataInsert

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

the class UpdateBuilderTest method testInsert_GSPO.

@Test
public void testInsert_GSPO() {
    UpdateBuilder builder = new UpdateBuilder();
    builder.addInsert(g, s, p, o);
    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(g, q.getGraph());
    assertEquals(s, q.getSubject());
    assertEquals(p, q.getPredicate());
    assertEquals(o, q.getObject());
}
Also used : Quad(org.apache.jena.sparql.core.Quad) UpdateDataInsert(org.apache.jena.sparql.modify.request.UpdateDataInsert) UpdateBuilder(org.apache.jena.arq.querybuilder.UpdateBuilder) Update(org.apache.jena.update.Update) Test(org.junit.Test)

Example 5 with UpdateDataInsert

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

the class UpdateBuilderTest method testInsert_SPO.

@Test
public void testInsert_SPO() {
    UpdateBuilder builder = new UpdateBuilder();
    builder.addInsert(s, p, o);
    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());
}
Also used : Quad(org.apache.jena.sparql.core.Quad) UpdateDataInsert(org.apache.jena.sparql.modify.request.UpdateDataInsert) UpdateBuilder(org.apache.jena.arq.querybuilder.UpdateBuilder) Update(org.apache.jena.update.Update) Test(org.junit.Test)

Aggregations

UpdateDataInsert (org.apache.jena.sparql.modify.request.UpdateDataInsert)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