use of org.sirix.service.xml.xpath.XPathAxis in project sirix by sirixdb.
the class ConXPathAxisTest method testAncestor.
@Test
public void testAncestor() {
try {
// Find ancestor starting from nodeKey 8L.
holder.getReader().moveTo(11L);
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "ancestor::p:a"), new long[] { 1L });
holder.getReader().moveTo(13L);
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "ancestor::p:a"), new long[] { 1L });
holder.getReader().moveTo(11L);
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "ancestor::node()"), new long[] { 9L, 1L });
holder.getReader().moveTo(11L);
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "ancestor-or-self::node()"), new long[] { 11L, 9L, 1L });
} catch (final SirixXPathException mExp) {
mExp.getStackTrace();
}
}
use of org.sirix.service.xml.xpath.XPathAxis in project sirix by sirixdb.
the class ConXPathAxisTest method testMultiExpr.
@Test
public void testMultiExpr() {
try {
holder.getReader().moveTo(1L);
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "b, b, b"), new long[] { 5L, 9L, 5L, 9L, 5L, 9L });
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "b/c, ., //c"), new long[] { 7L, 11L, 1L, 7L, 11L });
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "b/text(), //text(), descendant-or-self::element()"), new long[] { 6L, 12L, 4L, 8L, 13L, 6L, 12L, 1L, 5L, 7L, 9L, 11L });
holder.getReader().moveTo(5L);
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "/p:a/b/c, ., .., .//text()"), new long[] { 7L, 11L, 5L, 1L, 6L });
} catch (final SirixXPathException mExp) {
mExp.getStackTrace();
}
}
use of org.sirix.service.xml.xpath.XPathAxis in project sirix by sirixdb.
the class ConXPathAxisTest method testPosition.
@Test
public void testPosition() {
try {
// Find descendants starting from nodeKey 0L (root).
holder.getReader().moveTo(1L);
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "b"), new long[] { 5L, 9L });
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "b/c"), new long[] { 7L, 11L });
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "b/text()"), new long[] { 6L, 12L });
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "/p:a/b/c"), new long[] { 7L, 11L });
} catch (final SirixXPathException mExp) {
mExp.getStackTrace();
}
}
use of org.sirix.service.xml.xpath.XPathAxis in project sirix by sirixdb.
the class ConXPathAxisTest method testSteps.
@Test
public void testSteps() {
try {
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "/text:p/b"), new long[] {});
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "/p:a/b"), new long[] { 5L, 9L });
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "/p:a/b/c"), new long[] { 7L, 11L });
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "/p:a"), new long[] { 1L });
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "child::p:a/child::b"), new long[] { 5L, 9L });
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "child::p:" + "a/child::b/child::c"), new long[] { 7L, 11L });
} catch (final SirixXPathException mExp) {
mExp.getStackTrace();
}
}
use of org.sirix.service.xml.xpath.XPathAxis in project sirix by sirixdb.
the class ConXPathAxisTest method testUnabbreviate.
@Test
public void testUnabbreviate() {
try {
// Find descendants starting from nodeKey 0L (root).
holder.getReader().moveTo(1L);
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "child::b"), new long[] { 5L, 9L });
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "child::*"), new long[] { 5L, 9L });
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "child::text()"), new long[] { 4L, 8L, 13L });
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "attribute::i"), new long[] { 3L });
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "attribute::*"), new long[] { 3L });
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "parent::node()"), new long[] { 0L });
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "self::blau"), new long[] {});
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "/"), new long[] { 0L });
// IAxisTest.testIAxisConventions(new XPathAxis(holder.getRtx(),
// "child::b[fn:position() = 1]"), new long[] { 4L });
//
// // IAxisTest.testIAxisConventions(new XPathAxis(
// holder.getRtx(), "child::b[fn:position() = fn:last()]"), new
// long[] {8L});
//
// IAxisTest.testIAxisConventions(new XPathAxis(
// holder.getRtx(), "child::b[fn:position() = fn:last()-1]"), new
// long[] {4L});
//
// IAxisTest.testIAxisConventions(new XPathAxis(holder.getRtx(),
// "child::b[fn:position() > 1]"), new long[] { 8L });
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "child::b[attribute::p:x = \"y\"]"), new long[] { 9L });
// IAxisTest.testIAxisConventions(new XPathAxis(holder.getRtx(),
// "child::b[attribute::p:x = \"y\"][fn:position() = 1]"),
// new long[] { 8L });
// IAxisTest.testIAxisConventions(new XPathAxis(holder.getRtx(),
// "child::b[attribute::p:x = \"y\"][1]"), new long[] { 8L });
// IAxisTest.testIAxisConventions(new XPathAxis(holder.getRtx(),
// "child::b[attribute::p:x = \"y\"][fn:position() = 3]"), new
// long[]
// {});
// IAxisTest.testIAxisConventions(new XPathAxis(holder.getRtx(),
// "child::b[attribute::p:x = \"y\"][3]"), new long[] {});
// IAxisTest.testIAxisConventions(new XPathAxis(holder.getRtx(),
// "child::b[fn:position() = 2][attribute::p:x = \"y\"]"),
// new long[] { 8L });
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "child::b[child::c]"), new long[] { 5L, 9L });
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "child::*[text() or c]"), new long[] { 5l, 9L });
// IAxisTest.testIAxisConventions(new XPathAxis(
// holder.getRtx(),
// "child::*[text() or c][fn:position() = fn:last()]"), new long[]
// {8L});
AbsAxisTest.testIAxisConventions(new XPathAxis(holder.getReader(), "child::*[text() or c], /node(), //c"), new long[] { 5l, 9L, 1L, 7L, 11L });
} catch (final SirixXPathException mExp) {
mExp.getStackTrace();
}
}
Aggregations