Package xbird.xquery.parser

Examples of xbird.xquery.parser.XQueryParser


                        File file = fc.getSelectedFile();
                        System.err.println(file.getName());
                        System.out.println(IOUtils.toString(new FileInputStream(file)));
                        System.out.println();
                        FileReader fr = new FileReader(file);
                        XQueryParser t = new XQueryParser(fr);
                        XQueryModule m = t.parse();
                        fr.close();
                        StaticContext sc = t.getStaticContext();
                        sc.setSystemBaseURI(statEnv.getSystemBaseURI());
                        m.staticAnalysis(sc);
                        m.visit(GraphConstructionVisitor.this, sc);
                        // create panel
                        final JGraph jgraph = createJGraph();
View Full Code Here


    public <T extends Serializable> T execute(String query, RequestManager rm, ReturnType returnType)
            throws RemoteException {
        assert (query != null);
        assert (rm != null);
        // #1 local-compile
        final XQueryParser parser = new XQueryParser(new StringReader(query));
        XQExpression body = localCompile(parser);
        final int numQP = rm.getNumberOfQueryProcessors();
        if(numQP > 1) {
            // #2 distributed-compile
            body = distributedCompile(body, rm);
        }
        // #3 evaluation
        StaticContext statEnv = parser.getStaticContext();
        final Sequence result;
        try {
            result = body.eval(null, new DynamicContext(statEnv));
        } catch (XQueryException e) {
            throw new RemoteException("Evaluation failed.", e);
View Full Code Here

        if(cached == null || cached.loadTimeStamp < lastModified) {
            if(cached == null) {
                cached = new CachedQuery();
            }
            // parse XQuery expression
            XQueryParser parser = new XQueryParser(is);
            StaticContext staticEnv = parser.getStaticContext();
            try {
                URI baseUri = url.toURI();
                staticEnv.setBaseURI(baseUri);
            } catch (URISyntaxException e) {
                log(PrintUtils.prettyPrintStackTrace(e, -1));
            }
            final XQueryModule module;
            try {
                module = parser.parse();
            } catch (XQueryException e) {
                log(PrintUtils.prettyPrintStackTrace(e, -1));
                _lock.readLock().unlock();
                throw e;
            }
View Full Code Here

        return is;
    }

    private static XQueryModule obtainModule(final InputStream target, final StaticContext statEnv)
            throws XQueryException {
        final XQueryParser parser = new XQueryParser(target);
        parser.setStaticContext(statEnv);
        final XQueryModule module;
        try {
            module = parser.parse();
        } catch (XQueryException e) {
            final Throwable cause = e.getCause();
            if(cause instanceof ParseException) {
                throw new StaticError("err:XQST0059", "parse failed.", cause);
            } else {
View Full Code Here

    public XQueryModule parse(Reader r) throws XQueryException {
        return parse(r, null);
    }

    public XQueryModule parse(Reader r, URI baseUri) throws XQueryException {
        final XQueryParser parser;
        try {
            parser = new XQueryParser(r);
        } catch (TokenMgrError e) {
            throw new SyntaxError("err:XPST0003", e);
        }
        if(_statEnv != null) {
            parser.setStaticContext(_statEnv);
        } else {
            this._statEnv = parser.getStaticContext();
        }
        if(baseUri != null) {
            _statEnv.setSystemBaseURI(baseUri);
        }
        if(_module != null) {
            parser.setCurrentModule(_module);
        }
        XQueryModule m = parser.parse();
        return m;
    }
View Full Code Here

        return res;
    }

    private static XQExpression resolveExpression(Reader reader, StaticContext staticEnv)
            throws XQueryException {
        XQueryParser parser = new XQueryParser(reader);
        parser.setStaticContext(staticEnv);
        Module mod = parser.parse();
        XQExpression body = mod.getExpression();
        return body;
    }
View Full Code Here

    public static Sequence evaluateQuery(Reader reader, DynamicContext dynEnv)
            throws XQueryException {
        assert (dynEnv != null);
        // parse query
        XQueryParser parser = new XQueryParser(reader);
        StaticContext sc = dynEnv.getStaticContext();
        parser.setStaticContext(sc);
        Module mod = parser.parse();
        // static analysis
        mod.staticAnalysis(sc);
        // evaluate
        XQExpression body = mod.getExpression();
        Sequence res = body.eval(ValueSequence.EMPTY_SEQUENCE, dynEnv);
View Full Code Here

            if(cached == null) {
                cached = new CachedQuery();
            }
            // parse XQuery expression
            InputStream is = url.openStream();
            XQueryParser parser = new XQueryParser(is);
            StaticContext staticEnv = parser.getStaticContext();
            staticEnv.setBaseURI(path);
            XQueryModule module = parser.parse();
            _lock.readLock().unlock();
            _lock.writeLock().lock();
            // set query cache
            cached.queryObject = module;
            cached.staticEnv = staticEnv;
View Full Code Here

TOP

Related Classes of xbird.xquery.parser.XQueryParser

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.