use of org.sirix.api.XdmNodeReadTrx in project sirix by sirixdb.
the class ElementFilterTest method testFluentIterable.
@Test
public void testFluentIterable() throws SirixException {
final XdmNodeReadTrx rtx = holder.getReader();
final Iterator<Long> results = FluentIterable.from(new DescendantAxis(rtx)).filter(new ElementFilter(rtx)).limit(2).iterator();
AbsAxisTest.testIterable(results, new long[] { 1, 5 });
}
use of org.sirix.api.XdmNodeReadTrx in project sirix by sirixdb.
the class NameFilterTest method testFilterConvetions.
@Test
public void testFilterConvetions() throws SirixException {
final XdmNodeReadTrx rtx = holder.getReader();
rtx.moveTo(9L);
FilterTest.testFilterConventions(new NameFilter(rtx, "b"), true);
rtx.moveTo(4L);
FilterTest.testFilterConventions(new NameFilter(rtx, "b"), false);
rtx.moveTo(7L);
FilterTest.testFilterConventions(new NameFilter(rtx, "b"), false);
}
use of org.sirix.api.XdmNodeReadTrx in project sirix by sirixdb.
the class LevelOrderAxisTest method testAxisConventions.
@Test
public void testAxisConventions() throws SirixException {
final XdmNodeReadTrx rtx = holder.getReader();
rtx.moveTo(11L);
AbsAxisTest.testIAxisConventions(new LevelOrderAxis.Builder(rtx).build(), new long[] { 12L });
rtx.moveTo(11L);
AbsAxisTest.testIAxisConventions(new LevelOrderAxis.Builder(rtx).includeSelf().build(), new long[] { 11L, 12L });
rtx.moveTo(0L);
AbsAxisTest.testIAxisConventions(new LevelOrderAxis.Builder(rtx).includeSelf().build(), new long[] { 0L, 1L, 4L, 5L, 8L, 9L, 13L, 6L, 7L, 11L, 12L });
rtx.moveTo(4L);
AbsAxisTest.testIAxisConventions(new LevelOrderAxis.Builder(rtx).includeSelf().build(), new long[] { 4L, 5L, 8L, 9L, 13L, 6L, 7L, 11L, 12L });
rtx.moveTo(4L);
AbsAxisTest.testIAxisConventions(new LevelOrderAxis.Builder(rtx).build(), new long[] { 5L, 8L, 9L, 13L, 6L, 7L, 11L, 12L });
rtx.moveTo(6L);
AbsAxisTest.testIAxisConventions(new LevelOrderAxis.Builder(rtx).build(), new long[] { 7L });
rtx.moveTo(6L);
AbsAxisTest.testIAxisConventions(new LevelOrderAxis.Builder(rtx).includeSelf().build(), new long[] { 6L, 7L });
rtx.moveTo(2L);
AbsAxisTest.testIAxisConventions(new LevelOrderAxis.Builder(rtx).includeSelf().build(), new long[] {});
rtx.moveTo(3L);
AbsAxisTest.testIAxisConventions(new LevelOrderAxis.Builder(rtx).includeSelf().build(), new long[] {});
rtx.moveTo(2L);
AbsAxisTest.testIAxisConventions(new LevelOrderAxis.Builder(rtx).build(), new long[] {});
rtx.moveTo(3L);
AbsAxisTest.testIAxisConventions(new LevelOrderAxis.Builder(rtx).build(), new long[] {});
rtx.moveTo(6L);
AbsAxisTest.testAxisConventionsNext(new LevelOrderAxis.Builder(rtx).includeSelf().build(), new long[] { 6L, 7L });
rtx.moveTo(0L);
AbsAxisTest.testAxisConventionsNext(new LevelOrderAxis.Builder(rtx).includeSelf().build(), new long[] { 0L, 1L, 4L, 5L, 8L, 9L, 13L, 6L, 7L, 11L, 12L });
rtx.moveTo(0L);
AbsAxisTest.testAxisConventionsNext(new LevelOrderAxis.Builder(rtx).includeSelf().includeNonStructuralNodes().build(), new long[] { 0L, 1L, 2L, 3L, 4L, 5L, 8L, 9L, 13L, 6L, 7L, 10L, 11L, 12L });
rtx.moveTo(0L);
AbsAxisTest.testIAxisConventions(new LevelOrderAxis.Builder(rtx).includeSelf().includeNonStructuralNodes().build(), new long[] { 0L, 1L, 2L, 3L, 4L, 5L, 8L, 9L, 13L, 6L, 7L, 10L, 11L, 12L });
}
use of org.sirix.api.XdmNodeReadTrx 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 });
}
use of org.sirix.api.XdmNodeReadTrx in project sirix by sirixdb.
the class NestedAxisTest method testNestedAxisTest2.
@Test
public void testNestedAxisTest2() throws SirixException {
final XdmNodeReadTrx rtx = holder.getReader();
// Find descendants starting from nodeKey 0L (root).
rtx.moveToDocumentRoot();
// XPath expression /[:a/b/@p:x]
// Part: /p:a
final Axis childA = new FilterAxis(new ChildAxis(rtx), new NameFilter(rtx, "p:a"));
// Part: /b
final Axis childB = new FilterAxis(new ChildAxis(rtx), new NameFilter(rtx, "b"));
// Part: /@x
final Axis attributeX = new FilterAxis(new AttributeAxis(rtx), new NameFilter(rtx, "p:x"));
// Part: /p:a/b/@p:x
final Axis axis = new NestedAxis(new NestedAxis(childA, childB), attributeX);
AbsAxisTest.testIAxisConventions(axis, new long[] { 10L });
}
Aggregations