|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.bigdata.rdf.inf.BackchainTypeResourceIterator
public class BackchainTypeResourceIterator
Provides backward chaining for (x rdf:type rdfs:Resource).
Note: You only need to do this on read from a high level query language since
the rest of the RDFS rules will run correctly without the (x rdf:type
rdfs:Resource) entailments being present. Further, you only need to do this
when the InferenceEngine was instructed to NOT store the (x rdf:type
rdfs:Resource) entailments.
Note: This iterator will NOT generate an inferred (x rdf:type rdfs:Resource) entailment iff there is an explicit statement (x rdf:type rdfs:Resource) in the database.
InferenceEngine,
InferenceEngine.Options| Nested Class Summary | |
|---|---|
static class |
BackchainTypeResourceIterator.PushbackFilter<E>
Filterator style construct that allows push back of a single visited element. |
static class |
BackchainTypeResourceIterator.PushbackIterator<E>
Implementation class for BackchainTypeResourceIterator.PushbackFilter. |
| Field Summary | |
|---|---|
protected static org.apache.log4j.Logger |
log
|
protected static long |
NULL
|
| Fields inherited from interface com.bigdata.striterator.IChunkedIterator |
|---|
DEFAULT_CHUNK_SIZE |
| Method Summary | |
|---|---|
void |
close()
Closes the iterator, releasing any associated resources. |
IKeyOrder<ISPO> |
getKeyOrder()
The natural order in which elements are being visited. |
boolean |
hasNext()
|
static IChunkedOrderedIterator<ISPO> |
newInstance(IChunkedOrderedIterator<ISPO> _src,
IAccessPath<ISPO> accessPath,
AbstractTripleStore db,
long rdfType,
long rdfsResource)
Returns a suitably configured BackchainTypeResourceIterator -or-
src iff the accessPath does not require the
materialization of (x rdf:type rdfs:Resource) entailments. |
ISPO |
next()
Visits all SPOs visited by the source iterator and then begins
to backchain ( x rdf:type: rdfs:Resource ) statements. |
ISPO[] |
nextChunk()
Note: This method preserves the IKeyOrder of the source iterator
iff it is reported by getKeyOrder(). |
ISPO[] |
nextChunk(IKeyOrder<ISPO> keyOrder)
Return the next "chunk" of elements. |
void |
remove()
Note: You can not "remove" the backchained entailments. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final org.apache.log4j.Logger log
protected static final transient long NULL
| Method Detail |
|---|
public static IChunkedOrderedIterator<ISPO> newInstance(IChunkedOrderedIterator<ISPO> _src,
IAccessPath<ISPO> accessPath,
AbstractTripleStore db,
long rdfType,
long rdfsResource)
BackchainTypeResourceIterator -or-
src iff the accessPath does not require the
materialization of (x rdf:type rdfs:Resource) entailments.
_src - The source iterator. nextChunk() will sort statements
into the IKeyOrder reported by this iterator (as long
as the IKeyOrder is non-null).accessPath - The IAccessPath from which the src iterator
was derived. Note that src is NOT necessarily
equivalent to IAccessPath.iterator() since it MAY have
been layered already to backchain other entailments, e.g.,
owl:sameAs.db - The database from which we will read the distinct subject
identifiers from its SPORelation. This parameter is
used iff this is an all unbound triple pattern.rdfType - The term identifier that corresponds to rdf:Type for the
database.rdfsResource - The term identifier that corresponds to rdf:Resource for the
database.
(x rdf:type rdfs:Resource) entailments.public IKeyOrder<ISPO> getKeyOrder()
IChunkedOrderedIterator
getKeyOrder in interface IChunkedOrderedIterator<ISPO>null if not known.public void close()
ICloseableIterator
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 ICloseableIterator<ISPO>public boolean hasNext()
hasNext in interface Iterator<ISPO>public ISPO next()
SPOs visited by the source iterator and then begins
to backchain ( x rdf:type: rdfs:Resource ) statements.
The "backchain" scans two iterators: an IChunkedOrderedIterator
on ( ? rdf:type
rdfs:Resource ) that reads on the database
(this tells us whether we have an explicit
(x rdf:type rdfs:Resource) in the database for a given
subject) and iterator that reads on the term identifiers for the distinct
resources in the database (this bounds the #of backchained statements
that we will emit).
For each value visited by the resourceIds iterator we examine
the statement iterator. If the next value that would be visited by the
statement iterator is an explicit statement for the current subject, then
we emit the explicit statement. Otherwise we emit an inferred statement.
next in interface IChunkedIterator<ISPO>next in interface Iterator<ISPO>public ISPO[] nextChunk()
IKeyOrder of the source iterator
iff it is reported by getKeyOrder(). Otherwise chunks read from
the source iterator will be in whatever order that iterator is using
while chunks containing backchained entailments will be in
SPOKeyOrder.POS order.
Note: In order to ensure that a consistent ordering is always used within a chunk the backchained entailments will always begin on a chunk boundary.
nextChunk in interface IChunkedIterator<ISPO>public ISPO[] nextChunk(IKeyOrder<ISPO> keyOrder)
IChunkedOrderedIteratorIChunkedOrderedIterator.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 remove()
next() is "explicit" then the request is
delegated to the source iterator.
remove in interface IChunkedIterator<ISPO>remove in interface Iterator<ISPO>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||