private GraphOWLResultSet executeGraph(GraphSPARQLQuery query) throws OntopQueryEvaluationException, OntopConnectionException, OntopReformulationException, OntopResultConversionException { SimpleGraphResultSet resultSet = st.execute(query); return new OntopGraphOWLResultSet(resultSet); }
@Override public BooleanOWLResultSet executeAskQuery(String inputQuery) throws OntopOWLException { try { AskQuery query = inputQueryFactory.createAskQuery(inputQuery); BooleanResultSet resultSet = st.execute(query); return new OntopBooleanOWLResultSet(resultSet); } catch (OntopQueryEngineException e) { throw new OntopOWLException(e); } }
@Override public TupleOWLResultSet executeSelectQuery(String inputQuery) throws OntopOWLException { try { SelectQuery query = inputQueryFactory.createSelectQuery(inputQuery); TupleResultSet resultSet = st.execute(query); return new OntopTupleOWLResultSet(resultSet); } catch (OntopQueryEngineException e) { throw new OntopOWLException(e); } }
@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 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); } }
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 TupleQueryResult evaluate() throws QueryEvaluationException { TupleResultSet res; OntopStatement stm; long start = System.currentTimeMillis(); try { stm = conn.createStatement(); if(this.queryTimeout > 0) stm.setQueryTimeout(this.queryTimeout); try { SelectQuery inputQuery = factory.createSelectQuery(getQueryString(), getParsedQuery()); res = stm.execute(inputQuery); } catch (OntopQueryAnsweringException e) { long end = System.currentTimeMillis(); if (this.queryTimeout > 0 && (end - start) >= this.queryTimeout * 1000){ throw new QueryEvaluationException("OntopTupleQuery timed out. More than " + this.queryTimeout + " seconds passed", e); } else throw e; } List<String> signature = res.getSignature(); return new OntopTupleQueryResult(res, signature); } catch (QueryEvaluationException e) { throw e; } catch (Exception e) { throw new QueryEvaluationException(e); } }
@Override public TupleQueryResult evaluate() throws QueryEvaluationException { TupleResultSet res; OntopStatement stm; long start = System.currentTimeMillis(); try { stm = conn.createStatement(); if(this.queryTimeout > 0) stm.setQueryTimeout(this.queryTimeout); try { SelectQuery inputQuery = factory.createSelectQuery(getQueryString(), getParsedQuery()); res = stm.execute(inputQuery); } catch (OntopQueryAnsweringException e) { long end = System.currentTimeMillis(); if (this.queryTimeout > 0 && (end - start) >= this.queryTimeout * 1000){ throw new QueryEvaluationException("OntopTupleQuery timed out. More than " + this.queryTimeout + " seconds passed", e); } else throw e; } List<String> signature = res.getSignature(); return new OntopTupleQueryResult(res, signature); } catch (QueryEvaluationException e) { throw e; } catch (Exception e) { throw new QueryEvaluationException(e); } }
tmpStatement.setFetchSize(FETCH_SIZE); tmpGraphResultSet = tmpStatement.execute(query);
@Override public GraphQueryResult evaluate() throws QueryEvaluationException { ParsedQuery parsedQuery = getParsedQuery(); GraphSPARQLQuery query = isConstruct ? inputQueryFactory.createConstructQuery(getQueryString(), parsedQuery) : inputQueryFactory.createDescribeQuery(getQueryString(), parsedQuery); try ( OntopStatement stm = conn.createStatement(); SimpleGraphResultSet res = stm.execute(query) ){ Map<String, String> namespaces = new HashMap<>(); List<Statement> results = new LinkedList<>(); if (res != null) { while (res.hasNext()) { Assertion as = res.next(); Statement st = createStatement(as); if (st!=null) results.add(st); } } //return new GraphQueryResultImpl(namespaces, results.iterator()); return new GraphQueryResultImpl(namespaces, new CollectionIteration<>(results)); } catch (Exception e) { throw new QueryEvaluationException(e); } }
@Override public GraphQueryResult evaluate() throws QueryEvaluationException { ParsedQuery parsedQuery = getParsedQuery(); GraphSPARQLQuery query = isConstruct ? inputQueryFactory.createConstructQuery(getQueryString(), parsedQuery) : inputQueryFactory.createDescribeQuery(getQueryString(), parsedQuery); try ( OntopStatement stm = conn.createStatement(); SimpleGraphResultSet res = stm.execute(query) ){ Map<String, String> namespaces = new HashMap<>(); List<Statement> results = new LinkedList<>(); if (res != null) { while (res.hasNext()) { Assertion as = res.next(); Statement st = createStatement(as); if (st!=null) results.add(st); } } //return new GraphQueryResultImpl(namespaces, results.iterator()); return new GraphQueryResultImpl(namespaces, new CollectionIteration<>(results)); } catch (Exception e) { throw new QueryEvaluationException(e); } }