Examples of toNodeSet()


Examples of org.exist.xquery.value.Sequence.toNodeSet()

    public void selectPrecedingSiblings() throws XPathException, SAXException, PermissionDeniedException {
        NameTest test = new NameTest(Type.ELEMENT, new QName("SPEAKER", ""));
        NodeSet speakers = broker.getStructuralIndex().findElementsByTagName(ElementValue.ELEMENT, docs, test.getName(), null);
        Sequence largeSet = executeQuery(broker, "//SPEECH/LINE[fn:contains(., 'love')]/ancestor::SPEECH/LINE[1]", 187, null);
       
        NodeSet result = ((AbstractNodeSet) speakers).selectPrecedingSiblings(largeSet.toNodeSet(), -1);
        assertEquals(187, result.getLength());
    }
   
    @Test
    public void extArrayNodeSet_selectParentChild_1() throws XPathException, SAXException, PermissionDeniedException {
View Full Code Here

Examples of org.exist.xquery.value.Sequence.toNodeSet()

    public void extArrayNodeSet_selectParentChild_1() throws XPathException, SAXException, PermissionDeniedException {
        Sequence nestedSet = executeQuery(broker, "//section[@n = ('1.1', '1.1.1')]", 2, null);
        NameTest test = new NameTest(Type.ELEMENT, new QName("para", ""));
        NodeSet children = broker.getStructuralIndex().findElementsByTagName(ElementValue.ELEMENT, docs, test.getName(), null);
       
        NodeSet result = children.selectParentChild(nestedSet.toNodeSet(), NodeSet.DESCENDANT);
        assertEquals(3, result.getLength());
    }
   
    @Test
    public void extArrayNodeSet_selectParentChild_2() throws XPathException, SAXException, PermissionDeniedException {
View Full Code Here

Examples of org.exist.xquery.value.Sequence.toNodeSet()

    public void extArrayNodeSet_selectParentChild_2() throws XPathException, SAXException, PermissionDeniedException {
        Sequence nestedSet = executeQuery(broker, "//section[@n = ('1.1', '1.1.2', '1.2')]", 3, null);
        NameTest test = new NameTest(Type.ELEMENT, new QName("para", ""));
        NodeSet children = broker.getStructuralIndex().findElementsByTagName(ElementValue.ELEMENT, docs, test.getName(), null);
       
        NodeSet result = children.selectParentChild(nestedSet.toNodeSet(), NodeSet.DESCENDANT);
        assertEquals(2, result.getLength());
    }
   
    @Test
    public void extArrayNodeSet_selectParentChild_3() throws XPathException, SAXException, PermissionDeniedException {
View Full Code Here

Examples of org.exist.xquery.value.Sequence.toNodeSet()

    public void extArrayNodeSet_selectParentChild_3() throws XPathException, SAXException, PermissionDeniedException {
        Sequence nestedSet = executeQuery(broker, "//section[@n = ('1.1', '1.1.1', '1.2')]", 3, null);
        NameTest test = new NameTest(Type.ELEMENT, new QName("para", ""));
        NodeSet children = broker.getStructuralIndex().findElementsByTagName(ElementValue.ELEMENT, docs, test.getName(), null);
       
        NodeSet result = children.selectParentChild(nestedSet.toNodeSet(), NodeSet.DESCENDANT);
        assertEquals(4, result.getLength());
    }
   
    @Test
    public void extArrayNodeSet_selectParentChild_4() throws XPathException, SAXException, PermissionDeniedException {
View Full Code Here

Examples of org.exist.xquery.value.Sequence.toNodeSet()

    try {
      broker = pool.get(user);
      final XQuery xquery = broker.getXQueryService();
      final Sequence nodes = xquery.execute(xpath, null, parent.getAccessContext());
      return broker.getTextEngine().scanIndexTerms(nodes.getDocumentSet(),
          nodes.toNodeSet(),  start, end);
    } catch (final EXistException e) {
      throw new XMLDBException(
          ErrorCodes.VENDOR_ERROR,
          "database access error",
          e);
View Full Code Here

Examples of org.exist.xquery.value.Sequence.toNodeSet()

        Sequence result = Sequence.EMPTY_SEQUENCE;
      final Sequence set = expression.eval(contextSequence);

        if (!set.isEmpty()) {
            if (set.isPersistentSet()) {
                final NodeSet nodeSet = set.toNodeSet();
                switch(axis) {
                    case Constants.DESCENDANT_SELF_AXIS:
                        result = nodeSet.selectAncestorDescendant(contextSequence.toNodeSet(), NodeSet.DESCENDANT,
                            true, contextId, true);
                        break;
View Full Code Here

Examples of org.exist.xquery.value.Sequence.toNodeSet()

            final Sequence ls = left.eval(contextSequence, null);
            doOptimize = doOptimize && (ls.isPersistentSet() || ls.isEmpty());
            if (doOptimize) {
             
              if (inPredicate) {
                    NodeSet lr = ls.toNodeSet();
                    lr = lr.getContextNodes(getContextId());

                    if (lr.isEmpty())
                        {return NodeSet.EMPTY_SET;}
View Full Code Here

Examples of org.exist.xquery.value.Sequence.toNodeSet()

                    if (lr.isEmpty())
                        {return NodeSet.EMPTY_SET;}

                    final Sequence rs = right.eval(lr, null);
                   
                    final NodeSet rr = rs.toNodeSet();
                    result = rr.getContextNodes(getContextId());

              } else {
                final Sequence rs = right.eval(contextSequence, null);
View Full Code Here

Examples of org.exist.xquery.value.Sequence.toNodeSet()

                        if (rl.isEmpty())
                            {return NodeSet.EMPTY_SET;}

                      // TODO: optimize and return false if rl.isEmpty() ?
                      NodeSet rr = rs.toNodeSet();
                      rr = rr.getContextNodes(right.getContextId());
                      result = rr.intersection(rl);
                      //<test>{() and ()}</test> has to return <test>false</test>         
                      if (getParent() instanceof EnclosedExpr ||
                          //First, the intermediate PathExpr
View Full Code Here

Examples of org.exist.xquery.value.Sequence.toNodeSet()

            // yes: try to optimize by looking at right operand
            final Sequence rs = right.eval(contextSequence, null);
            if (rs.isPersistentSet() || rs.isEmpty()) {
                NodeSet rl = ls.toNodeSet();
                rl = rl.getContextNodes(contextId);
                NodeSet rr = rs.toNodeSet();
                rr = rr.getContextNodes(contextId);
                result = rl.union(rr);
                //<test>{() or ()}</test> should return <test>false</test>     
                if (getParent() instanceof EnclosedExpr ||
                    //First, the intermediate PathExpr
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.