Search in sources :

Example 16 with QueryParseException

use of org.apache.jena.query.QueryParseException in project jena by apache.

the class TestPath method parse.

private void parse(String string, boolean expectLegal) {
    Prologue prologue = new Prologue(pmap);
    Path p = null;
    try {
        p = PathParser.parse(string, prologue);
        //            System.out.println(PathWriterSSE.asString(p, new Prologue(pmap))) ;
        if (!expectLegal)
            fail("Expected error; " + string);
    } catch (QueryParseException ex) {
        if (expectLegal)
            fail("Expected success: " + string + ": " + ex.getMessage());
        return;
    }
    String x = p.toString(prologue);
    Path p2 = PathParser.parse(x, prologue);
    assertEquals(p, p2);
    String sse = WriterPath.asString(p, prologue);
    Item item = SSE.parseItem(sse, pmap);
    p2 = BuilderPath.buildPath(item);
    assertEquals(p, p2);
}
Also used : WriterPath(org.apache.jena.sparql.sse.writers.WriterPath) BuilderPath(org.apache.jena.sparql.sse.builders.BuilderPath) Item(org.apache.jena.sparql.sse.Item) Prologue(org.apache.jena.sparql.core.Prologue) QueryParseException(org.apache.jena.query.QueryParseException)

Aggregations

QueryParseException (org.apache.jena.query.QueryParseException)16 StringReader (java.io.StringReader)6 QueryException (org.apache.jena.query.QueryException)6 JenaException (org.apache.jena.shared.JenaException)6 Reader (java.io.Reader)5 ARQParser (org.apache.jena.sparql.lang.arq.ARQParser)4 Query (org.apache.jena.query.Query)3 VarExprList (org.apache.jena.sparql.core.VarExprList)3 UpdateRequest (org.apache.jena.update.UpdateRequest)3 JsonBuilder (org.apache.jena.atlas.json.JsonBuilder)2 Syntax (org.apache.jena.query.Syntax)2 Prologue (org.apache.jena.sparql.core.Prologue)2 Expr (org.apache.jena.sparql.expr.Expr)2 SPARQLParser11 (org.apache.jena.sparql.lang.sparql_11.SPARQLParser11)2 UpdateException (org.apache.jena.update.UpdateException)2 IOException (java.io.IOException)1 ServletException (javax.servlet.ServletException)1 ArgDecl (jena.cmd.ArgDecl)1 CmdException (jena.cmd.CmdException)1 CmdLineArgs (jena.cmd.CmdLineArgs)1