use of org.sirix.axis.NonStructuralWrapperAxis in project sirix by sirixdb.
the class IndexBuilder method build.
/**
* Build the index.
*
* @param rtx the current {@link XdmNodeReadTrx}
* @param builders the index builders
*/
public static void build(final XdmNodeReadTrx rtx, final Set<Visitor> builders) {
final long nodeKey = rtx.getNodeKey();
rtx.moveToDocumentRoot();
for (@SuppressWarnings("unused") final long key : new NonStructuralWrapperAxis(new DescendantAxis(rtx))) {
for (final Visitor builder : builders) {
rtx.acceptVisitor(builder);
}
}
rtx.moveTo(nodeKey);
}
use of org.sirix.axis.NonStructuralWrapperAxis in project sirix by sirixdb.
the class UpdateTest method testSecondMoveToFirstChild.
@Test
public void testSecondMoveToFirstChild() throws SirixException {
final XdmNodeWriteTrx wtx = holder.getResourceManager().beginNodeWriteTrx();
DocumentCreater.create(wtx);
wtx.moveTo(5);
wtx.moveSubtreeToFirstChild(4);
testSecondMoveToFirstChild(wtx);
wtx.commit();
testSecondMoveToFirstChild(wtx);
wtx.close();
final XdmNodeReadTrx rtx = holder.getResourceManager().beginNodeReadTrx();
testSecondMoveToFirstChild(rtx);
rtx.moveToDocumentRoot();
final Builder<SirixDeweyID> builder = ImmutableSet.<SirixDeweyID>builder();
final ImmutableSet<SirixDeweyID> ids = builder.add(new SirixDeweyID("1")).add(new SirixDeweyID("1.3")).add(new SirixDeweyID("1.3.0.3")).add(new SirixDeweyID("1.3.1.3")).add(new SirixDeweyID("1.3.5")).add(new SirixDeweyID("1.3.5.3")).add(new SirixDeweyID("1.3.5.5")).add(new SirixDeweyID("1.3.7")).add(new SirixDeweyID("1.3.9")).add(new SirixDeweyID("1.3.9.1.3")).add(new SirixDeweyID("1.3.9.3")).add(new SirixDeweyID("1.3.9.5")).add(new SirixDeweyID("1.3.11")).build();
test(ids.iterator(), new NonStructuralWrapperAxis(new DescendantAxis(rtx, IncludeSelf.YES)));
rtx.close();
}
use of org.sirix.axis.NonStructuralWrapperAxis in project sirix by sirixdb.
the class UpdateTest method testSecondMoveSubtreeToRightSibling.
@Test
public void testSecondMoveSubtreeToRightSibling() throws SirixException {
final XdmNodeWriteTrx wtx = holder.getResourceManager().beginNodeWriteTrx();
DocumentCreater.create(wtx);
wtx.moveTo(9);
wtx.moveSubtreeToRightSibling(5);
// wtx.moveTo(5);
// wtx.moveSubtreeToRightSibling(4);
testSecondMoveSubtreeToRightSibling(wtx);
wtx.commit();
testSecondMoveSubtreeToRightSibling(wtx);
wtx.close();
final XdmNodeReadTrx rtx = holder.getResourceManager().beginNodeReadTrx();
testSecondMoveSubtreeToRightSibling(rtx);
rtx.moveToDocumentRoot();
final Builder<SirixDeweyID> builder = ImmutableSet.<SirixDeweyID>builder();
builder.add(new SirixDeweyID("1")).add(new SirixDeweyID("1.3")).add(new SirixDeweyID("1.3.0.3")).add(new SirixDeweyID("1.3.1.3")).add(new SirixDeweyID("1.3.3")).add(new SirixDeweyID("1.3.5")).add(new SirixDeweyID("1.3.5.5")).add(new SirixDeweyID("1.3.5.7")).add(new SirixDeweyID("1.3.7")).add(new SirixDeweyID("1.3.9")).add(new SirixDeweyID("1.3.9.1.3")).add(new SirixDeweyID("1.3.9.3")).add(new SirixDeweyID("1.3.9.5")).add(new SirixDeweyID("1.3.11")).build();
// test(ids.iterator(), new NonStructuralWrapperAxis(new DescendantAxis(rtx,
// IncludeSelf.YES)));
rtx.moveToDocumentRoot();
for (final long nodeKey : new NonStructuralWrapperAxis(new DescendantAxis(rtx, IncludeSelf.YES))) {
System.out.println(nodeKey + ": " + rtx.getDeweyID());
}
rtx.close();
}
use of org.sirix.axis.NonStructuralWrapperAxis in project sirix by sirixdb.
the class UpdateTest method testThirdMoveToFirstChild.
@Test
public void testThirdMoveToFirstChild() throws SirixException {
final XdmNodeWriteTrx wtx = holder.getResourceManager().beginNodeWriteTrx();
DocumentCreater.create(wtx);
wtx.moveTo(5);
wtx.moveSubtreeToFirstChild(11);
testThirdMoveToFirstChild(wtx);
wtx.commit();
testThirdMoveToFirstChild(wtx);
wtx.close();
final XdmNodeReadTrx rtx = holder.getResourceManager().beginNodeReadTrx();
testThirdMoveToFirstChild(rtx);
rtx.moveToDocumentRoot();
final Builder<SirixDeweyID> builder = ImmutableSet.<SirixDeweyID>builder();
final ImmutableSet<SirixDeweyID> ids = builder.add(new SirixDeweyID("1")).add(new SirixDeweyID("1.3")).add(new SirixDeweyID("1.3.0.3")).add(new SirixDeweyID("1.3.1.3")).add(new SirixDeweyID("1.3.3")).add(new SirixDeweyID("1.3.5")).add(new SirixDeweyID("1.3.5.2.3")).add(new SirixDeweyID("1.3.5.3")).add(new SirixDeweyID("1.3.5.5")).add(new SirixDeweyID("1.3.7")).add(new SirixDeweyID("1.3.9")).add(new SirixDeweyID("1.3.9.1.3")).add(new SirixDeweyID("1.3.9.5")).add(new SirixDeweyID("1.3.11")).build();
test(ids.iterator(), new NonStructuralWrapperAxis(new DescendantAxis(rtx, IncludeSelf.YES)));
rtx.close();
}
use of org.sirix.axis.NonStructuralWrapperAxis in project sirix by sirixdb.
the class UpdateTest method testFirstMoveToFirstChild.
@Test
public void testFirstMoveToFirstChild() throws SirixException {
final XdmNodeWriteTrx wtx = holder.getResourceManager().beginNodeWriteTrx();
DocumentCreater.create(wtx);
wtx.moveTo(7);
wtx.moveSubtreeToFirstChild(6);
testFirstMoveToFirstChild(wtx);
wtx.commit();
testFirstMoveToFirstChild(wtx);
wtx.close();
final XdmNodeReadTrx rtx = holder.getResourceManager().beginNodeReadTrx();
testFirstMoveToFirstChild(rtx);
rtx.moveToDocumentRoot();
final Builder<SirixDeweyID> builder = ImmutableSet.<SirixDeweyID>builder();
final ImmutableSet<SirixDeweyID> ids = builder.add(new SirixDeweyID("1")).add(new SirixDeweyID("1.3")).add(new SirixDeweyID("1.3.0.3")).add(new SirixDeweyID("1.3.1.3")).add(new SirixDeweyID("1.3.3")).add(new SirixDeweyID("1.3.5")).add(new SirixDeweyID("1.3.5.5")).add(new SirixDeweyID("1.3.5.5.3")).add(new SirixDeweyID("1.3.7")).add(new SirixDeweyID("1.3.9")).add(new SirixDeweyID("1.3.9.1.3")).add(new SirixDeweyID("1.3.9.3")).add(new SirixDeweyID("1.3.9.5")).add(new SirixDeweyID("1.3.11")).build();
test(ids.iterator(), new NonStructuralWrapperAxis(new DescendantAxis(rtx, IncludeSelf.YES)));
rtx.close();
}
Aggregations