Search in sources :

Example 6 with SPARQLParser11

use of org.apache.jena.sparql.lang.sparql_11.SPARQLParser11 in project jena by apache.

the class ParserSPARQL11Update method _parse.

private void _parse(UpdateSink sink, Reader r) {
    SPARQLParser11 parser = null;
    try {
        parser = new SPARQLParser11(r);
        parser.setUpdateSink(sink);
        parser.UpdateUnit();
    } catch (org.apache.jena.sparql.lang.sparql_11.ParseException ex) {
        throw new QueryParseException(ex.getMessage(), ex.currentToken.beginLine, ex.currentToken.beginColumn);
    } catch (org.apache.jena.sparql.lang.sparql_11.TokenMgrError tErr) {
        // Last valid token : not the same as token error message - but this should not happen
        int col = parser.token.endColumn;
        int line = parser.token.endLine;
        throw new QueryParseException(tErr.getMessage(), line, col);
    } catch (UpdateException ex) {
        throw ex;
    } catch (JenaException ex) {
        throw new QueryException(ex.getMessage(), ex);
    } catch (Error err) {
        // The token stream can throw errors.
        throw new QueryParseException(err.getMessage(), err, -1, -1);
    } catch (Throwable th) {
        Log.error(this, "Unexpected throwable: ", th);
        throw new QueryException(th.getMessage(), th);
    }
}
Also used : JenaException(org.apache.jena.shared.JenaException) QueryException(org.apache.jena.query.QueryException) SPARQLParser11(org.apache.jena.sparql.lang.sparql_11.SPARQLParser11) UpdateException(org.apache.jena.update.UpdateException) QueryParseException(org.apache.jena.query.QueryParseException)

Aggregations

SPARQLParser11 (org.apache.jena.sparql.lang.sparql_11.SPARQLParser11)6 StringReader (java.io.StringReader)2 Query (org.apache.jena.query.Query)2 QueryException (org.apache.jena.query.QueryException)2 QueryParseException (org.apache.jena.query.QueryParseException)2 JenaException (org.apache.jena.shared.JenaException)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 Reader (java.io.Reader)1 Expr (org.apache.jena.sparql.expr.Expr)1 Element (org.apache.jena.sparql.syntax.Element)1 Template (org.apache.jena.sparql.syntax.Template)1 UpdateException (org.apache.jena.update.UpdateException)1