private void uploadDataset(Dataset dataset) throws Exception { RepositoryConnection con = dataRep.getConnection(); try { // Merge default and named graphs to filter duplicates Set<URI> graphURIs = new HashSet<URI>(); graphURIs.addAll(dataset.getDefaultGraphs()); graphURIs.addAll(dataset.getNamedGraphs()); for (Resource graphURI : graphURIs) { upload(((URI) graphURI), graphURI); } } finally { con.close(); } }
@Override public void executeDelete( UpdateExpr updateExpr, Dataset ds, BindingSet bindings, Resource subj, URI pred, Value obj, Resource... ctx) throws SailException { URI activity = ds == null ? null : ds.getDefaultInsertGraph(); if (activity == null) { removeStatements(subj, pred, obj, ctx); } else { URI entity = entityResolver.getEntity(updateExpr, ds, bindings); removeInforming(activity, entity, subj, pred, obj, ctx); } }
@Override public void executeUpdate( UpdateExpr updateExpr, Dataset ds, BindingSet bindings, boolean includeInferred) throws SailException { SailConnection remover = this; final URI activity = ds == null ? null : ds.getDefaultInsertGraph(); if (activity != null) { QueryModelNode node = updateExpr; if (updateExpr instanceof Modify) { node = ((Modify) updateExpr).getDeleteExpr(); } final URI entity = entityResolver.getEntity(node, ds, bindings); remover = new SailConnectionWrapper(this) { public void removeStatements(Resource subj, URI pred, Value obj, Resource... ctx) throws SailException { removeInforming(activity, entity, subj, pred, obj, ctx); } }; } SailUpdateExecutor executor = new SailUpdateExecutor(remover, vf, false); executor.executeUpdate(updateExpr, ds, bindings, includeInferred); }