Package xbird.xquery.expr

Examples of xbird.xquery.expr.XQExpression


        return step;
    }

    public XQExpression visit(BindingVariable variable, XQueryContext ctxt) throws XQueryException {
        if(!(variable instanceof PositionalVariable)) {
            XQExpression expr = variable.getValue();
            assert (expr != null);
            expr.visit(this, ctxt);
        }
        return variable;
    }
View Full Code Here


    public XQExpression visit(CompositePath fragment, XQueryContext ctxt) throws XQueryException {
        String node = "#" + counter + " CompositePath";
        addChildNode(node, fragment);
        parentStack.push(node);
        XQExpression srcExpr = fragment.getSourceExpr();
        srcExpr.visit(this, ctxt);
        parentStack.pop();
        return fragment;
    }
View Full Code Here

                Object cell = jgraph.getSelectionCell();
                if(cell instanceof DefaultGraphCell) {
                    DefaultGraphCell selectedCell = (DefaultGraphCell) cell;
                    if(selectedCell != null) {
                        String selected = (String) selectedCell.getUserObject();
                        XQExpression expr = sourceExprMap.get(selected);
                        JOptionPane.showMessageDialog(frame, (expr == null) ? selected
                                : expr.toString());
                    }
                }
                super.mouseClicked(ev);
            } else if(SwingUtilities.isRightMouseButton(ev)) {
                DefaultGraphCell selectedCell = (DefaultGraphCell) jgraph.getSelectionCell();
View Full Code Here

            assert (cell != null);
            final JPopupMenu menu = new JPopupMenu();
            menu.add(new AbstractAction("Show InferredType") {
                public void actionPerformed(ActionEvent e) {
                    String selected = (String) cell.getUserObject();
                    XQExpression expr = sourceExprMap.get(selected);
                    Type type = expr.getType();
                    JOptionPane.showMessageDialog(frame, (type == null) ? "nil" : type);
                }
            });
            menu.add(new AbstractAction("Eval Expression") {
                public void actionPerformed(ActionEvent e) {
                    String selected = (String) cell.getUserObject();
                    XQExpression expr = sourceExprMap.get(selected);
                    DynamicContext dynEnv = new DynamicContext(statEnv);
                    StringWriter sw = new StringWriter();
                    SAXSerializer ser = new SAXSerializer(new SAXWriter(sw), sw);
                    try {
                        expr.evalAsEvents(ser, ValueSequence.EMPTY_SEQUENCE, dynEnv);
                    } catch (Exception ex) {
                        JOptionPane.showMessageDialog(frame, "eval failed!: " + ex.getMessage());
                        ex.printStackTrace();
                        return;
                    }
                    JOptionPane.showMessageDialog(frame, sw.toString());
                }
            });
            menu.add(new AbstractAction("Eval Expression (pull)") {
                public void actionPerformed(ActionEvent e) {
                    String selected = (String) cell.getUserObject();
                    XQExpression expr = sourceExprMap.get(selected);
                    DynamicContext dynEnv = new DynamicContext(statEnv);
                    final Sequence result;
                    try {
                        result = expr.eval(ValueSequence.EMPTY_SEQUENCE, dynEnv);
                    } catch (Exception ex) {
                        JOptionPane.showMessageDialog(frame, "eval failed!: " + ex.getMessage());
                        ex.printStackTrace();
                        return;
                    }
                    JOptionPane.showMessageDialog(frame, result.toString());
                }
            });
            menu.add(new AbstractAction("Print Tree") {
                public void actionPerformed(ActionEvent e) {
                    String selected = (String) cell.getUserObject();
                    XQExpression expr = sourceExprMap.get(selected);
                    String s = expr.toString();
                    JOptionPane.showMessageDialog(frame, (expr == null) ? selected : s);
                    System.out.println(s);
                    System.out.println();
                }
            });
View Full Code Here

        @Override
        public ForClause visit(ForClause clause, XQueryContext ctxt) throws XQueryException {
            ForVariable var = clause.getVariable();
            excludedVariableList.add(var);
            XQExpression e = var.getValue();
            e.visit(this, ctxt);
            return clause;
        }
View Full Code Here

        @Override
        public LetClause visit(LetClause clause, XQueryContext ctxt) throws XQueryException {
            LetVariable var = clause.getVariable();
            excludedVariableList.add(var);
            XQExpression e = var.getValue();
            e.visit(this, ctxt);
            return clause;
        }
View Full Code Here

        if(mapping.isEmpty()) {// no mapping found
            return Collections.emptyMap();
        }

        final BindingVariable bindingVar = mapExpr.getBindingVariable();
        final XQExpression bodyExpr = mapExpr.getBodyExpression();
        final byte[] exprBytes = DispatchQueryExecTask.toBytes(bindingVar, bodyExpr);

        final GridNodeSelector selector = config.getNodeSelector();
        assert (selector != null);
View Full Code Here

        }
        return false;
    }

    public boolean equals(OrderSpec other) {
        XQExpression orderExpr = other.getKeyExpr();
        if(!(orderExpr instanceof VarRef)) {
            return false;
        }
        VarRef orderingVarRef = (VarRef) orderExpr;
        Variable orderingVar = orderingVarRef.getValue();
View Full Code Here

            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);
        }
        return (T) wrapResult(result, returnType);
    }
View Full Code Here

        if(mapping.isEmpty()) {// no mapping found
            return Collections.emptyMap();
        }

        final BindingVariable bindingVar = mapExpr.getBindingVariable();
        final XQExpression bodyExpr = mapExpr.getBodyExpression();
        final GridNodeSelector selector = config.getNodeSelector();
        assert (selector != null);

        final Map<GridNode, List<String>> nodeKeysMap = new HashMap<GridNode, List<String>>(numLiveNodes);
        final Map<GridTask, GridNode> map = new IdentityHashMap<GridTask, GridNode>(numLiveNodes);
View Full Code Here

TOP

Related Classes of xbird.xquery.expr.XQExpression

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.