Search in sources :

Example 1 with AncestorSelector

use of org.exist.xquery.AncestorSelector in project exist by eXist-db.

the class BasicNodeSetTest method ancestorSelector_self.

@Test
public void ancestorSelector_self() throws XPathException, EXistException {
    NodeSet ns = seqSpeech.toNodeSet();
    NodeSelector selector = new AncestorSelector(ns, -1, true, true);
    NameTest test = new NameTest(Type.ELEMENT, new QName("SPEECH", ""));
    try (final DBBroker broker = existEmbeddedServer.getBrokerPool().get(Optional.of(existEmbeddedServer.getBrokerPool().getSecurityManager().getSystemSubject()))) {
        NodeSet set = broker.getStructuralIndex().findElementsByTagName(ElementValue.ELEMENT, seqSpeech.getDocumentSet(), test.getName(), selector);
        assertEquals(2628, set.getLength());
    }
}
Also used : NameTest(org.exist.xquery.NameTest) DBBroker(org.exist.storage.DBBroker) AncestorSelector(org.exist.xquery.AncestorSelector) QName(org.exist.dom.QName) NodeSelector(org.exist.xquery.NodeSelector) Test(org.junit.Test) NameTest(org.exist.xquery.NameTest)

Example 2 with AncestorSelector

use of org.exist.xquery.AncestorSelector in project exist by eXist-db.

the class BasicNodeSetTest method ancestorSelector.

@Test
public void ancestorSelector() throws XPathException, EXistException {
    NodeSelector selector = new AncestorSelector(seqSpeech.toNodeSet(), -1, false, true);
    NameTest test = new NameTest(Type.ELEMENT, new QName("ACT", ""));
    try (final DBBroker broker = existEmbeddedServer.getBrokerPool().get(Optional.of(existEmbeddedServer.getBrokerPool().getSecurityManager().getSystemSubject()))) {
        NodeSet set = broker.getStructuralIndex().findElementsByTagName(ElementValue.ELEMENT, seqSpeech.getDocumentSet(), test.getName(), selector);
        assertEquals(15, set.getLength());
    }
}
Also used : NameTest(org.exist.xquery.NameTest) DBBroker(org.exist.storage.DBBroker) AncestorSelector(org.exist.xquery.AncestorSelector) QName(org.exist.dom.QName) NodeSelector(org.exist.xquery.NodeSelector) Test(org.junit.Test) NameTest(org.exist.xquery.NameTest)

Aggregations

QName (org.exist.dom.QName)2 DBBroker (org.exist.storage.DBBroker)2 AncestorSelector (org.exist.xquery.AncestorSelector)2 NameTest (org.exist.xquery.NameTest)2 NodeSelector (org.exist.xquery.NodeSelector)2 Test (org.junit.Test)2