use of org.apache.jena.update.UpdateException 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) {
}
}
}
use of org.apache.jena.update.UpdateException in project jena by apache.
the class UpdateExecDatasetBuilder method build.
@Override
public UpdateExec build() {
Objects.requireNonNull(dataset, "No dataset for update");
Objects.requireNonNull(updateRequest, "No update request");
UpdateRequest actualUpdate = updateRequest;
if (substitutionMap != null && !substitutionMap.isEmpty())
actualUpdate = UpdateTransformOps.transform(actualUpdate, substitutionMap);
Context cxt = Context.setupContextForDataset(context, dataset);
UpdateEngineFactory f = UpdateEngineRegistry.get().find(dataset, cxt);
if (f == null)
throw new UpdateException("Failed to find an UpdateEngine");
UpdateExec uExec = new UpdateExecDataset(actualUpdate, dataset, initialBinding, cxt, f);
return uExec;
}
Aggregations