public class BackchainAccessPath extends Object implements IAccessPath<ISPO>
IAccessPath that backchains certain inferences.
Note: Low level methods may not behave quite as expected since some elements
will be generated by the backchainer and hence present in the underlying
SPORelation. See the notes on the various methods in the API for
more details.
| Modifier and Type | Field and Description |
|---|---|
protected static boolean |
DEBUG |
protected static boolean |
INFO |
protected static org.apache.log4j.Logger |
log |
| Constructor and Description |
|---|
BackchainAccessPath(AbstractTripleStore database,
IAccessPath<ISPO> accessPath) |
BackchainAccessPath(AbstractTripleStore database,
IAccessPath<ISPO> accessPath,
Boolean isOwlSameAsUsed) |
| Modifier and Type | Method and Description |
|---|---|
IIndex |
getIndex()
The index selected for the access path.
|
IKeyOrder<ISPO> |
getKeyOrder()
The order in which the elements will be visited.
|
IPredicate<ISPO> |
getPredicate()
The constraints on the
IAccessPath. |
IAccessPath<ISPO> |
getSource()
The source
IAccessPath. |
boolean |
isEmpty()
True iff the access path is empty (there are no matches for the
IPredicate) This is more conclusive than #rangeCount()
since you MAY have a non-zero range count when the key range is in fact
empty (there may be "deleted" index entries within the key range). |
IChunkedOrderedIterator<ISPO> |
iterator()
An iterator visiting elements using the natural order of the index
selected for the
IPredicate. |
IChunkedOrderedIterator<ISPO> |
iterator(long offset,
long limit,
int capacity)
An iterator visiting elements using the natural order of the index
selected for the
IPredicate. |
long |
rangeCount(boolean exact)
Return the maximum #of elements spanned by the
IPredicate. |
long |
removeAll()
Remove all elements selected by the
IPredicate (optional
operation). |
String |
toString() |
protected static final transient org.apache.log4j.Logger log
protected static final boolean INFO
protected static final boolean DEBUG
public BackchainAccessPath(AbstractTripleStore database, IAccessPath<ISPO> accessPath)
database - The database whose entailments will be backchained.accessPath - The source IAccessPath.public BackchainAccessPath(AbstractTripleStore database, IAccessPath<ISPO> accessPath, Boolean isOwlSameAsUsed)
database - The database whose entailments will be backchained.accessPath - The source IAccessPath.isOwlSameAsUsed - When non-null, this Boolean indicates
whether the statement pattern (x owl:sameAs y)
is known to be empty in the data. Specify null
if you do not know this up front. This parameter is used to
factor out the test for this statement pattern, but that test
is only performed if Axioms.isOwlSameAs() is
true.public final IAccessPath<ISPO> getSource()
IAccessPath.public final IIndex getIndex()
IAccessPath
Note: The access path may incorporate additional constraints from the
specified IPredicate that are not present on the IIndex
returned by this method.
getIndex in interface IAccessPath<ISPO>public final IKeyOrder<ISPO> getKeyOrder()
IAccessPathgetKeyOrder in interface IAccessPath<ISPO>public final IPredicate<ISPO> getPredicate()
IAbstractAccessPathIAccessPath.getPredicate in interface IAbstractAccessPath<ISPO>public boolean isEmpty()
IAbstractAccessPathIPredicate) This is more conclusive than #rangeCount()
since you MAY have a non-zero range count when the key range is in fact
empty (there may be "deleted" index entries within the key range).isEmpty in interface IAbstractAccessPath<ISPO>public IChunkedOrderedIterator<ISPO> iterator()
IPredicate. This is equivalent to
iterator(0L, 0L, 0)since an offset of ZERO (0L) means no offset, a limit of ZERO (0L) means no limit and a capacity of ZERO (0) means whatever is the default capacity.
Note: Filters should be specified when the IAccessPath is
constructed so that they will be evaluated on the IDataService
rather than materializing the elements and then filtering then. This can
be accomplished by adding the filter as an IElementFilter on the
IPredicate when requesting IAccessPath.
Visits elements in the source IAccessPath plus all entailments
licensed by the InferenceEngine.
iterator in interface IAccessPath<ISPO>IRelation.getAccessPath(IPredicate)public IChunkedOrderedIterator<ISPO> iterator(long offset, long limit, int capacity)
IPredicate.
The offset and limit together describe an optional
slice that will be visited by the iterator. When a slice is
specified, the iterator will count off the elements accepted by the
IPredicate up to the offset, but not materialize them.
Elements by the IPredicate starting with the offset and up
to (but not including) offset+limit will be materialized for the
client. The iterator will halt processing after observing
offset+limit accepted elements. Note that slices for JOINs (vs a
simple IAccessPath scan) are handled by IQueryOptions for
an IRule.
The meaning of "accepted" is that: (a) the elements lie in the key-range
constraint implied by the IPredicate; and (b) the elements pass
any optional constraints that the IPredicate imposes.
iterator in interface IAccessPath<ISPO>offset - The first element accepted by the iterator that it will visit
(materialize for the client). The offset must be non-negative.
This is ZERO (0L) to visit all accepted elements.limit - The last element accepted by the iterator that it will visit
(materialize for the client). The limit must be non-negative.
This is ZERO (0L) to visit all accepted elements (the value
Long.MAX_VALUE is interpreted exactly like ZERO(0L)).capacity - The maximum capacity for the buffer used by the iterator. When
ZERO(0), a default capacity will be used. When a limit
is specified, the capacity will never exceed the limit.IAccessPath. This way they
will be correctly applied when IAbstractAccessPath.isEmpty() is implemented
using the IAccessPath.iterator() to determine if any elements can be
visited.public long rangeCount(boolean exact)
IPredicate.
Note: When there is an IFilter on the IPredicate the
exact range count MUST apply that IFilter, which means that it
will be required to traverse the index counting tuples which pass the
IFilter. However, IFilters are ignored for the fast
range count.
When exact == false this does not count the backchained
entailments. When exact == true traverses the
iterator() so as to produce an exact count of the #of elements
that would in fact be visited, which combines those from the database
with those generated dynamically (NOT efficient).
rangeCount in interface IAbstractAccessPath<ISPO>exact - When true, the result will be an exact count and
may require a key-range scan. When false, the
result will be an upper bound IFF delete markers are
provisioned for the backing index (delete markers are required
for transactions and for scale-out indices).IRangeQuerypublic long removeAll()
IAbstractAccessPathIPredicate (optional
operation).removeAll in interface IAbstractAccessPath<ISPO>Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.