use of org.apache.jena.sparql.modify.request.UpdateCreate in project jena by apache.
the class AbstractTestUpdateGraphMgt method testCreateDrop2.
@Test
public void testCreateDrop2() {
DatasetGraph gStore = getEmptyDatasetGraph();
Update u = new UpdateCreate(graphIRI);
UpdateAction.execute(u, gStore);
u = new UpdateCreate(graphIRI, true);
UpdateAction.execute(u, gStore);
// JENA-1068
// assertTrue(gStore.containsGraph(graphIRI)) ;
assertTrue(graphEmpty(gStore.getGraph(graphIRI)));
u = new UpdateDrop(graphIRI);
UpdateAction.execute(u, gStore);
assertFalse(gStore.containsGraph(graphIRI));
u = new UpdateDrop(graphIRI, true);
UpdateAction.execute(u, gStore);
}
use of org.apache.jena.sparql.modify.request.UpdateCreate in project jena by apache.
the class UpdateProgrammatic method main.
public static void main(String[] args) {
Dataset dataset = DatasetFactory.createTxnMem();
UpdateRequest request = UpdateFactory.create();
request.add(new UpdateDrop(Target.ALL));
request.add(new UpdateCreate("http://example/g2"));
request.add(new UpdateLoad("file:etc/update-data.ttl", "http://example/g2"));
UpdateAction.execute(request, dataset);
System.out.println("# Debug format");
SSE.write(dataset);
System.out.println();
System.out.println("# N-Quads: S P O G");
RDFDataMgr.write(System.out, dataset, Lang.NQUADS);
}
use of org.apache.jena.sparql.modify.request.UpdateCreate in project jena by apache.
the class AbstractTestUpdateGraphMgt method testCreateDrop1.
@Test
public void testCreateDrop1() {
DatasetGraph gStore = getEmptyDatasetGraph();
Update u = new UpdateCreate(graphIRI);
UpdateAction.execute(u, gStore);
// Only true if a graph caching layer exists.
// JENA-1068 removed that layer
// (which wasn't safe anyway - it only "existed" in the memory cache)
// assertTrue(gStore.containsGraph(graphIRI)) ;
assertTrue(graphEmpty(gStore.getGraph(graphIRI)));
// With "auto SILENT" then these aren't errors.
boolean silentMode = true;
if (!silentMode) {
// try again - should fail (already exists)
try {
UpdateAction.execute(u, gStore);
fail();
} catch (UpdateException ex) {
}
}
// Drop it.
u = new UpdateDrop(graphIRI);
UpdateAction.execute(u, gStore);
assertFalse(gStore.containsGraph(graphIRI));
if (!silentMode) {
// Drop it again. - should fail
try {
UpdateAction.execute(u, gStore);
fail();
} catch (UpdateException ex) {
}
}
}
Aggregations