Search in sources :

Example 26 with DescendantAxis

use of org.sirix.axis.DescendantAxis in project sirix by sirixdb.

the class PathSummaryTest method testSetQNmFourthHelper.

private void testSetQNmFourthHelper(final PathSummaryReader pSummary) throws SirixException {
    final Axis axis = new DescendantAxis(pSummary);
    PathSummaryReader summary = next(axis);
    assertTrue(summary != null);
    assertEquals(Kind.ELEMENT, summary.getPathKind());
    assertEquals(1L, summary.getNodeKey());
    assertEquals(7L, summary.getFirstChildKey());
    assertEquals(-1L, summary.getLeftSiblingKey());
    assertEquals(-1L, summary.getRightSiblingKey());
    assertEquals(new QNm("ns", "p", "a"), axis.getTrx().getName());
    assertEquals(1, summary.getLevel());
    assertEquals(4, summary.getChildCount());
    assertEquals(1, summary.getReferences());
    summary = next(axis);
    assertTrue(summary != null);
    assertEquals(Kind.ELEMENT, summary.getPathKind());
    assertEquals(7L, summary.getNodeKey());
    assertEquals(8L, summary.getFirstChildKey());
    assertEquals(-1L, summary.getLeftSiblingKey());
    assertEquals(4L, summary.getRightSiblingKey());
    assertEquals(new QNm("d"), axis.getTrx().getName());
    assertEquals(2, summary.getLevel());
    assertEquals(1, summary.getChildCount());
    assertEquals(1, summary.getReferences());
    summary = next(axis);
    assertTrue(summary != null);
    assertEquals(Kind.ELEMENT, summary.getPathKind());
    assertEquals(8L, summary.getNodeKey());
    assertEquals(-1L, summary.getFirstChildKey());
    assertEquals(-1L, summary.getLeftSiblingKey());
    assertEquals(-1L, summary.getRightSiblingKey());
    assertEquals(new QNm("c"), axis.getTrx().getName());
    assertEquals(3, summary.getLevel());
    assertEquals(0, summary.getChildCount());
    assertEquals(1, summary.getReferences());
    summary = next(axis);
    assertTrue(summary != null);
    assertEquals(Kind.ELEMENT, summary.getPathKind());
    assertEquals(4L, summary.getNodeKey());
    assertEquals(7L, summary.getLeftSiblingKey());
    assertEquals(3L, summary.getRightSiblingKey());
    assertEquals(6L, summary.getFirstChildKey());
    assertEquals(new QNm("b"), axis.getTrx().getName());
    assertEquals(2, summary.getLevel());
    assertEquals(2, summary.getChildCount());
    assertEquals(2, summary.getReferences());
    summary = next(axis);
    assertTrue(summary != null);
    assertEquals(Kind.ATTRIBUTE, summary.getPathKind());
    assertEquals(6L, summary.getNodeKey());
    assertEquals(-1L, summary.getLeftSiblingKey());
    assertEquals(5L, summary.getRightSiblingKey());
    assertEquals(-1L, summary.getFirstChildKey());
    assertEquals(new QNm("ns", "", "x"), axis.getTrx().getName());
    assertEquals(3, summary.getLevel());
    assertEquals(0, summary.getChildCount());
    assertEquals(1, summary.getReferences());
    summary = next(axis);
    assertTrue(summary != null);
    assertEquals(Kind.ELEMENT, summary.getPathKind());
    assertEquals(5L, summary.getNodeKey());
    assertEquals(6L, summary.getLeftSiblingKey());
    assertEquals(-1L, summary.getRightSiblingKey());
    assertEquals(-1L, summary.getFirstChildKey());
    assertEquals(new QNm("c"), axis.getTrx().getName());
    assertEquals(3, summary.getLevel());
    assertEquals(0, summary.getChildCount());
    assertEquals(1, summary.getReferences());
    summary = next(axis);
    assertTrue(summary != null);
    assertEquals(Kind.ATTRIBUTE, summary.getPathKind());
    assertEquals(3L, summary.getNodeKey());
    assertEquals(4L, summary.getLeftSiblingKey());
    assertEquals(2L, summary.getRightSiblingKey());
    assertEquals(-1L, summary.getFirstChildKey());
    assertEquals(new QNm("i"), axis.getTrx().getName());
    assertEquals(2, summary.getLevel());
    assertEquals(0, summary.getChildCount());
    assertEquals(1, summary.getReferences());
    summary = next(axis);
    assertTrue(summary != null);
    assertEquals(Kind.NAMESPACE, summary.getPathKind());
    assertEquals(2L, summary.getNodeKey());
    assertEquals(3L, summary.getLeftSiblingKey());
    assertEquals(-1L, summary.getRightSiblingKey());
    assertEquals(-1L, summary.getFirstChildKey());
    assertEquals(new QNm("ns", "p", ""), axis.getTrx().getName());
    assertEquals(2, summary.getLevel());
    assertEquals(0, summary.getChildCount());
    assertEquals(1, summary.getReferences());
    summary = next(axis);
    assertTrue(summary == null);
}
Also used : QNm(org.brackit.xquery.atomic.QNm) PathSummaryReader(org.sirix.index.path.summary.PathSummaryReader) DescendantAxis(org.sirix.axis.DescendantAxis) Axis(org.sirix.api.Axis) DescendantAxis(org.sirix.axis.DescendantAxis)

Example 27 with DescendantAxis

use of org.sirix.axis.DescendantAxis in project sirix by sirixdb.

the class PathSummaryTest method testSetQNmThirdHelper.

private void testSetQNmThirdHelper(final PathSummaryReader pSummary) throws SirixException {
    final Axis axis = new DescendantAxis(pSummary);
    PathSummaryReader summary = next(axis);
    assertTrue(summary != null);
    assertEquals(Kind.ELEMENT, summary.getPathKind());
    assertEquals(1L, summary.getNodeKey());
    assertEquals(7L, summary.getFirstChildKey());
    assertEquals(-1L, summary.getLeftSiblingKey());
    assertEquals(-1L, summary.getRightSiblingKey());
    assertEquals(new QNm("ns", "p", "a"), axis.getTrx().getName());
    assertEquals(1, summary.getLevel());
    assertEquals(4, summary.getChildCount());
    assertEquals(1, summary.getReferences());
    summary = next(axis);
    assertTrue(summary != null);
    assertEquals(Kind.ELEMENT, summary.getPathKind());
    assertEquals(7L, summary.getNodeKey());
    assertEquals(9L, summary.getFirstChildKey());
    assertEquals(-1L, summary.getLeftSiblingKey());
    assertEquals(4L, summary.getRightSiblingKey());
    assertEquals(new QNm("d"), axis.getTrx().getName());
    assertEquals(2, summary.getLevel());
    assertEquals(2, summary.getChildCount());
    assertEquals(1, summary.getReferences());
    summary = next(axis);
    assertTrue(summary != null);
    assertEquals(Kind.ELEMENT, summary.getPathKind());
    assertEquals(9L, summary.getNodeKey());
    assertEquals(-1L, summary.getFirstChildKey());
    assertEquals(-1L, summary.getLeftSiblingKey());
    assertEquals(8L, summary.getRightSiblingKey());
    assertEquals(new QNm("c"), axis.getTrx().getName());
    assertEquals(3, summary.getLevel());
    assertEquals(0, summary.getChildCount());
    assertEquals(1, summary.getReferences());
    summary = next(axis);
    assertTrue(summary != null);
    assertEquals(Kind.ATTRIBUTE, summary.getPathKind());
    assertEquals(8L, summary.getNodeKey());
    assertEquals(-1L, summary.getFirstChildKey());
    assertEquals(9L, summary.getLeftSiblingKey());
    assertEquals(-1L, summary.getRightSiblingKey());
    assertEquals(new QNm("ns", "", "x"), axis.getTrx().getName());
    assertEquals(3, summary.getLevel());
    assertEquals(0, summary.getChildCount());
    assertEquals(1, summary.getReferences());
    summary = next(axis);
    assertTrue(summary != null);
    assertEquals(Kind.ELEMENT, summary.getPathKind());
    assertEquals(4L, summary.getNodeKey());
    assertEquals(7L, summary.getLeftSiblingKey());
    assertEquals(3L, summary.getRightSiblingKey());
    assertEquals(5L, summary.getFirstChildKey());
    assertEquals(new QNm("t"), axis.getTrx().getName());
    assertEquals(2, summary.getLevel());
    assertEquals(1, summary.getChildCount());
    assertEquals(1, summary.getReferences());
    summary = next(axis);
    assertTrue(summary != null);
    assertEquals(Kind.ELEMENT, summary.getPathKind());
    assertEquals(5L, summary.getNodeKey());
    assertEquals(-1L, summary.getLeftSiblingKey());
    assertEquals(-1L, summary.getRightSiblingKey());
    assertEquals(-1L, summary.getFirstChildKey());
    assertEquals(new QNm("c"), axis.getTrx().getName());
    assertEquals(3, summary.getLevel());
    assertEquals(0, summary.getChildCount());
    assertEquals(1, summary.getReferences());
    summary = next(axis);
    assertTrue(summary != null);
    assertEquals(Kind.ATTRIBUTE, summary.getPathKind());
    assertEquals(3L, summary.getNodeKey());
    assertEquals(4L, summary.getLeftSiblingKey());
    assertEquals(2L, summary.getRightSiblingKey());
    assertEquals(-1L, summary.getFirstChildKey());
    assertEquals(new QNm("i"), axis.getTrx().getName());
    assertEquals(2, summary.getLevel());
    assertEquals(0, summary.getChildCount());
    assertEquals(1, summary.getReferences());
    summary = next(axis);
    assertTrue(summary != null);
    assertEquals(Kind.NAMESPACE, summary.getPathKind());
    assertEquals(2L, summary.getNodeKey());
    assertEquals(3L, summary.getLeftSiblingKey());
    assertEquals(-1L, summary.getRightSiblingKey());
    assertEquals(-1L, summary.getFirstChildKey());
    assertEquals(new QNm("ns", "p", ""), axis.getTrx().getName());
    assertEquals(2, summary.getLevel());
    assertEquals(0, summary.getChildCount());
    assertEquals(1, summary.getReferences());
    summary = next(axis);
    assertTrue(summary == null);
}
Also used : QNm(org.brackit.xquery.atomic.QNm) PathSummaryReader(org.sirix.index.path.summary.PathSummaryReader) DescendantAxis(org.sirix.axis.DescendantAxis) Axis(org.sirix.api.Axis) DescendantAxis(org.sirix.axis.DescendantAxis)

Example 28 with DescendantAxis

use of org.sirix.axis.DescendantAxis in project sirix by sirixdb.

the class PathSummaryTest method testDeleteHelper.

private void testDeleteHelper(final PathSummaryReader pSummary) throws SirixException {
    final Axis axis = new DescendantAxis(pSummary);
    PathSummaryReader summary = next(axis);
    assertTrue(summary != null);
    assertEquals(Kind.ELEMENT, summary.getPathKind());
    assertEquals(1L, summary.getNodeKey());
    assertEquals(4L, summary.getFirstChildKey());
    assertEquals(-1L, summary.getLeftSiblingKey());
    assertEquals(-1L, summary.getRightSiblingKey());
    assertEquals(new QNm("ns", "p", "a"), axis.getTrx().getName());
    assertEquals(1, summary.getLevel());
    assertEquals(3, summary.getChildCount());
    assertEquals(1, summary.getReferences());
    summary = next(axis);
    assertTrue(summary != null);
    assertEquals(Kind.ELEMENT, summary.getPathKind());
    assertEquals(4L, summary.getNodeKey());
    assertEquals(5L, summary.getFirstChildKey());
    assertEquals(-1L, summary.getLeftSiblingKey());
    assertEquals(3L, summary.getRightSiblingKey());
    assertEquals(new QNm("b"), axis.getTrx().getName());
    assertEquals(2, summary.getLevel());
    assertEquals(1, summary.getChildCount());
    assertEquals(1, summary.getReferences());
    summary = next(axis);
    assertTrue(summary != null);
    assertEquals(Kind.ELEMENT, summary.getPathKind());
    assertEquals(5L, summary.getNodeKey());
    assertEquals(-1L, summary.getFirstChildKey());
    assertEquals(-1L, summary.getLeftSiblingKey());
    assertEquals(-1L, summary.getRightSiblingKey());
    assertEquals(new QNm("c"), axis.getTrx().getName());
    assertEquals(3, summary.getLevel());
    assertEquals(0, summary.getChildCount());
    assertEquals(1, summary.getReferences());
    summary = next(axis);
    assertTrue(summary != null);
    assertEquals(Kind.ATTRIBUTE, summary.getPathKind());
    assertEquals(3L, summary.getNodeKey());
    assertEquals(4L, summary.getLeftSiblingKey());
    assertEquals(2L, summary.getRightSiblingKey());
    assertEquals(-1L, summary.getFirstChildKey());
    assertEquals(new QNm("i"), axis.getTrx().getName());
    assertEquals(2, summary.getLevel());
    assertEquals(0, summary.getChildCount());
    assertEquals(1, summary.getReferences());
    summary = next(axis);
    assertTrue(summary != null);
    assertEquals(Kind.NAMESPACE, summary.getPathKind());
    assertEquals(2L, summary.getNodeKey());
    assertEquals(3L, summary.getLeftSiblingKey());
    assertEquals(-1L, summary.getRightSiblingKey());
    assertEquals(-1L, summary.getFirstChildKey());
    assertEquals(new QNm("ns", "p", ""), axis.getTrx().getName());
    assertEquals(2, summary.getLevel());
    assertEquals(0, summary.getChildCount());
    summary = next(axis);
    assertTrue(summary == null);
}
Also used : QNm(org.brackit.xquery.atomic.QNm) PathSummaryReader(org.sirix.index.path.summary.PathSummaryReader) DescendantAxis(org.sirix.axis.DescendantAxis) Axis(org.sirix.api.Axis) DescendantAxis(org.sirix.axis.DescendantAxis)

Example 29 with DescendantAxis

use of org.sirix.axis.DescendantAxis in project sirix by sirixdb.

the class PathSummaryTest method testSetQNmSecondHelper.

private void testSetQNmSecondHelper(final PathSummaryReader pSummary) throws SirixException {
    final Axis axis = new DescendantAxis(pSummary);
    PathSummaryReader summary = next(axis);
    assertTrue(summary != null);
    assertEquals(Kind.ELEMENT, summary.getPathKind());
    assertEquals(1L, summary.getNodeKey());
    assertEquals(4L, summary.getFirstChildKey());
    assertEquals(-1L, summary.getLeftSiblingKey());
    assertEquals(-1L, summary.getRightSiblingKey());
    assertEquals(new QNm("ns", "p", "a"), axis.getTrx().getName());
    assertEquals(1, summary.getLevel());
    assertEquals(3, summary.getChildCount());
    assertEquals(1, summary.getReferences());
    summary = next(axis);
    assertTrue(summary != null);
    assertEquals(Kind.ELEMENT, summary.getPathKind());
    assertEquals(4L, summary.getNodeKey());
    assertEquals(10L, summary.getFirstChildKey());
    assertEquals(-1L, summary.getLeftSiblingKey());
    assertEquals(3L, summary.getRightSiblingKey());
    assertEquals(new QNm("b"), axis.getTrx().getName());
    assertEquals(2, summary.getLevel());
    assertEquals(2, summary.getChildCount());
    assertEquals(2, summary.getReferences());
    summary = next(axis);
    assertTrue(summary != null);
    assertEquals(Kind.ATTRIBUTE, summary.getPathKind());
    assertEquals(10L, summary.getNodeKey());
    assertEquals(-1L, summary.getFirstChildKey());
    assertEquals(-1L, summary.getLeftSiblingKey());
    assertEquals(5L, summary.getRightSiblingKey());
    assertEquals(new QNm("ns", "p", "x"), axis.getTrx().getName());
    assertEquals(3, summary.getLevel());
    assertEquals(0, summary.getChildCount());
    assertEquals(1, summary.getReferences());
    summary = next(axis);
    assertTrue(summary != null);
    assertEquals(Kind.ELEMENT, summary.getPathKind());
    assertEquals(5L, summary.getNodeKey());
    assertEquals(10L, summary.getLeftSiblingKey());
    assertEquals(-1L, summary.getRightSiblingKey());
    assertEquals(-1L, summary.getFirstChildKey());
    assertEquals(new QNm("c"), axis.getTrx().getName());
    assertEquals(3, summary.getLevel());
    assertEquals(0, summary.getChildCount());
    assertEquals(2, summary.getReferences());
    summary = next(axis);
    assertTrue(summary != null);
    assertEquals(Kind.ATTRIBUTE, summary.getPathKind());
    assertEquals(3L, summary.getNodeKey());
    assertEquals(4L, summary.getLeftSiblingKey());
    assertEquals(2L, summary.getRightSiblingKey());
    assertEquals(-1L, summary.getFirstChildKey());
    assertEquals(new QNm("i"), axis.getTrx().getName());
    assertEquals(2, summary.getLevel());
    assertEquals(0, summary.getChildCount());
    assertEquals(1, summary.getReferences());
    summary = next(axis);
    assertTrue(summary != null);
    assertEquals(Kind.NAMESPACE, summary.getPathKind());
    assertEquals(2L, summary.getNodeKey());
    assertEquals(3L, summary.getLeftSiblingKey());
    assertEquals(-1L, summary.getRightSiblingKey());
    assertEquals(-1L, summary.getFirstChildKey());
    assertEquals(new QNm("ns", "p", ""), axis.getTrx().getName());
    assertEquals(2, summary.getLevel());
    assertEquals(0, summary.getChildCount());
    assertEquals(1, summary.getReferences());
    summary = next(axis);
    assertTrue(summary == null);
}
Also used : QNm(org.brackit.xquery.atomic.QNm) PathSummaryReader(org.sirix.index.path.summary.PathSummaryReader) DescendantAxis(org.sirix.axis.DescendantAxis) Axis(org.sirix.api.Axis) DescendantAxis(org.sirix.axis.DescendantAxis)

Example 30 with DescendantAxis

use of org.sirix.axis.DescendantAxis in project sirix by sirixdb.

the class PathSummaryTest method testInsertHelper.

private void testInsertHelper(final PathSummaryReader pSummary) throws SirixException {
    final Axis axis = new DescendantAxis(pSummary);
    PathSummaryReader summary = next(axis);
    assertTrue(summary != null);
    assertEquals(Kind.ELEMENT, summary.getPathKind());
    assertEquals(1L, summary.getNodeKey());
    assertEquals(4L, summary.getFirstChildKey());
    assertEquals(-1L, summary.getLeftSiblingKey());
    assertEquals(-1L, summary.getRightSiblingKey());
    assertEquals(new QNm("ns", "p", "a"), axis.getTrx().getName());
    assertEquals(1, summary.getLevel());
    assertEquals(3, summary.getChildCount());
    summary = next(axis);
    assertTrue(summary != null);
    assertEquals(Kind.ELEMENT, summary.getPathKind());
    assertEquals(4L, summary.getNodeKey());
    assertEquals(6L, summary.getFirstChildKey());
    assertEquals(-1L, summary.getLeftSiblingKey());
    assertEquals(3L, summary.getRightSiblingKey());
    assertEquals(new QNm("b"), axis.getTrx().getName());
    assertEquals(2, summary.getLevel());
    assertEquals(2, summary.getChildCount());
    summary = next(axis);
    assertTrue(summary != null);
    assertEquals(Kind.ATTRIBUTE, summary.getPathKind());
    assertEquals(6L, summary.getNodeKey());
    assertEquals(-1L, summary.getFirstChildKey());
    assertEquals(-1L, summary.getLeftSiblingKey());
    assertEquals(5L, summary.getRightSiblingKey());
    assertEquals(new QNm("ns", "p", "x"), axis.getTrx().getName());
    assertEquals(3, summary.getLevel());
    assertEquals(0, summary.getChildCount());
    summary = next(axis);
    assertTrue(summary != null);
    assertEquals(Kind.ELEMENT, summary.getPathKind());
    assertEquals(5L, summary.getNodeKey());
    assertEquals(6L, summary.getLeftSiblingKey());
    assertEquals(-1L, summary.getRightSiblingKey());
    assertEquals(-1L, summary.getFirstChildKey());
    assertEquals(new QNm("c"), axis.getTrx().getName());
    assertEquals(3, summary.getLevel());
    assertEquals(0, summary.getChildCount());
    summary = next(axis);
    assertTrue(summary != null);
    assertEquals(Kind.ATTRIBUTE, summary.getPathKind());
    assertEquals(3L, summary.getNodeKey());
    assertEquals(4L, summary.getLeftSiblingKey());
    assertEquals(2L, summary.getRightSiblingKey());
    assertEquals(-1L, summary.getFirstChildKey());
    assertEquals(new QNm("i"), axis.getTrx().getName());
    assertEquals(2, summary.getLevel());
    assertEquals(0, summary.getChildCount());
    summary = next(axis);
    assertTrue(summary != null);
    assertEquals(Kind.NAMESPACE, summary.getPathKind());
    assertEquals(2L, summary.getNodeKey());
    assertEquals(3L, summary.getLeftSiblingKey());
    assertEquals(-1L, summary.getRightSiblingKey());
    assertEquals(-1L, summary.getFirstChildKey());
    assertEquals(new QNm("ns", "p", ""), axis.getTrx().getName());
    assertEquals(2, summary.getLevel());
    assertEquals(0, summary.getChildCount());
    summary = next(axis);
    assertTrue(summary == null);
}
Also used : QNm(org.brackit.xquery.atomic.QNm) PathSummaryReader(org.sirix.index.path.summary.PathSummaryReader) DescendantAxis(org.sirix.axis.DescendantAxis) Axis(org.sirix.api.Axis) DescendantAxis(org.sirix.axis.DescendantAxis)

Aggregations

DescendantAxis (org.sirix.axis.DescendantAxis)44 Axis (org.sirix.api.Axis)27 Test (org.junit.Test)18 XdmNodeReadTrx (org.sirix.api.XdmNodeReadTrx)17 FilterAxis (org.sirix.axis.filter.FilterAxis)16 ChildAxis (org.sirix.axis.ChildAxis)14 QNm (org.brackit.xquery.atomic.QNm)7 XdmNodeWriteTrx (org.sirix.api.XdmNodeWriteTrx)7 NonStructuralWrapperAxis (org.sirix.axis.NonStructuralWrapperAxis)7 NameFilter (org.sirix.axis.filter.NameFilter)7 NestedAxis (org.sirix.axis.NestedAxis)6 PostOrderAxis (org.sirix.axis.PostOrderAxis)6 PathSummaryReader (org.sirix.index.path.summary.PathSummaryReader)6 AbstractAxis (org.sirix.axis.AbstractAxis)5 AncestorAxis (org.sirix.axis.AncestorAxis)5 FollowingAxis (org.sirix.axis.FollowingAxis)5 FollowingSiblingAxis (org.sirix.axis.FollowingSiblingAxis)5 LevelOrderAxis (org.sirix.axis.LevelOrderAxis)5 ParentAxis (org.sirix.axis.ParentAxis)5 PrecedingAxis (org.sirix.axis.PrecedingAxis)5