/** * 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); } } }
/** * 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); } } }
/** * If there are no open operations. * * @throws SailException */ private void flushPendingUpdates() throws SailException { if (!isActiveOperation() || isActive() && !getTransactionIsolation().isCompatibleWith(IsolationLevels.SNAPSHOT_READ)) { flush(); } }
/** * 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); } } }
/** * 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); } } }
/** * If there are no open operations. * * @throws SailException */ private void flushPendingUpdates() throws SailException { if (!isActiveOperation() || isActive() && !getTransactionIsolation().isCompatibleWith(IsolationLevels.SNAPSHOT_READ)) { flush(); } }