Package xbird.xquery.dm.value

Examples of xbird.xquery.dm.value.XQNode


        }

        public boolean next(IFocus focus) throws XQueryException {
            Iterator<? extends XQNode> delItor = focus.getBaseFocus();
            if(delItor.hasNext()) {
                XQNode delItem = delItor.next();
                DMNode dmnode = delItem.asDMNode();
                focus.setContextItem(dmnode);
                return true;
            }
            return false;
        }
View Full Code Here


        }

        @Override
        public final XQNode following(final boolean firstcall) {
            final PagingProfile profile = _store.getPagingProfile();
            final XQNode node;
            if(profile != null) {
                Strategy origStrategy = profile.getStrategy();
                if(origStrategy != Strategy.nextsib) {
                    assert (origStrategy != null);
                    profile.setStrategy(Strategy.nextsib);
View Full Code Here

            DTMAttribute base = getAttribute(XMLConstants.XML_NS_URI, "base");
            if(base != null) {
                String uri = base.getContent();
                return uri;
            } else {
                XQNode p = parent();
                while(p != null) {
                    String uri = p.baseUri();
                    if(uri != null) {
                        return uri;
                    }
                    p = p.parent();
                }
                return null;
            }
        }
View Full Code Here

                        break outer;
                    }
                    ptr = pendings.dequeue();
                }
                DocumentTableModel dtm = ffcous.getDocumentTableModel();
                XQNode node = dtm.createNode(ptr);
                ffcous.setContextItem(node);
                return true;
            }
            final Profiler profiler = _dynEnv.getProfiler();
            final Iterator<Pair<DbCollection, String>> itor = ffcous.eachDocument();
            while(itor.hasNext()) {
                final Pair<DbCollection, String> pair = itor.next();
                final DbCollection col = pair.getFirst();
                final String docName = pair.getSecond();
                final File idxFile = getIndexFile(col, docName);
                BTreeIndexer indexer = new BTreeIndexer(idxFile);
                final IndexMatch matched;
                try {
                    matched = indexer.find(idxCond);
                } catch (DbException e) {
                    throw new XQRTException("failed to query index: " + idxFile.getAbsolutePath(), e);
                }
                // TODO REVIEWME sort really required?
                final long[] ptrs = filter(matched.getMatchedUnsorted(), docName, idxFile);
                final int matchCounts = ptrs.length;
                if(LOG.isInfoEnabled()) {
                    LOG.info("Index scan done. matched: " + matched.countMatched() + ", filtered: "
                            + matchCounts);
                }
                if(matchCounts > 0) {
                    final IDocumentTable doctbl;
                    try {
                        doctbl = DocumentTableLoader.load(col, docName, _dynEnv);
                    } catch (IOException e) {
                        throw new XQRTException("failed to load document '" + docName
                                + "' is the collection '" + col.getAbsolutePath() + '\'', e);
                    }
                    final PagingProfile profile = doctbl.getPagingProfile();
                    Strategy origStrategy = null;
                    if(profile != null) {
                        profile.setProfiler(profiler);
                        origStrategy = profile.getStrategy();
                        profile.setStrategy(Strategy.index);
                    }
                    DocumentTableModel dtm = new DocumentTableModel(doctbl, true);
                    final int last = matchCounts - 1;
                    for(int i = 0; i <= last; i++) {
                        long ptr = ptrs[i];
                        if(ptr != -1) {
                            XQNode node = dtm.createNode(ptr);
                            ffcous.setContextItem(node);
                            if(i != last) {
                                LongQueue ptrsQueue = new LongQueue(ptrs, i + 1, last);
                                ffcous.enqueue(dtm, ptrsQueue);
                            }
View Full Code Here

    @Deprecated
    private static Sequence emurateUnion(Sequence<XQNode> left, Sequence<XQNode> right, DynamicContext dynEnv) {
        final Iterator<XQNode> baseItor = new ChainedIterator<XQNode>(left.iterator(), right.iterator());
        final SortedSet<XQNode> merge = new TreeSet<XQNode>();
        while(baseItor.hasNext()) {
            XQNode n = baseItor.next();
            if(!merge.contains(n)) {
                merge.add(n);
            }
        }
        return merge.isEmpty() ? ValueSequence.emptySequence()
View Full Code Here

        }

        @Override
        public final XQNode following(final boolean firstcall) {
            final PagingProfile profile = _store.getPagingProfile();
            final XQNode node;
            if(profile != null) {
                Strategy origStrategy = profile.getStrategy();
                if(origStrategy != Strategy.nextsib) {
                    assert (origStrategy != null);
                    profile.setStrategy(Strategy.nextsib);
View Full Code Here

            DTMAttribute base = getAttribute(XMLConstants.XML_NS_URI, "base");
            if(base != null) {
                String uri = base.getContent();
                return uri;
            } else {
                XQNode p = parent();
                while(p != null) {
                    String uri = p.baseUri();
                    if(uri != null) {
                        return uri;
                    }
                    p = p.parent();
                }
                return null;
            }
        }
View Full Code Here

    public void export(XQNode rawNode, XQEventReceiver receiver) throws XQueryException {
        assert (rawNode instanceof DMNode);
        DMNode node = (DMNode) rawNode;
        if(node instanceof DMNodeProxy) {
            DMNodeProxy proxy = (DMNodeProxy) node;
            XQNode delegated = proxy.getDelegated();
            DataModel dm = delegated.getDataModel();
            dm.export(delegated, receiver);
            return;
        }
        switch(node.nodeKind()) {
            case NodeKind.DOCUMENT:
View Full Code Here

            return super.getDocumentId();
        }

        @Override
        public DMNode getDocumentNode() {
            XQNode doc = _delegate.getDocumentNode();
            return createProxy(doc);
        }
View Full Code Here

        @Override
        public DMNode parent() {
            DMNode dmParent = super.parent();
            if(dmParent == null) {
                XQNode p = _delegate.parent();
                if(p == null) {
                    return null;
                }
                dmParent = createProxy(p);
                setParent(dmParent);
View Full Code Here

TOP

Related Classes of xbird.xquery.dm.value.XQNode

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.