@Override public final void addStatement(Resource subj, IRI pred, Value obj, Resource... contexts) throws SailException { if(pendingRemovals()){ flushPendingUpdates(); } addStatement(null, subj, pred, obj, contexts); }
@Override public void begin() throws SailException { begin(null); }
@Override public void flush() throws SailException { if (isActive()) { endUpdate(null); startUpdate(null); } }
@Override public final void commit() throws SailException { if (isActive()) { endUpdate(null); } connectionLock.readLock().lock(); try { verifyIsOpen(); updateLock.lock(); try { if (txnActive) { if (!txnPrepared) { prepareInternal(); } commitInternal(); txnActive = false; txnPrepared = false; } } finally { updateLock.unlock(); } } finally { connectionLock.readLock().unlock(); } }
/** * The default implementation buffers added statements until the update operation is complete. */ @Override public void addStatement(UpdateContext op, Resource subj, IRI pred, Value obj, Resource... contexts) throws SailException { verifyIsOpen(); verifyIsActive(); synchronized (added) { assert added.containsKey(op); Collection<Statement> pending = added.get(op); if (contexts == null || contexts.length == 0) { pending.add(sailBase.getValueFactory().createStatement(subj, pred, obj)); } else { for (Resource ctx : contexts) { pending.add(sailBase.getValueFactory().createStatement(subj, pred, obj, ctx)); } } if (pending.size() % BLOCK_SIZE == 0 && !isActiveOperation()) { endUpdate(op); startUpdate(op); } } }
@Override public final void clear(Resource... contexts) throws SailException { flushPendingUpdates(); connectionLock.readLock().lock(); try { verifyIsOpen(); updateLock.lock(); try { verifyIsActive(); clearInternal(contexts); } finally { updateLock.unlock(); } } finally { connectionLock.readLock().unlock(); } }
@Override public final void endUpdate(UpdateContext op) throws SailException { connectionLock.readLock().lock(); try { verifyIsOpen(); updateLock.lock(); try { verifyIsActive(); endUpdateInternal(op); } finally { updateLock.unlock(); } } finally { connectionLock.readLock().unlock(); if (op != null) { flush(); } } }
throws SailException flushPendingUpdates(); connectionLock.readLock().lock(); try { verifyIsOpen(); boolean registered = false; CloseableIteration<? extends BindingSet, QueryEvaluationException> iteration = null; CloseableIteration<? extends BindingSet, QueryEvaluationException> registeredIteration = null; try { iteration = evaluateInternal(tupleExpr, dataset, bindings, includeInferred); registeredIteration = registerIteration(iteration); registered = true; return registeredIteration;
@Override public final void clearNamespaces() throws SailException { connectionLock.readLock().lock(); try { verifyIsOpen(); updateLock.lock(); try { verifyIsActive(); clearNamespacesInternal(); } finally { updateLock.unlock(); } } finally { connectionLock.readLock().unlock(); } }
if (isOpen) { try { forceCloseActiveOperations(); rollbackInternal(); closeInternal();
protected void endUpdateInternal(UpdateContext op) throws SailException { Collection<Statement> model; // realize DELETE synchronized (removed) { model = removed.remove(op); } if (model != null) { for (Statement st : model) { Resource ctx = st.getContext(); if (wildContext.equals(ctx)) { removeStatementsInternal(st.getSubject(), st.getPredicate(), st.getObject()); } else { removeStatementsInternal(st.getSubject(), st.getPredicate(), st.getObject(), ctx); } } } // realize INSERT synchronized (added) { model = added.remove(op); } if (model != null) { for (Statement st : model) { addStatementInternal(st.getSubject(), st.getPredicate(), st.getObject(), st.getContext()); } } }
@Override public final void prepare() throws SailException { if (isActive()) { endUpdate(null); } connectionLock.readLock().lock(); try { verifyIsOpen(); updateLock.lock(); try { if (txnActive) { prepareInternal(); txnPrepared = true; } } finally { updateLock.unlock(); } } finally { connectionLock.readLock().unlock(); } }
/** * The default implementation buffers removed statements until the update operation is complete. */ @Override public void removeStatement(UpdateContext op, Resource subj, IRI pred, Value obj, Resource... contexts) throws SailException { verifyIsOpen(); verifyIsActive(); synchronized (removed) { assert removed.containsKey(op); Collection<Statement> pending = removed.get(op); if (contexts == null) { pending.add(new WildStatement(subj, pred, obj)); } else if (contexts.length == 0) { pending.add(new WildStatement(subj, pred, obj, wildContext)); } else { for (Resource ctx : contexts) { pending.add(new WildStatement(subj, pred, obj, ctx)); } } if (pending.size() % BLOCK_SIZE == 0 && !isActiveOperation()) { endUpdate(op); startUpdate(op); } } }
@Override public final void clear(Resource... contexts) throws SailException { flushPendingUpdates(); connectionLock.readLock().lock(); try { verifyIsOpen(); updateLock.lock(); try { verifyIsActive(); clearInternal(contexts); } finally { updateLock.unlock(); } } finally { connectionLock.readLock().unlock(); } }
@Override public final void endUpdate(UpdateContext op) throws SailException { connectionLock.readLock().lock(); try { verifyIsOpen(); updateLock.lock(); try { verifyIsActive(); endUpdateInternal(op); } finally { updateLock.unlock(); } } finally { connectionLock.readLock().unlock(); if (op != null) { flush(); } } }
throws SailException flushPendingUpdates(); connectionLock.readLock().lock(); try { verifyIsOpen(); boolean registered = false; CloseableIteration<? extends BindingSet, QueryEvaluationException> iteration = null; CloseableIteration<? extends BindingSet, QueryEvaluationException> registeredIteration = null; try { iteration = evaluateInternal(tupleExpr, dataset, bindings, includeInferred); registeredIteration = registerIteration(iteration); registered = true; return registeredIteration;
@Override public final void clearNamespaces() throws SailException { connectionLock.readLock().lock(); try { verifyIsOpen(); updateLock.lock(); try { verifyIsActive(); clearNamespacesInternal(); } finally { updateLock.unlock(); } } finally { connectionLock.readLock().unlock(); } }
if (isOpen) { try { forceCloseActiveOperations(); rollbackInternal(); closeInternal();
protected void endUpdateInternal(UpdateContext op) throws SailException { Collection<Statement> model; // realize DELETE synchronized (removed) { model = removed.remove(op); } if (model != null) { for (Statement st : model) { Resource ctx = st.getContext(); if (wildContext.equals(ctx)) { removeStatementsInternal(st.getSubject(), st.getPredicate(), st.getObject()); } else { removeStatementsInternal(st.getSubject(), st.getPredicate(), st.getObject(), ctx); } } } // realize INSERT synchronized (added) { model = added.remove(op); } if (model != null) { for (Statement st : model) { addStatementInternal(st.getSubject(), st.getPredicate(), st.getObject(), st.getContext()); } } }
@Override public final void prepare() throws SailException { if (isActive()) { endUpdate(null); } connectionLock.readLock().lock(); try { verifyIsOpen(); updateLock.lock(); try { if (txnActive) { prepareInternal(); txnPrepared = true; } } finally { updateLock.unlock(); } } finally { connectionLock.readLock().unlock(); } }