@Override public void commit() throws OWLException { try { conn.close(); } catch (OntopConnectionException e) { throw new OWLException(e); } }
@Override public OntopOWLStatement createStatement() throws OWLException { try { return new DefaultOntopOWLStatement(conn.createStatement(), inputQueryFactory); } catch (OntopConnectionException e) { throw new OWLException(e); } }
@Override public boolean getAutoCommit() throws OWLException { try { return conn.getAutoCommit(); } catch (OntopConnectionException e) { throw new OWLException(e); } }
if (autoCommit == this.ontopConnection.getAutoCommit()) { return; this.ontopConnection.setAutoCommit(autoCommit); } catch (OntopConnectionException e) { throw new RepositoryException(e);
@Override public void rollBack() throws OWLException { try { conn.rollBack(); } catch (OntopConnectionException e) { throw new OWLException(e); } }
@Override public void setAutoCommit(boolean autocommit) throws OWLException { try { conn.setAutoCommit(autocommit); } catch (OntopConnectionException e) { throw new OWLException(e); } }
@Override public void commit() throws RepositoryException { // Commits all updates that have been performed as part of this // connection sofar. if (isActive()) { try { // System.out.println("QuestConn commit.."); ontopConnection.commit(); this.isActive = false; } catch (OntopConnectionException e) { throw new RepositoryException(e); } } else { throw new RepositoryException( "Connection does not have an active transaction."); } }
@Override public boolean isClosed() throws OWLException { try { return conn.isClosed(); } catch (OntopConnectionException e) { throw new OWLException(e); } }
if (autoCommit == this.ontopConnection.getAutoCommit()) { return; this.ontopConnection.setAutoCommit(autoCommit); } catch (OntopConnectionException e) { throw new RepositoryException(e);
@Override public void rollback() throws RepositoryException { // Rolls back all updates that have been performed as part of this // connection sofar. if (isActive()) { try { this.ontopConnection.rollBack(); this.isActive = false; } catch (OntopConnectionException e) { throw new RepositoryException(e); } } else { throw new RepositoryException( "Connection does not have an active transaction."); } }
@Override public void commit() throws RepositoryException { // Commits all updates that have been performed as part of this // connection sofar. if (isActive()) { try { // System.out.println("QuestConn commit.."); ontopConnection.commit(); this.isActive = false; } catch (OntopConnectionException e) { throw new RepositoryException(e); } } else { throw new RepositoryException( "Connection does not have an active transaction."); } }
@Override public boolean evaluate() throws QueryEvaluationException { AskQuery query = factory.createAskQuery(getQueryString(), getParsedQuery()); try (OntopStatement stm = conn.createStatement(); BooleanResultSet rs = stm.execute(query)) { return rs.getValue(); } catch (OntopConnectionException | OntopQueryAnsweringException e) { throw new QueryEvaluationException(e); } }
/** * Releases all the connection resources */ public void close() throws OntopConnectionException { if (tmpStatement != null) { tmpStatement.close(); } if (ontopConnection != null) { ontopConnection.close(); } }
@Override public boolean isAutoCommit() throws RepositoryException { //Checks whether the connection is in auto-commit mode. try { return ontopConnection.getAutoCommit(); } catch (OntopConnectionException e) { throw new RepositoryException(e); } }
@Override public void rollback() throws RepositoryException { // Rolls back all updates that have been performed as part of this // connection sofar. if (isActive()) { try { this.ontopConnection.rollBack(); this.isActive = false; } catch (OntopConnectionException e) { throw new RepositoryException(e); } } else { throw new RepositoryException( "Connection does not have an active transaction."); } }
@Override public boolean evaluate() throws QueryEvaluationException { AskQuery query = factory.createAskQuery(getQueryString(), getParsedQuery()); try (OntopStatement stm = conn.createStatement(); BooleanResultSet rs = stm.execute(query)) { return rs.getValue(); } catch (OntopConnectionException | OntopQueryAnsweringException e) { throw new QueryEvaluationException(e); } }
@Override public void close() throws RepositoryException { //Closes the connection, freeing resources. //If the connection is not in autoCommit mode, //all non-committed operations will be lost. isOpen = false; try { ontopConnection.close(); } catch (Exception e) { throw new RepositoryException(e); } }
@Override public boolean isAutoCommit() throws RepositoryException { //Checks whether the connection is in auto-commit mode. try { return ontopConnection.getAutoCommit(); } catch (OntopConnectionException e) { throw new RepositoryException(e); } }
private boolean executeConsistencyQuery(String strQuery) throws OWLException { try (OntopConnection connection = queryEngine.getConnection(); OntopStatement st = connection.createStatement()) { AskQuery query = inputQueryFactory.createAskQuery(strQuery); BooleanResultSet trs = st.execute(query); if (trs != null) { boolean b = trs.getValue(); trs.close(); if (b) return false; } return true; } catch (Exception e) { throw new OWLException(e); } }
@Override public void close() throws RepositoryException { //Closes the connection, freeing resources. //If the connection is not in autoCommit mode, //all non-committed operations will be lost. isOpen = false; try { ontopConnection.close(); } catch (Exception e) { throw new RepositoryException(e); } }