public class DistinctModelReducingUnionIteration extends LookAheadIteration<Statement,SailException>
An Iteration that takes two source. An iterator and a model.
For every statement returned by the iterator, that statement is removed from the model. Once the iterator is exhausted, a new filteredStatementsIterator is created by applying the filterable function to the model.
The point of this iteration is to create a distinct iterator that produces only distinct results in a lazy and mutable manner. This is useful when iterating in a transaction, since the user may have added duplicate statements. On a potential second iteration there will be no need for further deduplication, since the initial deduplication was mutable.
Model will throw a ConcurrentModificationException if two threads call .remove(...) at the same time or one thread calls .next() on an iterator while another calls .remove(...). This is resolved by synchronizing access to the model and by consuming the entire iterator into an ArrayList, effectively caching the filtered part of the model in memory. There is no overflow to disk for this cache.
|Modifier and Type||Method and Description|
Gets the next element.
hasNext, next, remove
protected Statement getNextElement() throws SailException
protected void handleClose() throws SailException
AbstractCloseableIteration.close()when it is called for the first time. This method is only called once on each iteration. By default, this method does nothing.
Copyright © 2015-2019 Eclipse Foundation. All Rights Reserved.