@Override public void rollback() { try { connection.getConnection().rollback(); } catch (StoreException e) { String error = "Caught " + e.getClass().getName(); logger.error(error, e); throw new RepositoryException(error, e); }finally{ connection.cleanUpAfterRollback(); } }
public void cleanUpAfterRollback() { localTxn = null; readonlyTnx = false; close(); }
@Override public CloseableIterator<STMT> findStatements(ID sub, UID pre, NODE obj, UID con, boolean includeInferred) { Resource subject = convert(sub); URI predicate = convert(pre); Value object = convert(obj); URI context = convert(con); return new ModelResultIterator(dialect,findStatements(subject, predicate, object, includeInferred, context), includeInferred); }
@Override public void commit() { if (rollbackOnly) { throw new RepositoryException("Transaction is rollBackOnly"); } try { connection.getConnection().commit(); } catch (StoreException e) { String error = "Caught " + e.getClass().getName(); logger.error(error, e); throw new RepositoryException(error, e); } finally { connection.cleanUpAfterCommit(); } }
@Override public boolean exists(@Nullable ID sub, @Nullable UID pre, @Nullable NODE obj, @Nullable UID con, boolean includeInferred) { Resource subject = convert(sub); URI predicate = convert(pre); Value object = convert(obj); URI context = convert(con); try { if (context == null){ return connection.hasMatch(subject, predicate, object, includeInferred); }else{ return connection.hasMatch(subject, predicate, object, includeInferred, context); } } catch (StoreException e) { throw new RepositoryException(e); } }
public void begin() { try { connection.getConnection().begin(); } catch (org.openrdf.repository.RepositoryException e) { String error = "Caught " + e.getClass().getName(); logger.error(error, e); throw new RuntimeException(error, e); } }
@Override public RDFConnection openConnection() { try { return new SesameConnection(this, repository.getConnection(), inference, serializeQueries); } catch (org.openrdf.repository.RepositoryException e) { throw new RepositoryException(e); } }
boolean queryInference = !inference.subClassOf(); if (queryLanguage.equals(QueryLanguage.SPARQL)) { return (Q) createSPARQLQuery((String) definition); visitor.setInToOr(true); visitor.visit(md, queryLanguage); SPARQLQuery query = createSPARQLQuery(visitor.toString()); visitor.addBindings(query, md); System.err.println(visitor.toString());
@Override public void commit() { if (rollbackOnly){ throw new RepositoryException("Transaction is rollBackOnly"); } try { connection.getConnection().commit(); } catch (StoreException e) { String error = "Caught " + e.getClass().getName(); logger.error(error, e); throw new RepositoryException(error, e); }finally{ connection.cleanUpAfterCommit(); } }
@Override public boolean exists(@Nullable ID sub, @Nullable UID pre, @Nullable NODE obj, @Nullable UID con, boolean includeInferred) { Resource subject = convert(sub); URI predicate = convert(pre); Value object = convert(obj); URI context = convert(con); try { if (context == null) { return connection.hasMatch(subject, predicate, object, includeInferred); } else { return connection.hasMatch(subject, predicate, object, includeInferred, context); } } catch (StoreException e) { throw new RepositoryException(e); } }
public void begin() { try { connection.getConnection().setTransactionIsolation(isolationLevel); connection.getConnection().begin(); } catch (StoreException e) { String error = "Caught " + e.getClass().getName(); logger.error(error, e); throw new RepositoryException(error, e); } active = true; }
@Override public RDFConnection openConnection() { try { return new SesameConnection(this, repository.getConnection(), getInferenceOptions()); } catch (StoreException e) { throw new RepositoryException(e); } }
@SuppressWarnings("unchecked") @Override public <D, Q> Q createQuery(QueryLanguage<D, Q> queryLanguage, D definition) { boolean queryInference = !inference.subClassOf(); if (queryLanguage.equals(QueryLanguage.SPARQL)){ return (Q)createSPARQLQuery((String) definition); }else if (queryLanguage.equals(QueryLanguage.TUPLE)){ SesameRDFVisitor visitor = new SesameRDFVisitor(dialect); TupleExpr tuple = visitor.visit((QueryMetadata)definition, queryLanguage); TupleQueryModel queryModel = new TupleQueryModel(tuple); TupleQuery query = DirectQuery.getQuery(connection, queryModel, queryInference); return (Q)new TupleQueryImpl(query, dialect); }else if (queryLanguage.equals(QueryLanguage.GRAPH)){ SesameRDFVisitor visitor = new SesameRDFVisitor(dialect); TupleExpr tuple = visitor.visit((QueryMetadata)definition, queryLanguage); GraphQueryModel queryModel = new GraphQueryModel(tuple); GraphQuery query = DirectQuery.getQuery(connection, queryModel, queryInference); return (Q)new GraphQueryImpl(query, dialect); }else if (queryLanguage.equals(QueryLanguage.BOOLEAN)){ SesameRDFVisitor visitor = new SesameRDFVisitor(dialect); TupleExpr tuple = visitor.visit((QueryMetadata)definition, queryLanguage); BooleanQueryModel queryModel = new BooleanQueryModel(tuple); BooleanQuery query = DirectQuery.getQuery(connection, queryModel, queryInference); return (Q)new BooleanQueryImpl(query, dialect); }else{ throw new UnsupportedQueryLanguageException(queryLanguage); } }
@Override public void rollback() { try { connection.getConnection().rollback(); } catch (StoreException e) { String error = "Caught " + e.getClass().getName(); logger.error(error, e); throw new RepositoryException(error, e); } finally { connection.cleanUpAfterRollback(); } }
@Override public CloseableIterator<STMT> findStatements(ID sub, UID pre, NODE obj, UID con, boolean includeInferred) { Resource subject = convert(sub); URI predicate = convert(pre); Value object = convert(obj); URI context = convert(con); return new ModelResultIterator(dialect, findStatements(subject, predicate, object, includeInferred, context), includeInferred); }
@Override public void commit() { if (rollbackOnly) { throw new RepositoryException("Transaction is rollBackOnly"); } try { connection.getConnection().commit(); } catch (org.openrdf.repository.RepositoryException e) { String error = "Caught " + e.getClass().getName(); logger.error(error, e); throw new RepositoryException(error, e); } finally { connection.cleanUpAfterCommit(); } }
@Override public boolean exists(@Nullable ID sub, @Nullable UID pre, @Nullable NODE obj, @Nullable UID con, boolean includeInferred) { Resource subject = convert(sub); URI predicate = convert(pre); Value object = convert(obj); URI context = convert(con); try { if (context == null) { return connection.hasStatement(subject, predicate, object, includeInferred); } else { return connection .hasStatement(subject, predicate, object, includeInferred, context); } } catch (org.openrdf.repository.RepositoryException e) { throw new RepositoryException(e); } }
public void begin() { try { connection.getConnection().setTransactionIsolation(isolationLevel); connection.getConnection().begin(); } catch (StoreException e) { String error = "Caught " + e.getClass().getName(); logger.error(error, e); throw new RepositoryException(error, e); } active = true; }
@Override public RDFConnection openConnection() { try { return new SesameConnection(this, repository.getConnection(), getInferenceOptions()); } catch (StoreException e) { throw new RepositoryException(e); } }
public void cleanUpAfterRollback(){ localTxn = null; readonlyTnx = false; close(); }