/** * Creates a new {@link SailConnection}, using the given {@link SailStore} to manage the state. * * @param sail * @param store * @param evalStratFactory * the {@link EvaluationStrategyFactory} to use. */ protected SailSourceConnection(AbstractSail sail, SailStore store, EvaluationStrategyFactory evalStratFactory) { super(sail); this.vf = sail.getValueFactory(); this.store = store; this.defaultIsolationLevel = sail.getDefaultIsolationLevel(); this.evalStratFactory = evalStratFactory; this.federatedServiceResolver = (evalStratFactory instanceof StrictEvaluationStrategyFactory) ? ((StrictEvaluationStrategyFactory)evalStratFactory).getFederatedServiceResolver() : null; }
/** * 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); } } }