Search in sources :

Example 11 with DatasetGraph

use of org.apache.jena.sparql.core.DatasetGraph in project jena by apache.

the class AbstractTestUpdateGraph method testDelete3.

@Test
public void testDelete3() {
    DatasetGraph gStore = getEmptyDatasetGraph();
    defaultGraphData(gStore, graph1);
    QuadDataAcc acc = new QuadDataAcc();
    UpdateDataDelete delete = new UpdateDataDelete(acc);
    acc.addTriple(triple1);
    UpdateAction.execute(delete, gStore);
    assertTrue(graphEmpty(gStore.getDefaultGraph()));
}
Also used : DatasetGraph(org.apache.jena.sparql.core.DatasetGraph) Test(org.junit.Test)

Example 12 with DatasetGraph

use of org.apache.jena.sparql.core.DatasetGraph in project jena by apache.

the class AbstractTestUpdateGraph method testBad.

private void testBad(String file, int expectedSize) {
    DatasetGraph gStore = getEmptyDatasetGraph();
    script(gStore, file);
    assertEquals(expectedSize, countQuads(gStore));
}
Also used : DatasetGraph(org.apache.jena.sparql.core.DatasetGraph)

Example 13 with DatasetGraph

use of org.apache.jena.sparql.core.DatasetGraph in project jena by apache.

the class AbstractTestUpdateGraph method testDelete1.

@Test
public void testDelete1() {
    DatasetGraph gStore = getEmptyDatasetGraph();
    QuadAcc acc = new QuadAcc();
    UpdateDeleteWhere delete = new UpdateDeleteWhere(acc);
    UpdateAction.execute(delete, gStore);
    assertTrue(graphEmpty(gStore.getDefaultGraph()));
}
Also used : DatasetGraph(org.apache.jena.sparql.core.DatasetGraph) Test(org.junit.Test)

Example 14 with DatasetGraph

use of org.apache.jena.sparql.core.DatasetGraph in project jena by apache.

the class AbstractTestUpdateGraph method testUpdateScript1.

@Test
public void testUpdateScript1() {
    DatasetGraph gStore = getEmptyDatasetGraph();
    script(gStore, "update-1.ru");
    assertTrue(graphContains(gStore.getDefaultGraph(), new Triple(s, p, NodeFactoryExtra.parseNode("123"))));
}
Also used : DatasetGraph(org.apache.jena.sparql.core.DatasetGraph) Test(org.junit.Test)

Example 15 with DatasetGraph

use of org.apache.jena.sparql.core.DatasetGraph in project jena by apache.

the class AbstractTestUpdateGraph method testInsert4.

@Test
public void testInsert4() {
    DatasetGraph gStore = getEmptyDatasetGraph();
    defaultGraphData(gStore, graph1);
    UpdateModify insert = new UpdateModify();
    insert.getInsertAcc().addTriple(SSE.parseTriple("(?s <http://example/p> 1066)"));
    Element element = QueryFactory.createElement("{ ?s <http://example/p> 2007 }");
    insert.setElement(element);
    UpdateAction.execute(insert, gStore);
    assertTrue(graphContains(gStore.getDefaultGraph(), triple2));
}
Also used : Element(org.apache.jena.sparql.syntax.Element) DatasetGraph(org.apache.jena.sparql.core.DatasetGraph) Test(org.junit.Test)

Aggregations

DatasetGraph (org.apache.jena.sparql.core.DatasetGraph)222 Test (org.junit.Test)132 BaseTest (org.apache.jena.atlas.junit.BaseTest)59 Quad (org.apache.jena.sparql.core.Quad)47 Node (org.apache.jena.graph.Node)29 Graph (org.apache.jena.graph.Graph)18 StoreConnection (org.apache.jena.tdb.StoreConnection)17 DatasetGraphTxn (org.apache.jena.tdb.transaction.DatasetGraphTxn)15 Model (org.apache.jena.rdf.model.Model)10 IOException (java.io.IOException)7 Triple (org.apache.jena.graph.Triple)7 Dataset (org.apache.jena.query.Dataset)7 StreamRDF (org.apache.jena.riot.system.StreamRDF)7 ReentrantReadWriteLock (java.util.concurrent.locks.ReentrantReadWriteLock)5 ResultSet (org.apache.jena.query.ResultSet)5 JsonLDWriteContext (org.apache.jena.riot.JsonLDWriteContext)5 Element (org.apache.jena.sparql.syntax.Element)5 ByteArrayOutputStream (java.io.ByteArrayOutputStream)4 RiotException (org.apache.jena.riot.RiotException)4 QueryIterator (org.apache.jena.sparql.engine.QueryIterator)4