ChunkedArrayIterator
but this still has some very
purpose specific uses mainly dealing with
TruthMaintenance
and with fully buffering precisely
because the DB impl is not using concurrency controls.public class SPOArrayIterator extends Object implements IChunkedOrderedIterator<ISPO>
SPO
s and supports removal (fully buffered).DEFAULT_CHUNK_SIZE
Constructor and Description |
---|
SPOArrayIterator(AbstractTripleStore db,
IAccessPath<ISPO> accessPath,
int limit,
IElementFilter<ISPO> filter)
Deprecated.
Fully buffers all statements selected by the
IAccessPath . |
SPOArrayIterator(ISPO[] stmts,
int numStmts)
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
ISPO[] |
array()
Deprecated.
Return the backing array.
|
void |
close()
Deprecated.
Closes the iterator, releasing any associated resources.
|
IKeyOrder<ISPO> |
getKeyOrder()
Deprecated.
The natural order in which elements are being visited.
|
int |
getStatementCount()
Deprecated.
The #of statements that this iterator buffered.
|
boolean |
hasNext()
Deprecated.
|
ISPO |
next()
Deprecated.
The next element available from the iterator.
|
ISPO[] |
nextChunk()
Deprecated.
Returns the remaining statements.
|
ISPO[] |
nextChunk(IKeyOrder<ISPO> keyOrder)
Deprecated.
Return the next "chunk" of elements.
|
void |
remove()
Deprecated.
Removes the last statement visited from the database (non-batch API).
|
public SPOArrayIterator(ISPO[] stmts, int numStmts)
SPO
s in the given array whose
IKeyOrder
is NOT known.
Note: This constructor variant results in an iterator that does NOT
support remove()
and whose getKeyOrder()
method returns
null
.
stmts
- The statements.numStmts
- The #of entries in stmts that are valid.public SPOArrayIterator(AbstractTripleStore db, IAccessPath<ISPO> accessPath, int limit, IElementFilter<ISPO> filter)
IAccessPath
.
Note: This constructor variant supports remove()
.
Note: This constructor is much lighter weight than the
SPOIterator
when you are trying to do an existance test (limit of
1) or read only a few 100 SPO
s.
db
- The database (MAY be null, but then remove()
is not
supported).accessPath
- The access path (including the triple pattern).limit
- When non-zero, this is the maximum #of SPO
s that will
be read. When zero, all SPO
s for that access path
will be read and buffered.filter
- An optional filter. When non-null
, only
matching statements will be visited.public int getStatementCount()
public IKeyOrder<ISPO> getKeyOrder()
IChunkedOrderedIterator
getKeyOrder
in interface IChunkedOrderedIterator<ISPO>
null
if not known.public ISPO next()
IChunkedIterator
public void remove()
Note If you are trying to remove a set of statements then you are MUCH better off collecting up a set of SPOs to be removed and then batching the remove requests on all indices in parallel.
remove
in interface IChunkedIterator<ISPO>
remove
in interface Iterator<ISPO>
UnsupportedOperationException
- if a ctor variant was used that did not convey the database
reference.public ISPO[] array()
getStatementCount()
public ISPO[] nextChunk()
nextChunk
in interface IChunkedIterator<ISPO>
NoSuchElementException
- if hasNext()
returns false.public ISPO[] nextChunk(IKeyOrder<ISPO> keyOrder)
IChunkedOrderedIterator
IChunkedOrderedIterator.getKeyOrder()
would return non-null
and the request order corresponds to the value that would be returned by
IChunkedOrderedIterator.getKeyOrder()
then the elements in the next chunk are NOT
sorted. Otherwise the elements in the next chunk are sorted before they
are returned. The size of the chunk is up to the implementation.nextChunk
in interface IChunkedOrderedIterator<ISPO>
keyOrder
- The natural order for the elements in the chunk.public void close()
ICloseableIterator
ICloseableIterator.close()
if Iterator.hasNext()
method returns false
to ensure that the iterator is closed
(and its resources release) as soon as it is exhausted.
Note: Implementations that support Iterator.remove()
MUST NOT
eagerly close the iterator when it is exhausted since that would make it
impossible to remove the last visited statement. Instead they MUST wait
for an explicit ICloseableIterator.close()
by the application.
close
in interface ICloseable
close
in interface ICloseableIterator<ISPO>
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.