protected Model executeConstructQuery(String query) { logger.trace("Sending query\n{} ...", query); QueryExecution qe = qef.createQueryExecution(query); try { Model model = qe.execConstruct(); timeout = false; if (model.size() == 0) { fullDataLoaded = true; } logger.debug("Got " + model.size() + " triples."); return model; } catch (QueryExceptionHTTP e) { if (e.getCause() instanceof SocketTimeoutException) { logger.warn("Got timeout"); } else { logger.error("Exception executing query", e); } return ModelFactory.createDefaultModel(); } }
protected ResultSet executeSelectQuery(String query) { logger.trace("Sending query\n{} ...", query); QueryExecution qe = qef.createQueryExecution(query); try { ResultSet rs = qe.execSelect(); timeout = false; return rs; } catch (QueryExceptionHTTP e) { if (e.getCause() instanceof SocketTimeoutException) { if (timeout) { logger.warn("Got timeout"); throw e; } else { logger.trace("Got local timeout"); } } else { logger.error("Exception executing query", e); } return new ResultSetMem(); } }