@Override protected void runTest() throws Exception { // Read query from file InputStream stream = new URL(queryFileURL).openStream(); String query = IOUtil.readString(new InputStreamReader(stream, "UTF-8")); stream.close(); try { QueryParserUtil.parseQuery(QueryLanguage.SPARQL, query, queryFileURL); if (!positiveTest) { fail("Negative test case should have failed to parse"); } } catch (MalformedQueryException e) { if (positiveTest) { e.printStackTrace(); fail("Positive test case failed: " + e.getMessage()); } } }
@Override protected void runTest() throws Exception { InputStream stream = new URL(queryFileURL).openStream(); String query = IOUtil.readString(new InputStreamReader(stream, "UTF-8")); stream.close(); try { parseQuery(query, queryFileURL); if (!positiveTest) { fail("Negative test case should have failed to parse"); } } catch (MalformedQueryException e) { if (positiveTest) { e.printStackTrace(); fail("Positive test case failed: " + e.getMessage()); } } }
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) { ModelAndView result = new ModelAndView(); result.setViewName(view); Map<String, Object> model = new HashMap<String, Object>(); try { List<Resource> classes = getClasses(request); Collections.sort(classes, ToStringComparator.getInstance()); model.put("classes", classes); } catch (RepositoryException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (QueryEvaluationException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (MalformedQueryException e) { // TODO Auto-generated catch block e.printStackTrace(); } result.addAllObjects(model); return result; }
} catch (final MalformedQueryException e) e.printStackTrace(); } catch (final QueryEvaluationException e)
} catch (final MalformedQueryException e) e.printStackTrace(); } catch (final QueryEvaluationException e)
/** * Clears the Anno4j underlying triplestore. * This is required in order to prevent a drop in throughput while parsing. * * @throws RepositoryException Thrown if no connection to the object repository could be made. * @throws UpdateExecutionException Thrown if an error occurred while executing the clearing query. */ private void clear() throws RepositoryException, UpdateExecutionException { String deleteUpdate = "DELETE {?s ?p ?o}\n" + "WHERE {?s ?p ?o}"; ObjectConnection connection = anno4j.getObjectRepository().getConnection(); Update update; try { update = connection.prepareUpdate(deleteUpdate); } catch (MalformedQueryException e) { e.printStackTrace(); return; } update.execute(); }
} catch (final MalformedQueryException e) { System.out.println("Processing: " + queryString); e.printStackTrace(); } catch (final QueryEvaluationException e) { System.out.println("Processing: " + queryString);
public CloseableIteration<BindingSet, QueryEvaluationException> queryDocIndex(final String sparqlQuery, final Collection<BindingSet> constraints) throws TableNotFoundException, QueryEvaluationException { final SPARQLParser parser = new SPARQLParser(); ParsedQuery pq1 = null; try { pq1 = parser.parseQuery(sparqlQuery, null); } catch (final MalformedQueryException e) { e.printStackTrace(); throw new QueryEvaluationException("Malformed query. query=" + sparqlQuery, e); } final TupleExpr te1 = pq1.getTupleExpr(); final List<StatementPattern> spList1 = StatementPatternCollector.process(te1); if(StarQuery.isValidStarQuery(spList1)) { final StarQuery sq1 = new StarQuery(spList1); return queryDocIndex(sq1, constraints); } else { throw new IllegalArgumentException("Invalid star query!"); } }
} catch (final MalformedQueryException e) e.printStackTrace(); } catch (final QueryEvaluationException e)
} catch (final MalformedQueryException e) e.printStackTrace(); } catch (final QueryEvaluationException e)
e.printStackTrace(); } catch (final MalformedQueryException e) { e.printStackTrace(); } catch (final QueryEvaluationException e) { e.printStackTrace();
} catch (final MalformedQueryException e) e.printStackTrace(); } catch (final QueryEvaluationException e)
e1.printStackTrace(); } catch (final MalformedQueryException e1) { e1.printStackTrace(); } catch (final QueryEvaluationException e1) { e1.printStackTrace();
} catch (final MalformedQueryException e) e.printStackTrace(); } catch (final QueryEvaluationException e)
e.printStackTrace(); fail("Positive test case failed: " + e.getMessage());
} catch (final MalformedQueryException e) e.printStackTrace(); } catch (final QueryEvaluationException e)
} catch (final MalformedQueryException e) e.printStackTrace(); } catch (final QueryEvaluationException e)