Examples of toNodeSet()


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

                else if (isCalledAs("contains"))
                    spatialOp = SpatialOperator.CONTAINS;
                else if (isCalledAs("overlaps"))
                    spatialOp = SpatialOperator.OVERLAPS;
                //Search the EPSG:4326 in the index
                result = indexWorker.search(context.getBroker(), nodes.toNodeSet(), EPSG4326_geometry, spatialOp);
                hasUsedIndex = true;
            } catch (SpatialIndexException e) {
                logger.error(e.getMessage(), e);
                throw new XPathException(e);
            }
View Full Code Here

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

            long start = System.currentTimeMillis();
            Sequence input = getArgument(0).eval(contextSequence);
            if (!(input instanceof VirtualNodeSet) && input.isEmpty())
                result = NodeSet.EMPTY_SET;
            else {
                NodeSet inNodes = input.toNodeSet();
                DocumentSet docs = inNodes.getDocumentSet();
                LuceneIndexWorker index = (LuceneIndexWorker)
                        context.getBroker().getIndexController().getWorkerByIndexId(LuceneIndex.ID);
                Item key = getKey(contextSequence, contextItem);
                List<QName> qnames = null;
View Full Code Here

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

    if (!(resultSeq.isEmpty() || Type.subTypeOf(resultSeq.getItemType(), Type.NODE)))
      {throw new EXistException("select expression should evaluate to a node-set; got " +
              Type.getTypeName(resultSeq.getItemType()));}
    if (LOG.isDebugEnabled())
      {LOG.debug("found " + resultSeq.getItemCount() + " for select: " + selectStmt);}
    return (NodeList)resultSeq.toNodeSet();
  }

  /**
   * @param context
   * @throws XPathException
View Full Code Here

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

    @Test
    public void descendantSelector() throws XPathException, SAXException, PermissionDeniedException {
        Sequence seq = executeQuery(broker, "//SCENE", 72, null);
        NameTest test = new NameTest(Type.ELEMENT, new QName("SPEAKER", ""));
        NodeSelector selector = new DescendantSelector(seq.toNodeSet(), -1);
        NodeSet set = broker.getStructuralIndex().findElementsByTagName(ElementValue.ELEMENT, seq.getDocumentSet(), test.getName(), selector);
       
        assertEquals(2639, set.getLength());
    }
 
View Full Code Here

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

       
        NameTest test = new NameTest(Type.ELEMENT, new QName("SPEAKER", ""));
        NodeSet speakers = broker.getStructuralIndex().findElementsByTagName(ElementValue.ELEMENT, docs, test.getName(), null);
        Sequence smallSet = executeQuery(broker, "//SPEECH/LINE[fn:contains(., 'perturbed spirit')]/ancestor::SPEECH", 1, null);
       
        NodeSet result = NodeSetHelper.selectParentChild(speakers, smallSet.toNodeSet(), NodeSet.DESCENDANT, -1);
        assertEquals(1, result.getLength());
        String value = serialize(broker, result.itemAt(0));
        assertEquals(value, "<SPEAKER>HAMLET</SPEAKER>");
    }
   
View Full Code Here

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

    public void selectParentChild_2() 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", 187, null);
       
        NodeSet result = NodeSetHelper.selectParentChild(speakers, largeSet.toNodeSet(), NodeSet.DESCENDANT, -1);
        assertEquals(187, result.getLength());
    }
   
    @Test
    public void selectAncestorDescendant() throws XPathException, SAXException, PermissionDeniedException{
View Full Code Here

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

    public void selectAncestorDescendant() 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 outerSet = executeQuery(broker, "//SCENE/TITLE[fn:contains(., 'closet')]/ancestor::SCENE", 1, null);
       
        NodeSet result = speakers.selectAncestorDescendant(outerSet.toNodeSet(), NodeSet.DESCENDANT, false, -1, true);
        assertEquals(56, result.getLength());
    }
   
    @Test
    public void selectAncestorDescendant_2() throws XPathException, SAXException, PermissionDeniedException{
View Full Code Here

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

   
    @Test
    public void selectAncestorDescendant_2() throws XPathException, SAXException, PermissionDeniedException{
        Sequence outerSet = executeQuery(broker, "//SCENE/TITLE[fn:contains(., 'closet')]/ancestor::SCENE", 1, null);
       
        NodeSet result = ((AbstractNodeSet)outerSet).selectAncestorDescendant(outerSet.toNodeSet(), NodeSet.DESCENDANT, true, -1, true);
        assertEquals(1, result.getLength());
    }
   
   
    @Test
View Full Code Here

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

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

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

    public void selectFollowingSiblings() throws XPathException, SAXException, PermissionDeniedException {
        Sequence largeSet = executeQuery(broker, "//SPEECH/LINE[fn:contains(., 'love')]/ancestor::SPEECH/SPEAKER", 187, null);
        NameTest test = new NameTest(Type.ELEMENT, new QName("LINE", ""));
        NodeSet lines = broker.getStructuralIndex().findElementsByTagName(ElementValue.ELEMENT, docs, test.getName(), null);
       
        NodeSet result = ((AbstractNodeSet) lines).selectFollowingSiblings(largeSet.toNodeSet(), -1);
        assertEquals(1689, result.getLength());
    }
   
    @Test
    public void selectPrecedingSiblings() throws XPathException, SAXException, PermissionDeniedException {
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.