public abstract class TabularRuntimeContext extends AbstractQueryRuntimeContext implements ITableContext
Usage: first, instantiate IIndexTable
tables with this as the 'tableContext' argument. Call
registerIndexTable(IIndexTable)
to register them; this may happen either during a coalesced indexing, or on
external initiation. Afterwards, they will be visible to the query backends.
EXPERIMENTAL. This class or interface has been added as part of a work in progress. There is no guarantee that this API will work or that it will remain the same.
Constructor and Description |
---|
TabularRuntimeContext() |
Modifier and Type | Method and Description |
---|---|
boolean |
containsTuple(IInputKey key,
ITuple seed)
Simpler form of
#enumerateTuples(IInputKey, TupleMask, Tuple) in the case where all values of the tuples
are bound by the seed. |
int |
countTuples(IInputKey key,
TupleMask seedMask,
ITuple seed)
Returns the number of tuples in the extensional relation identified by the input key seeded with the given mask and tuple.
|
java.lang.Iterable<Tuple> |
enumerateTuples(IInputKey key,
TupleMask seedMask,
ITuple seed)
Returns the tuples in the extensional relation identified by the input key, optionally seeded with the given tuple.
|
java.lang.Iterable<? extends java.lang.Object> |
enumerateValues(IInputKey key,
TupleMask seedMask,
ITuple seed)
Simpler form of
#enumerateTuples(IInputKey, TupleMask, Tuple) in the case where all values of the tuples
are bound by the seed except for one. |
IIndexTable |
getIndexTable(IInputKey key)
If the table is not registered,
handleUnregisteredTableRequest(IInputKey) is invoked; it may handle it
by raising an error or e.g. |
protected IIndexTable |
handleUnregisteredTableRequest(IInputKey key)
Override this to provide on-demand table registration
|
protected abstract boolean |
isContainedInStatelessKey(IInputKey key,
ITuple seed)
Handles non-enumerable input keys that are not backed by a table
|
IIndexTable |
peekIndexTable(IInputKey key) |
void |
registerIndexTable(IIndexTable table) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
logError
addUpdateListener, coalesceTraversals, ensureIndexed, ensureWildcardIndexing, executeAfterTraversal, getMetaContext, isCoalescing, isIndexed, removeUpdateListener, unwrapElement, unwrapTuple, wrapElement, wrapTuple
public void registerIndexTable(IIndexTable table)
public IIndexTable peekIndexTable(IInputKey key)
public IIndexTable getIndexTable(IInputKey key)
handleUnregisteredTableRequest(IInputKey)
is invoked; it may handle it
by raising an error or e.g. on-demand index constructionprotected IIndexTable handleUnregisteredTableRequest(IInputKey key)
public int countTuples(IInputKey key, TupleMask seedMask, ITuple seed)
IQueryRuntimeContext
countTuples
in interface IQueryRuntimeContext
key
- an input keyseedMask
- a mask that extracts those parameters of the input key (from the entire parameter list) that should be
bound to a fixed value; must not be null. Note: any given index must occur at most once in seedMask.seed
- the tuple of fixed values restricting the match set to be considered, in the same order as given in
parameterSeedMask, so that for each considered match tuple,
projectedParameterSeed.equals(parameterSeedMask.transform(match)) should hold. Must not be null.Precondition: the given key is enumerable, see IQueryMetaContext.isEnumerable(IInputKey)
.
public java.lang.Iterable<Tuple> enumerateTuples(IInputKey key, TupleMask seedMask, ITuple seed)
IQueryRuntimeContext
enumerateTuples
in interface IQueryRuntimeContext
key
- an input keyseedMask
- a mask that extracts those parameters of the input key (from the entire parameter list) that should be
bound to a fixed value; must not be null. Note: any given index must occur at most once in seedMask.seed
- the tuple of fixed values restricting the match set to be considered, in the same order as given in
parameterSeedMask, so that for each considered match tuple,
projectedParameterSeed.equals(parameterSeedMask.transform(match)) should hold. Must not be null.Precondition: the given key is enumerable, see IQueryMetaContext.isEnumerable(IInputKey)
.
public java.lang.Iterable<? extends java.lang.Object> enumerateValues(IInputKey key, TupleMask seedMask, ITuple seed)
IQueryRuntimeContext
#enumerateTuples(IInputKey, TupleMask, Tuple)
in the case where all values of the tuples
are bound by the seed except for one.
Selects the tuples in the extensional relation identified by the input key, optionally seeded with the given tuple, and then returns the single value from each tuple which is not bound by the ssed mask.
enumerateValues
in interface IQueryRuntimeContext
key
- an input keyseedMask
- a mask that extracts those parameters of the input key (from the entire parameter list) that should be
bound to a fixed value; must not be null. Note: any given index must occur at most
once in seedMask, and seedMask must include all parameters in any arbitrary order except one.seed
- the tuple of fixed values restricting the match set to be considered, in the same order as given in
parameterSeedMask, so that for each considered match tuple,
projectedParameterSeed.equals(parameterSeedMask.transform(match)) should hold. Must not be null.
Precondition: the given key is enumerable, see IQueryMetaContext.isEnumerable(IInputKey)
.
public boolean containsTuple(IInputKey key, ITuple seed)
IQueryRuntimeContext
#enumerateTuples(IInputKey, TupleMask, Tuple)
in the case where all values of the tuples
are bound by the seed.
Returns whether the given tuple is in the extensional relation identified by the input key.
Note: this call works for non-enumerable input keys as well.
containsTuple
in interface IQueryRuntimeContext
key
- an input keyseed
- the tuple of fixed values restricting the match set to be considered, in the same order as given in
parameterSeedMask, so that for each considered match tuple,
projectedParameterSeed.equals(parameterSeedMask.transform(match)) should hold. Must not be null.