@Override public NotifyingSailConnection getWrappedConnection() { return (NotifyingSailConnection)super.getWrappedConnection(); }
@Override public void clearNamespaces() throws SailException { if (namespacesAreWritable) { super.clearNamespaces(); } }
@Override public String getNamespace(String prefix) throws SailException { return namespacesAreReadable ? super.getNamespace(prefix) : null; }
/** * Adds a statement to each of the given contexts for which the requestor * has write access. If no context is given, statements will be written to * the default write context, provided that it is writable. */ @Override public void addStatement(final Resource subj, final IRI pred, final Value obj, final Resource... contexts) throws SailException { if (0 == contexts.length) { if (writePermitted(defaultWriteContext)) { if (null == defaultWriteContext) { super.addStatement(subj, pred, obj); } else { super.addStatement(subj, pred, obj, defaultWriteContext); } } } else { for (Resource context : contexts) { if (writePermitted(context)) { super.addStatement(subj, pred, obj, context); } } } }
Collection<Resource> toRemove = new LinkedList<>(); try (CloseableIteration<? extends Statement, SailException> iter = super.getStatements(subj, pred, obj, false)) { while (iter.hasNext()) { Resource context = iter.next().getContext(); Resource[] ctxArray = new Resource[toRemove.size()]; toRemove.toArray(ctxArray); super.removeStatements(subj, pred, obj, ctxArray); super.removeStatements(subj, pred, obj, defaultWriteContext); for (Resource context : contexts) { if (deletePermitted(context)) { super.removeStatements(subj, pred, obj, context);
@Override public void close() throws SailException { commitAll(); super.close(); } }
@Override public CloseableIteration<? extends Namespace, SailException> getNamespaces() throws SailException { return namespacesAreReadable ? super.getNamespaces() : new EmptyCloseableIteration<Namespace, SailException>(); }
/** * @return an iterator containing only those context IDs to which the * requestor has read access (excluding the null context). */ @Override public CloseableIteration<? extends Resource, SailException> getContextIDs() throws SailException { return new ReadableContextIteration(super.getContextIDs()); }
/** * Clears the statements in all of the given contexts for which the * requestor has write access. If no context is given, the default write * context will be cleared, provided this is writable and not null. */ @Override public void clear(final Resource... contexts) throws SailException { if (0 == contexts.length) { if (null != defaultWriteContext) { if (deletePermitted(defaultWriteContext)) { super.clear(defaultWriteContext); } } else if (ALLOW_WILDCARD_CLEAR) { super.clear(); } } else { for (Resource context : contexts) { if (writePermitted(context)) { super.clear(context); } } } }
@Override public CloseableIteration<? extends Statement, SailException> getStatements( final Resource subj, final IRI pred, final Value obj, final boolean includeInferred, final Resource... contexts) throws SailException { // Get statements from a wildcard context --> filter after retrieving // statements. if (0 == contexts.length) { return new ReadableStatementIteration( super.getStatements(subj, pred, obj, includeInferred)); } // Get statements in specific contexts --> filter before retrieving // statements. The statements retrieved are assumed to be in one of the // requested contexts. else { Collection<CloseableIteration<? extends Statement, SailException>> iterations = new LinkedList<>(); for (Resource context : contexts) { if (readPermitted(context)) { iterations.add(super.getStatements( subj, pred, obj, INCLUDE_INFERRED_STATEMENTS, context)); } } return new CompoundCloseableIteration(iterations); } }
public CloseableIteration<? extends BindingSet, QueryEvaluationException> evaluateByGraphNames( final TupleExpr tupleExpr, final Dataset dataset, final BindingSet bindings, final boolean includeInferred) throws SailException { Dataset d; if (null == dataset) { d = this.readableSet; } else { SimpleDataset di = new SimpleDataset(); d = di; for (IRI r : dataset.getDefaultGraphs()) { if (this.readPermitted(r)) { di.addDefaultGraph(r); } } for (IRI r : dataset.getNamedGraphs()) { if (this.readPermitted(r)) { di.addNamedGraph(r); } } } return super.evaluate(tupleExpr, d, bindings, includeInferred); }
@Override public void addStatement(final Resource subject, final IRI predicate, final Value object, final Resource... contexts) throws SailException { if (0 == contexts.length) { boolean includeInferred = false; try (CloseableIteration<? extends Statement, SailException> iter = this.getWrappedConnection().getStatements(subject, predicate, object, includeInferred)) { if (iter.hasNext()) { return; } } } super.addStatement(subject, predicate, object, contexts); } }
@Override public NotifyingSailConnection getWrappedConnection() { return (NotifyingSailConnection)super.getWrappedConnection(); }