// Delete in batches.
// That way, there is no active iterator when a delete
// from the indexes happens.
NodeTupleTable t = g.getNodeTupleTable() ;
Node gn = g.getGraphNode() ;
@SuppressWarnings("unchecked")
Tuple<NodeId>[] array = (Tuple<NodeId>[])new Tuple<?>[sliceSize] ;
while (true)
{
// Convert/cache s,p,o?
// The Node Cache will catch these so don't worry unduely.
Iterator<Tuple<NodeId>> iter = null ;
if ( gn == null )
iter = t.findAsNodeIds(s, p, o) ;
else
iter = t.findAsNodeIds(gn, s, p, o) ;
if ( iter == null )
// Finished?
return ;
// Get a slice
int len = 0 ;
for ( ; len < sliceSize ; len++ )
{
if ( !iter.hasNext() ) break ;
array[len] = iter.next() ;
}
// Delete them.
for ( int i = 0 ; i < len ; i++ )
{
t.getTupleTable().delete(array[i]) ;
array[i] = null ;
}
// Finished?
if ( len < sliceSize )
break ;