use of org.sirix.axis.filter.NameFilter 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.axis.filter.NameFilter 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 });
}
use of org.sirix.axis.filter.NameFilter 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);
}
use of org.sirix.axis.filter.NameFilter in project sirix by sirixdb.
the class NestedAxisTest method testNestedAxisTest.
@Test
public void testNestedAxisTest() throws SirixException {
final XdmNodeReadTrx rtx = holder.getReader();
// Find descendants starting from nodeKey 0L (root).
rtx.moveToDocumentRoot();
// XPath expression /p:a/b/text()
// 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: /text()
final Axis text = new FilterAxis(new ChildAxis(rtx), new TextFilter(rtx));
// Part: /p:a/b/text()
final Axis axis = new NestedAxis(new NestedAxis(childA, childB), text);
AbsAxisTest.testIAxisConventions(axis, new long[] { 6L, 12L });
}
use of org.sirix.axis.filter.NameFilter in project sirix by sirixdb.
the class ConcurrentAxisTest method testSeriellNew.
/**
* Test seriell.
*/
// @Bench
@Test
public void testSeriellNew() throws Exception {
/* query: //regions/africa//location */
final int resultNumber = 55;
final Axis axis = new NestedAxis(new NestedAxis(new FilterAxis(new DescendantAxis(holder.getReader(), IncludeSelf.YES), new NameFilter(holder.getReader(), "regions")), new FilterAxis(new ChildAxis(holder.getReader()), new NameFilter(holder.getReader(), "africa"))), new FilterAxis(new DescendantAxis(holder.getReader(), IncludeSelf.YES), new NameFilter(holder.getReader(), "location")));
for (int i = 0; i < resultNumber; i++) {
assertEquals(true, axis.hasNext());
axis.next();
}
assertEquals(false, axis.hasNext());
}
Aggregations