com.bigdata.rdf.inf
Class BackchainOwlSameAsPropertiesIterator

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

public class BackchainOwlSameAsPropertiesIterator
extends Object
implements IChunkedOrderedIterator<ISPO>

Provides backward chaining for property collection and reverse property collection on owl:sameAs for all access paths.

Note:

Version:
$Id: BackchainOwlSameAsPropertiesIterator.java,v 1.2 2008/03/20 04:05:51 mrpersonick Exp $
Author:
Mike Personick
See Also:
BackchainOwlSameAsPropertiesSPOIterator, BackchainOwlSameAsPropertiesSPIterator, BackchainOwlSameAsPropertiesPOIterator, BackchainOwlSameAsPropertiesPIterator, InferenceEngine, InferenceEngine.Options

Field Summary
protected static long NULL
           
 
Fields inherited from interface com.bigdata.striterator.IChunkedIterator
DEFAULT_CHUNK_SIZE
 
Constructor Summary
BackchainOwlSameAsPropertiesIterator(IChunkedOrderedIterator<ISPO> src, long s, long p, long o, AbstractTripleStore db, long sameAs)
          Create an iterator that will visit all statements in the source iterator and also backchain any entailments that would have resulted from owl:sameAs {2,3}.
 
Method Summary
 void close()
          Closes the iterator, releasing any associated resources.
protected  void finalize()
           
 IKeyOrder<ISPO> getKeyOrder()
          The natural order in which elements are being visited.
 boolean hasNext()
           
 ISPO next()
          The next element available from the iterator.
 ISPO[] nextChunk()
          Return the next "chunk" from the iterator.
 ISPO[] nextChunk(IKeyOrder<ISPO> keyOrder)
          Return the next "chunk" of elements.
 void remove()
          Removes the last element visited by IChunkedIterator.next() (optional operation).
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NULL

protected static final transient long NULL
See Also:
Constant Field Values
Constructor Detail

BackchainOwlSameAsPropertiesIterator

public BackchainOwlSameAsPropertiesIterator(IChunkedOrderedIterator<ISPO> src,
                                            long s,
                                            long p,
                                            long o,
                                            AbstractTripleStore db,
                                            long sameAs)
Create an iterator that will visit all statements in the source iterator and also backchain any entailments that would have resulted from owl:sameAs {2,3}.

Parameters:
src - The source iterator. nextChunk() will sort statements into the IKeyOrder reported by this iterator (as long as the IKeyOrder is non-null).
s - The subject of the triple pattern.
p - The predicate of the triple pattern.
o - The object of the triple pattern.
db - The database from which we will read the distinct subject identifiers (iff this is an all unbound triple pattern).
sameAs - The term identifier that corresponds to owl:sameAs for the database.
Method Detail

finalize

protected void finalize()
                 throws Throwable
Overrides:
finalize in class Object
Throws:
Throwable

getKeyOrder

public IKeyOrder<ISPO> getKeyOrder()
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()
Specified by:
hasNext in interface Iterator<ISPO>

next

public ISPO next()
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>

nextChunk

public ISPO[] nextChunk()
Description copied from interface: IChunkedIterator
Return the next "chunk" from the iterator.

Specified by:
nextChunk in interface IChunkedIterator<ISPO>
Returns:
The next chunk.

nextChunk

public ISPO[] nextChunk(IKeyOrder<ISPO> keyOrder)
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()
Description copied from interface: ICloseableIterator
Closes the iterator, releasing any associated resources. This method MAY be invoked safely if the iterator is already closed.

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>

remove

public void remove()
Description copied from interface: IChunkedIterator
Removes the last element visited by IChunkedIterator.next() (optional operation).

Note: This method is not readily suited for use with IChunkedIterator.nextChunk() since the latter has already visited everything in the chunk and IChunkedIterator.remove() would only remove the last item in the chunk. Normally you will want to accumulate items to be removed in a buffer and then submit the buffer to some batch api operation when it overflows. Alternatively, the IRangeQuery.REMOVEALL flag may be used with the source iterator to remove elements from the index as they are visited.

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


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