protected static String messageForQueryException(QueryException ex) { if ( ex.getMessage() != null ) return ex.getMessage() ; if ( ex.getCause() != null ) return Lib.classShortName(ex.getCause().getClass()) ; return null ; }
protected static String messageForQueryException(QueryException ex) { if ( ex.getMessage() != null ) return ex.getMessage() ; if ( ex.getCause() != null ) return Lib.classShortName(ex.getCause().getClass()) ; return null ; }
ServletOps.errorBadRequest("Error: \n" + queryString + "\n\r" + ex.getMessage()) ;
ServletOps.errorBadRequest("Error: \n" + queryString + "\n\r" + ex.getMessage()) ;
@Override public QueryIterator execEvaluated(Binding binding, PropFuncArg argSubject, Node predicate, PropFuncArg argObject, ExecutionContext execCxt) { try { // Subject bound to something other a URI. if ( argSubject.getArg().isLiteral() || argSubject.getArg().isBlank() ) // Only split IRIs return IterLib.noResults(execCxt) ; if ( argSubject.getArg().isURI() ) // Case 1 : subject is a fixed URI or a variable bount to a URI. return subjectIsIRI(argSubject.getArg(), argObject, binding, execCxt) ; else // Case 2 : subject is an unbound variable. return subjectIsVariable(argSubject.getArg(), argObject, execCxt) ; } catch (QueryException ex) { Log.warn(this, "Unexpected problems in splitIRI: "+ex.getMessage()) ; return null ; } }
@Test @Category(TestSuites.Prepush.class) public void sparqlOrderByError_bug19157_rfe9971_yes_check() throws Exception { AGGraphMaker maker = closeLater(new AGGraphMaker(conn)); AGGraph graph = closeLater(maker.getGraph()); AGModel model = closeLater(new AGModel(graph)); Resource bob = model.createResource("http://example.org/people/bob"); Resource dave = model.createResource("http://example.org/people/dave"); Property fatherOf = model.createProperty("http://example.org/ontology/fatherOf"); Property age = model.createProperty("http://example.org/ontology/age"); Literal three = model.createTypedLiteral(3); model.add(bob, fatherOf, dave); model.add(dave, age, three); AGQuery query = AGQueryFactory.create("select ?s ?p ?o where { ?s ?p ?o . } order by ?z ?s"); { query.setCheckVariables(true); AGQueryExecution qe = closeLater(AGQueryExecutionFactory.create(query, model)); try { qe.execSelect(); Assert.fail("query should have failed because of ?z"); } catch (QueryException e) { if (!(e.getMessage().contains("Variables do not intersect with query: ?z") || e.getMessage().contains("unknown variable in order expression: ?z") || e.getMessage().contains("Unknown variable used in order expression: ?z"))) { throw e; } } } }
fail("Parse failure: "+qEx.getMessage()) ; throw qEx ;
} catch (QueryException ex) System.out.println("Query exception: "+ex.getMessage()) ;