use of org.apache.jena.sparql.core.DatasetGraph in project jena by apache.
the class AbstractTestUpdateGraph method testUpdateScript3.
@Test
public void testUpdateScript3() {
DatasetGraph gStore = getEmptyDatasetGraph();
script(gStore, "update-3.ru");
assertTrue(graphEmpty(gStore.getGraph(org.apache.jena.graph.NodeFactory.createURI("http://example/g1"))));
assertTrue(graphEmpty(gStore.getDefaultGraph()));
}
use of org.apache.jena.sparql.core.DatasetGraph in project jena by apache.
the class AbstractTestUpdateGraph method testModify1.
@Test
public void testModify1() {
DatasetGraph gStore = getEmptyDatasetGraph();
defaultGraphData(gStore, data2());
namedGraphData(gStore, graphIRI, Factory.createDefaultGraph());
UpdateModify modify = new UpdateModify();
Element element = QueryFactory.createElement("{ ?s <http://example/p> ?o }");
modify.setElement(element);
modify.getInsertAcc().addQuad(new Quad(graphIRI, triple1));
modify.getDeleteAcc().addTriple(SSE.parseTriple("(?s <http://example/p> ?o)"));
modify.getDeleteAcc().addQuad(SSE.parseQuad("(<http://example/graph> ?s <http://example/p> ?o)"));
UpdateAction.execute(modify, gStore);
assertFalse(graphEmpty(gStore.getGraph(graphIRI)));
assertTrue(graphEmpty(gStore.getDefaultGraph()));
assertTrue(graphContains(gStore.getGraph(graphIRI), triple1));
}
use of org.apache.jena.sparql.core.DatasetGraph in project jena by apache.
the class AbstractTestUpdateBase method defaultGraphData.
protected void defaultGraphData(DatasetGraph gStore, Graph data) {
Graph g = gStore.getDefaultGraph();
g.clear();
GraphUtil.addInto(g, data);
}
use of org.apache.jena.sparql.core.DatasetGraph in project jena by apache.
the class AbstractTestUpdateBase method namedGraphData.
protected void namedGraphData(DatasetGraph gStore, Node uri, Graph data) {
Graph g = gStore.getGraph(uri);
if (g == null) {
gStore.addGraph(uri, GraphFactory.createJenaDefaultGraph());
g = gStore.getGraph(uri);
} else
g.clear();
GraphUtil.addInto(g, data);
}
use of org.apache.jena.sparql.core.DatasetGraph in project jena by apache.
the class AbstractTestUpdateGraph method testUpdateScript7.
@Test
public void testUpdateScript7() {
DatasetGraph gStore = getEmptyDatasetGraph();
script(gStore, "data-4.ru");
assertTrue(graphContains(gStore.getDefaultGraph(), new Triple(s, p, NodeFactoryExtra.parseNode("123"))));
Graph g = gStore.getGraph(graphIRI);
assertTrue(graphContains(gStore.getGraph(graphIRI), new Triple(s, p, o2)));
}
Aggregations