@Override protected void commitInternal() throws SailException { try { triples.commit(); unlock(); } catch (SQLException e) { throw new RdbmsException(e); } catch (InterruptedException e) { throw new RdbmsException(e); } // create a fresh event object. triples.setSailChangedEvent(new DefaultSailChangedEvent(sail)); }
@Override protected void addStatementInternal(Resource subj, URI pred, Value obj, Resource... contexts) throws SailException { try { if (contexts.length == 0) { triples.add(vf.createStatement(subj, pred, obj)); } else { for (Resource ctx : contexts) { triples.add(vf.createStatement(subj, pred, obj, ctx)); } } } catch (SQLException e) { throw new RdbmsException(e); } catch (InterruptedException e) { throw new RdbmsException(e); } }
@Override protected long sizeInternal(Resource... contexts) throws SailException { try { return triples.size(vf.asRdbmsResource(contexts)); } catch (SQLException e) { throw new RdbmsException(e); } }
@Override protected RdbmsResourceIteration getContextIDsInternal() throws SailException { try { return triples.findContexts(); } catch (SQLException e) { throw new RdbmsException(e); } }
@Override protected void removeStatementsInternal(Resource subj, URI pred, Value obj, Resource... contexts) throws SailException { RdbmsResource s = vf.asRdbmsResource(subj); RdbmsURI p = vf.asRdbmsURI(pred); RdbmsValue o = vf.asRdbmsValue(obj); RdbmsResource[] c = vf.asRdbmsResource(contexts); triples.remove(s, p, o, c); }
@Override protected void rollbackInternal() throws SailException { try { triples.rollback(); } catch (SQLException e) { throw new RdbmsException(e); } finally { unlock(); } }
@Override protected CloseableIteration<? extends Statement, SailException> getStatementsInternal( Resource subj, URI pred, Value obj, boolean includeInferred, Resource... contexts) throws SailException { RdbmsResource s = vf.asRdbmsResource(subj); RdbmsURI p = vf.asRdbmsURI(pred); RdbmsValue o = vf.asRdbmsValue(obj); RdbmsResource[] c = vf.asRdbmsResource(contexts); return triples.find(s, p, o, c); }
@Override protected void startTransactionInternal() throws SailException { try { lock(); triples.begin(); } catch (SQLException e) { unlock(); throw new RdbmsException(e); } catch (InterruptedException e) { unlock(); throw new RdbmsException(e); } }
@Override protected CloseableIteration<BindingSet, QueryEvaluationException> evaluateInternal( TupleExpr expr, Dataset dataset, BindingSet bindings, boolean includeInferred) throws SailException { triples.flush(); try { TupleExpr tupleExpr; EvaluationStrategy strategy; strategy = factory.createRdbmsEvaluation(dataset); tupleExpr = optimizer.optimize(expr, dataset, bindings, strategy); return strategy.evaluate(tupleExpr, EmptyBindingSet.getInstance()); } catch (QueryEvaluationException e) { throw new SailException(e); } }