com.bigdata.rdf.spo
Class SPOArrayIterator

java.lang.Object
  extended by com.bigdata.rdf.spo.SPOArrayIterator
All Implemented Interfaces:
IChunkedIterator<ISPO>, IChunkedOrderedIterator<ISPO>, ICloseableIterator<ISPO>, Iterator<ISPO>

Deprecated. by 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>

Iterator visits SPOs and supports removal (fully buffered).

Version:
$Id: SPOArrayIterator.java 3678 2010-09-29 15:48:34Z thompsonbry $
Author:
Bryan Thompson

Field Summary
 
Fields inherited from interface com.bigdata.striterator.IChunkedIterator
DEFAULT_CHUNK_SIZE
 
Constructor Summary
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. An iterator that visits the SPOs in the given array whose IKeyOrder is NOT known.
 
Method Summary
 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).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SPOArrayIterator

public SPOArrayIterator(ISPO[] stmts,
                        int numStmts)
Deprecated. 
An iterator that visits the SPOs 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.

Parameters:
stmts - The statements.
numStmts - The #of entries in stmts that are valid.

SPOArrayIterator

public SPOArrayIterator(AbstractTripleStore db,
                        IAccessPath<ISPO> accessPath,
                        int limit,
                        IElementFilter<ISPO> filter)
Deprecated. 
Fully buffers all statements selected by the 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 SPOs.

Parameters:
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 SPOs that will be read. When zero, all SPOs for that access path will be read and buffered.
filter - An optional filter. When non-null, only matching statements will be visited.
Method Detail

getStatementCount

public int getStatementCount()
Deprecated. 
The #of statements that this iterator buffered.


getKeyOrder

public IKeyOrder<ISPO> getKeyOrder()
Deprecated. 
Description copied from interface: IChunkedOrderedIterator
The natural order in which elements are being visited.

Specified by:
getKeyOrder in interface IChunkedOrderedIterator<ISPO>
Returns:
The natural order in which the elements are being visited -or- null if not known.

hasNext

public boolean hasNext()
Deprecated. 
Specified by:
hasNext in interface Iterator<ISPO>

next

public ISPO next()
Deprecated. 
Description copied from interface: IChunkedIterator
The next element available from the iterator.

Specified by:
next in interface IChunkedIterator<ISPO>
Specified by:
next in interface Iterator<ISPO>

remove

public void remove()
Deprecated. 
Removes the last statement visited from the database (non-batch API).

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.

Specified by:
remove in interface IChunkedIterator<ISPO>
Specified by:
remove in interface Iterator<ISPO>
Throws:
UnsupportedOperationException - if a ctor variant was used that did not convey the database reference.

array

public ISPO[] array()
Deprecated. 
Return the backing array.

See Also:
getStatementCount()

nextChunk

public ISPO[] nextChunk()
Deprecated. 
Returns the remaining statements.

Specified by:
nextChunk in interface IChunkedIterator<ISPO>
Returns:
The next chunk.
Throws:
NoSuchElementException - if hasNext() returns false.

nextChunk

public ISPO[] nextChunk(IKeyOrder<ISPO> keyOrder)
Deprecated. 
Description copied from interface: IChunkedOrderedIterator
Return the next "chunk" of elements. The elements will be in the specified order. If 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.

Specified by:
nextChunk in interface IChunkedOrderedIterator<ISPO>
Parameters:
keyOrder - The natural order for the elements in the chunk.
Returns:
The next chunk of elements in the specified order.

close

public void close()
Deprecated. 
Description copied from interface: ICloseableIterator
Closes the iterator, releasing any associated resources. This method MAY be invoked safely if the iterator is already closed. Implementations of this interface MUST invoke 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.

Specified by:
close in interface ICloseableIterator<ISPO>


Copyright © 2006-2012 SYSTAP, LLC. All Rights Reserved.