Package xbird.xquery.meta

Examples of xbird.xquery.meta.StaticContext


        try {
            m = t.parse();
        } catch (Throwable e) {
            throw new Exception("Exception caused while parsing: " + path, e);
        }
        StaticContext sc = t.getStaticContext();
        sc.setSystemBaseURI(new File(path).toURI());
        if (enableStaticAnalysis) {
            m.staticAnalysis(sc);
        }
        GraphConstructionVisitor visualizer = new GraphConstructionVisitor(sc);
        m.visit(visualizer, sc);
View Full Code Here


        SequenceExpression seq = new SequenceExpression();
        AtomicValue it1 = new XString("1");
        AtomicValue it2 = new XString("2");
        seq.addExpression(new LiteralExpr(it1));
        seq.addExpression(new LiteralExpr(it2));
        Sequence<Item> res = (Sequence<Item>) seq.eval(null, new DynamicContext(new StaticContext()));
        Iterator<Item> resItor = res.iterator();
        assertTrue(resItor.hasNext());
        assertSame(it1, resItor.next());
        assertTrue(resItor.hasNext());
        assertSame(it2, resItor.next());
View Full Code Here

            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 {
View Full Code Here

    }

    public Sequence<? extends Item> execute(XQueryModule module, DynamicContext dynEnv)
            throws XQueryException {
        // static analysis
        StaticContext statEnv = dynEnv.getStaticContext();
        module.staticAnalysis(statEnv);
        // dynamic evaluation     
        XQExpression body = module.getExpression();
        dynEnv.setQueryExpression(body);
        evalHook(dynEnv);
View Full Code Here

    }

    public void execute(XQueryModule module, DynamicContext dynEnv, XQEventReceiver handler)
            throws XQueryException {
        // static analysis
        StaticContext statEnv = dynEnv.getStaticContext();
        module.staticAnalysis(statEnv);
        // dynamic evaluation
        XQExpression body = module.getExpression();
        dynEnv.setQueryExpression(body);
        evalHook(dynEnv);
View Full Code Here

            }
        }
    }

    private static void evalHook(DynamicContext dynEnv) {
        final StaticContext statEnv = dynEnv.getStaticContext();
        final List<ThreadedVariable> threadedVars = statEnv.getThreadedVariables();
        for(ThreadedVariable threadedVar : threadedVars) {
            final String threadName = "ThreadedVariable#" + threadedVar.getName();
            threadedVar.setDynamicContext(dynEnv);
            final Thread task = new Thread(threadedVar, threadName);
            task.setDaemon(true);
View Full Code Here

                    + rsig);
        }
        final CompileRequest compileRequest = (CompileRequest) request;
        final XQExpression rawExpr = compileRequest.getExpression();

        final StaticContext statEnv = new StaticContext();
        final XQExpression compiledExpr;
        try {
            compiledExpr = rawExpr.staticAnalysis(statEnv);
        } catch (XQueryException e) {
            rc.setFault(e);
View Full Code Here

        return QualifiedName.class;
    }

    public QNameValue createInstance(String literal, AtomicType srcType, DynamicContext dynEnv)
            throws XQueryException {
        final StaticContext staticEnv = dynEnv.getStaticContext();
        final QualifiedName name;
        try {
            name = QNameUtil.parse(literal, staticEnv.getStaticalyKnownNamespaces(), staticEnv.getDefaultElementNamespace());
        } catch (XQueryException e) {
            e.setErrCode("err:FONS0004");
            throw e;
        }
        return new QNameValue(name);
View Full Code Here

        return s;
    }

    public Sequence eval(Sequence<? extends Item> contextSeq, ValueSequence argv, DynamicContext dynEnv)
            throws XQueryException {
        StaticContext sc = dynEnv.getStaticContext();
        URI uri = sc.getBaseURI();
        if(uri == null) {
            return ValueSequence.EMPTY_SEQUENCE;
        }
        return new AnyURIValue(uri);
    }
View Full Code Here

        match("//*/cccc", "/bbb/aaa/ccc/cccc", true);
        match("//aaa/*", "/bbb/aaa/ccc/cccc", false);
    }
   
    private void match(String ptnStr1, String ptnStr2, boolean expected) {
        StaticContext statEnv = new StaticContext();
        NamespaceBinder namespaces = statEnv.getStaticalyKnownNamespaces();
        XMLPathPattern ptn1 = new XMLPathPattern(ptnStr1, namespaces);
        XMLPathPattern ptn2 = new XMLPathPattern(ptnStr2, namespaces);
        Assert.assertSame(ptn1 + " <-> " + ptn2, expected, ptn1.match(ptn2));
    }
View Full Code Here

TOP

Related Classes of xbird.xquery.meta.StaticContext

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.