Package org.exist.xquery

Examples of org.exist.xquery.PathExpr


                throw new RemoteException(parser.getErrorMessage());
            }
           
            final AST ast = parser.getAST();
           
            final PathExpr expr = new PathExpr(context);
            treeParser.xpath(ast, expr);
            if (treeParser.foundErrors()) {
                LOG.debug(treeParser.getErrorMessage());
                throw new EXistException(treeParser.getErrorMessage());
            }
            LOG.info("query: " + ExpressionDumper.dump(expr));
            final long start = System.currentTimeMillis();
            expr.analyze(new AnalyzeContextInfo());
            final Sequence seq= expr.eval(null, null);
           
            QueryResponseCollection[] collections = null;
            if (!seq.isEmpty() && Type.subTypeOf(seq.getItemType(), Type.NODE))
                {collections = collectQueryInfo(scanResults(seq));}
            session.addQueryResult(seq);
            resp.setCollections(new QueryResponseCollections(collections));
            resp.setHits(seq.getItemCount());
            resp.setQueryTime(System.currentTimeMillis() - start);
            expr.reset();
            context.reset();
        } catch (final Exception e) {
            LOG.debug(e.getMessage(), e);
            throw new RemoteException("query execution failed: " + e.getMessage());
        } finally {
View Full Code Here


            AST ast = parser.getAST();
            if (ast == null)
                throw new XPathException("Unknown XQuery parser error: the parser returned an empty syntax tree.");

            PathExpr expr = new PathExpr(context);
            if (xpointer)
                treeParser.xpointer(ast, expr);
            else
                treeParser.xpath(ast, expr);
            if (treeParser.foundErrors()) {
                throw new StaticXQueryException(
                treeParser.getErrorMessage(),
                treeParser.getLastException());
            }

            expr.analyze(new AnalyzeContextInfo(context));

//            if (context.optimizationsEnabled()) {
//                Optimizer optimizer = new Optimizer(context);
//                expr.accept(optimizer);
//                if (optimizer.hasOptimized()) {
View Full Code Here

      final AST ast = parser.getAST();
     
      if (LOG.isDebugEnabled())
        {LOG.debug("generated AST: " + ast.toStringTree());}

      final PathExpr expr = new PathExpr(context);
      treeParser.xpath(ast, expr);
      if (treeParser.foundErrors()) {
        throw new SAXException(treeParser.getErrorMessage());
      }
      expr.analyze(new AnalyzeContextInfo());
      final Sequence seq = expr.eval(null, null);
      return seq;
    } catch (final RecognitionException e) {
      LOG.warn("error while creating variable", e);
      throw new SAXException(e);
    } catch (final TokenStreamException e) {
View Full Code Here

  private Sort sort = null;
 
  public ForEach(XSLContext context) {
    super(context);
   
    childNodes = new PathExpr(getContext());
    childNodes.add(new LocationStep(getContext(), Constants.CHILD_AXIS, new AnyNodeTest()));

  }
View Full Code Here

                //TODO : error ?
                LOG.debug(parser.getErrorMessage());
            }
            final AST ast = parser.getAST();
            LOG.debug("generated AST: " + ast.toStringTree());
            expr = new PathExpr(context);
            treeParser.xpath(ast, expr);
            if (treeParser.foundErrors()) {
                LOG.debug(treeParser.getErrorMessage());
            }
            expr.analyze(new AnalyzeContextInfo());
View Full Code Here

        throw new XPathException(this, "error found while executing expression: " +
          parser.getErrorMessage());
      }
      final AST ast = parser.getAST();
     
      final PathExpr path = new PathExpr(pContext);
      astParser.xpath(ast, path);
      if(astParser.foundErrors()) {
        throw astParser.getLastException();
      }
      path.analyze(new AnalyzeContextInfo());
    } catch (final RecognitionException e) {     
      error = e.toString();
    } catch (final TokenStreamException e) {
      error = e.toString();
    } catch (final XPathException e) {
View Full Code Here

TOP

Related Classes of org.exist.xquery.PathExpr

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.