use of org.exist.xquery.NodeSelector in project exist by eXist-db.
the class MoveOverwriteCollectionTest method checkIndex.
private void checkIndex(final DBBroker broker, final DocumentSet docs) throws Exception {
final StructuralIndex index = broker.getStructuralIndex();
final NodeSelector selector = NodeProxy::new;
NodeSet nodes;
nodes = index.findElementsByTagName(ELEMENT, docs, new QName("test2"), selector);
assertTrue(nodes.isEmpty());
nodes = index.findElementsByTagName(ELEMENT, docs, new QName("test1"), selector);
assertTrue(nodes.isEmpty());
nodes = index.findElementsByTagName(ELEMENT, docs, new QName("test3"), selector);
assertFalse(nodes.isEmpty());
}
use of org.exist.xquery.NodeSelector in project exist by eXist-db.
the class BasicNodeSetTest method descendantOrSelfSelector.
@Test
public void descendantOrSelfSelector() throws XPathException, EXistException {
NodeSelector selector = new DescendantOrSelfSelector(seqSpeech.toNodeSet(), -1);
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());
}
}
use of org.exist.xquery.NodeSelector 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());
}
}
use of org.exist.xquery.NodeSelector in project exist by eXist-db.
the class BasicNodeSetTest method childSelector.
@Test
public void childSelector() throws XPathException, EXistException {
NodeSelector selector = new ChildSelector(seqSpeech.toNodeSet(), -1);
NameTest test = new NameTest(Type.ELEMENT, new QName("LINE", ""));
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(9492, set.getLength());
}
}
use of org.exist.xquery.NodeSelector 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());
}
}
Aggregations