Examples of XQExpression


Examples of xbird.xquery.expr.XQExpression

        if(expectedNamespace == null) {
            throw new XQueryException("err:XQST0046", "Library module MUST have a target namespace");
        }
        for(Variable v : globals) {
            QualifiedName varName = v.getVarName();
            XQExpression value = v.getValue();
            declareGlobalVariable(varName, value);
        }
    }
View Full Code Here

Examples of xbird.xquery.expr.XQExpression

        } catch (CacheException e) {
            reportError("Caching failed: " + queryPath, e, out);
            return;
        }
        XQueryModule loadedModule = loaded.queryObject;
        XQExpression body = loadedModule.getExpression();
        if(body == null) {
            return;
        }
        // set parameters
        Enumeration<String> paramNames = req.getParameterNames();
        while(paramNames.hasMoreElements()) {
            String name = paramNames.nextElement();
            String value = req.getParameter(name);
            QualifiedName qname = QNameUtil.parse(name, XQSP_NSURI);
            Variable var = loadedModule.getVariable(qname);
            if(var != null && (var instanceof ExternalVariable)) {
                var.setResult(XString.valueOf(value));
            }
        }
        // execute
        final Sequence<? extends Item> result;
        try {
            result = body.eval(null, new DynamicContext(loaded.staticEnv));
        } catch (XQueryException e) {
            reportError("Execution failed: " + queryPath, e, out);
            return;
        }
        // serialize       
View Full Code Here

Examples of xbird.xquery.expr.XQExpression

            throws XQueryException {
        // static analysis
        StaticContext statEnv = dynEnv.getStaticContext();
        module.staticAnalysis(statEnv);
        // dynamic evaluation     
        XQExpression body = module.getExpression();
        dynEnv.setQueryExpression(body);
        evalHook(dynEnv);
        Sequence<? extends Item> result = body.eval(contextItem, dynEnv);
        if(PROFILE_LOG.isInfoEnabled()) {
            Profiler profiler = dynEnv.getProfiler();
            if(profiler != null && profiler.getDTMReads() > 0) {
                PROFILE_LOG.info(profiler);
            }
View Full Code Here

Examples of xbird.xquery.expr.XQExpression

            throws XQueryException {
        // static analysis
        StaticContext statEnv = dynEnv.getStaticContext();
        module.staticAnalysis(statEnv);
        // dynamic evaluation
        XQExpression body = module.getExpression();
        dynEnv.setQueryExpression(body);
        evalHook(dynEnv);
        body.evalAsEvents(handler, contextItem, dynEnv);
        if(PROFILE_LOG.isInfoEnabled()) {
            Profiler profiler = dynEnv.getProfiler();
            if(profiler != null && profiler.getDTMReads() > 0) {
                PROFILE_LOG.info(profiler);
            }
View Full Code Here

Examples of xbird.xquery.expr.XQExpression

        final FunctionSignature sig = getFunctionSignature(arity);
        final Type[] expectedTypes = sig.getArgumentTypes();
        assert (expectedTypes.length == arity);
        for(int i = 0; i < arity; i++) {
            Type expected = expectedTypes[i];
            XQExpression expr = params.get(i);
            Type actual = expr.getType();
            if(!TypeUtil.subtypeOf(actual, expected)) {// REVIEWME ok
                throw new TypeError("err:XPTY0004", i + "th parameter type '" + actual
                        + "' does not match to the expected argument type '" + expected + '\'');
            }
        }
View Full Code Here

Examples of xbird.xquery.expr.XQExpression

        if(rsig != Signature.COMPILE) {
            throw new IllegalStateException("Illegal command is passed to DistributedCompileProcessor: "
                    + 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);
            _resHandler.onResponse(rc);
View Full Code Here

Examples of xbird.xquery.expr.XQExpression

    }

    @Override
    public void writeExternal(ObjectOutput out) throws IOException {
        super.writeExternal(out);
        final XQExpression bodyExpr = _bodyExpression;
        if(bodyExpr == null) {
            out.writeBoolean(false);
        } else {
            out.writeBoolean(true);
            out.writeObject(bodyExpr);
View Full Code Here

Examples of xbird.xquery.expr.XQExpression

        buf.append(" (");
        for(int i = 0; i < _parameters.size(); i++) {
            if(i != 0) {
                buf.append(", ");
            }
            XQExpression p = _parameters.get(i);
            buf.append(p.toString());
        }
        buf.append(") ");
        Type retType = getReturnType();
        if(retType != null) {
            buf.append("as ");
View Full Code Here

Examples of xbird.xquery.expr.XQExpression

    public Function staticAnalysis(StaticContext statEnv, List<? extends XQExpression> params)
            throws XQueryException {
        if(_bodyExpression == null) {
            throw new IllegalStateException("Expression is not binded!");
        }
        XQExpression analyzed = _bodyExpression.staticAnalysis(statEnv);
        this._bodyExpression = analyzed;
        final Type inferredType = analyzed.getType();
        if(_returnType == Untyped.UNTYPED) {
            this._returnType = inferredType;
        }
        return this;
    }
View Full Code Here

Examples of xbird.xquery.expr.XQExpression

            return expr;
        }

        @Override
        public XQExpression visit(Variable variable, XQueryContext ctxt) throws XQueryException {
            XQExpression expr = variable.getValue();
            if(expr != null) {
                expr.visit(this, ctxt);
            }
            return variable;
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.