@Override public void close() throws QueryEvaluationException { queryResult.close(); } }
@Override public void handleClose() throws QueryEvaluationException { result.close(); } }
@Override public void handleClose() throws QueryEvaluationException { result.close(); } }
private void closeNoException(TupleQueryResult result) { if (result != null) { try { result.close(); } catch (QueryEvaluationException e) { log.error("closeNoException(result)", e); } } }
@Override public void close() { try { this.it.close(); } catch (QueryEvaluationException e) { if (LOGGER.isErrorEnabled()) { LOGGER.error("Error during iteration closing", e); } } }
private void closeQuietly(TupleQueryResult res) { try { if (res != null) res.close(); } catch (Exception e) { logger.debug("Could not close connection properly: " + e.getMessage(), e); } }
public void close() { try { this.queryResult.close(); } catch (QueryEvaluationException e) { throw new ModelRuntimeException(e); } this.closed = true; }
@Override public void close() { try { tupleResult.close(); } catch (QueryEvaluationException e1) { throw new RepositoryException(e1); } }
public void close() { try { queryResult.close(); } catch (QueryEvaluationException e) { throw new ModelRuntimeException(e); } closed = true; }
private void simpleQuery(final String namespace) throws QueryEvaluationException, Exception { log.warn(String.format("Execute SPARQL on %s namespace...", namespace)); m_mgr.getRepositoryForNamespace(namespace).prepareTupleQuery("SELECT * {?s ?p ?o} LIMIT 100").evaluate() .close(); log.warn(String.format("Execute SPARQL on %s namespace done", namespace)); }
private void closeNoException(TupleQueryResult result) { if (result != null) { try { result.close(); } catch (QueryEvaluationException e) { log.error("closeNoException(result)", e); } } }
protected void doTupleNoLinks(TupleQueryResultFormat format, TupleQueryResult input, TupleQueryResult expected) throws IOException, QueryResultParseException, UnsupportedQueryResultFormatException, QueryEvaluationException, QueryResultHandlerException { ByteArrayOutputStream out = new ByteArrayOutputStream(4096); QueryResultIO.writeTuple(input, format, out); input.close(); // System.out.println("output: " + out.toString("UTF-8")); ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray()); TupleQueryResult output = QueryResultIO.parseTuple(in, format); assertQueryResultsEqual(expected, output); }
@Override public void close() throws QueryEvaluationException { try { result.close(); } finally { try { connection.close(); } catch (RepositoryException e) { throw new QueryEvaluationException("Exception closing connection.", e); } } }
public interface Factory { SPARQLSyntaxTest createSPARQLSyntaxTest(String testURI, String testName, String testAction, boolean positiveTest); }
private boolean evaluateSparql(String qry) throws RepositoryException, MalformedQueryException, QueryEvaluationException { TupleQuery query = con.prepareTupleQuery(QueryLanguage.SPARQL, qry); TupleQueryResult evaluate = query.evaluate(); try { return evaluate.hasNext(); } finally { evaluate.close(); } } }
protected HashSet<String> count(TupleQueryResult res, String given) throws QueryEvaluationException { HashSet<String> emails = new HashSet<String>(); String prefix = null; while(res.hasNext()){ BindingSet bs = res.next(); Value v = bs.getValue(given); prefix = v.stringValue(); if(prefix!=null) prefix.toLowerCase(); prefix = postprocess(prefix,emails); } res.close(); return emails; }
private void simpleQuery(final String namespace) throws QueryEvaluationException, Exception { log.warn(String.format("Execute SPARQL on %s namespace...", namespace)); m_mgr.getRepositoryForNamespace(namespace).prepareTupleQuery("SELECT * {?s ?p ?o} LIMIT 100").evaluate() .close(); log.warn(String.format("Execute SPARQL on %s namespace done", namespace)); }
public void evaluate(TupleQueryResultHandler handler) throws QueryEvaluationException, TupleQueryResultHandlerException { TupleQueryResult tqr = evaluate(); try { handler.startQueryResult(tqr.getBindingNames()); while (tqr.hasNext()) { handler.handleSolution(tqr.next()); } handler.endQueryResult(); } finally { tqr.close(); } } }
@Test public void testQueryBaseURI() throws Exception { testCon.add(vf.createURI(URN_TEST_S1), vf.createURI(URN_TEST_P1), vf.createURI(URN_TEST_O1)); TupleQueryResult rs = testCon.prepareTupleQuery(QueryLanguage.SPARQL, "SELECT * { <> ?p ?o }", URN_TEST_S1).evaluate(); try { assertThat(rs.hasNext(), is(equalTo(true))); } finally { rs.close(); } }
@Test public void testTupleQueryBaseURI() throws Exception { final String baseURI = ":baseURI"; final TupleQuery tq = con.prepareTupleQuery(QueryLanguage.SPARQL, "select * where {?s ?p ?o}", baseURI); final TupleQueryResult tqr = tq.evaluate(); try { assertEquals(baseURI, remote.data.opts.getRequestParam(RemoteRepositoryDecls.BASE_URI)); assertEquals(baseURI,remote.data.opts.getRequestParam(RemoteRepositoryDecls.BASE_URI)); } finally { tqr.close(); } }