Search in sources :

Example 1 with NodeFilter

use of org.sirix.axis.filter.NodeFilter in project sirix by sirixdb.

the class NestedAxisTest method testNestedAxisTest3.

@Test
public void testNestedAxisTest3() throws SirixException {
    final XdmNodeReadTrx rtx = holder.getReader();
    // Find desceFndants starting from nodeKey 0L (root).
    rtx.moveToDocumentRoot();
    // XPath expression p:a/node():
    // Part: /p:a
    final Axis childA = new FilterAxis(new ChildAxis(rtx), new NameFilter(rtx, "p:a"));
    // Part: /node()
    final Axis childNode = new FilterAxis(new ChildAxis(rtx), new NodeFilter(rtx));
    // Part: /p:a/node():
    final Axis axis = new NestedAxis(childA, childNode);
    AbsAxisTest.testIAxisConventions(axis, new long[] { 4L, 5L, 8L, 9L, 13L });
}
Also used : NameFilter(org.sirix.axis.filter.NameFilter) XdmNodeReadTrx(org.sirix.api.XdmNodeReadTrx) FilterAxis(org.sirix.axis.filter.FilterAxis) Axis(org.sirix.api.Axis) FilterAxis(org.sirix.axis.filter.FilterAxis) NodeFilter(org.sirix.axis.filter.NodeFilter) Test(org.junit.Test)

Example 2 with NodeFilter

use of org.sirix.axis.filter.NodeFilter in project sirix by sirixdb.

the class NestedFilterTest method testFilterConvetions.

@Test
public void testFilterConvetions() throws SirixException {
    holder.getReader().moveTo(9L);
    FilterTest.testFilterConventions(new NestedFilter(holder.getReader(), new ItemFilter(holder.getReader()), new ElementFilter(holder.getReader()), new NameFilter(holder.getReader(), "b")), true);
    FilterTest.testFilterConventions(new NestedFilter(holder.getReader(), new ItemFilter(holder.getReader()), new AttributeFilter(holder.getReader()), new NameFilter(holder.getReader(), "b")), false);
    holder.getReader().moveTo(4L);
    FilterTest.testFilterConventions(new NestedFilter(holder.getReader(), new NodeFilter(holder.getReader()), new ElementFilter(holder.getReader())), false);
    FilterTest.testFilterConventions(new NestedFilter(holder.getReader(), new NodeFilter(holder.getReader()), new TextFilter(holder.getReader())), true);
    holder.getReader().moveTo(1L);
    holder.getReader().moveToAttribute(0);
    FilterTest.testFilterConventions(new NestedFilter(holder.getReader(), new AttributeFilter(holder.getReader()), new NameFilter(holder.getReader(), "i")), true);
}
Also used : NestedFilter(org.sirix.axis.filter.NestedFilter) NameFilter(org.sirix.axis.filter.NameFilter) TextFilter(org.sirix.axis.filter.TextFilter) ItemFilter(org.sirix.axis.filter.ItemFilter) ElementFilter(org.sirix.axis.filter.ElementFilter) AttributeFilter(org.sirix.axis.filter.AttributeFilter) NodeFilter(org.sirix.axis.filter.NodeFilter) FilterTest(org.sirix.axis.filter.FilterTest) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 NameFilter (org.sirix.axis.filter.NameFilter)2 NodeFilter (org.sirix.axis.filter.NodeFilter)2 Axis (org.sirix.api.Axis)1 XdmNodeReadTrx (org.sirix.api.XdmNodeReadTrx)1 AttributeFilter (org.sirix.axis.filter.AttributeFilter)1 ElementFilter (org.sirix.axis.filter.ElementFilter)1 FilterAxis (org.sirix.axis.filter.FilterAxis)1 FilterTest (org.sirix.axis.filter.FilterTest)1 ItemFilter (org.sirix.axis.filter.ItemFilter)1 NestedFilter (org.sirix.axis.filter.NestedFilter)1 TextFilter (org.sirix.axis.filter.TextFilter)1