- All Implemented Interfaces:
StoreStrategy
StoreStrategy that maintains a complete subject/predicate/object
index over the triple set at all times.
Three node-keyed index maps (NodesToIndices) hold, for every
subject/predicate/object node, an IndexList of the triple indices
that mention it. Three parallel reverse-index arrays
(sReverseIndices, pReverseIndices, oReverseIndices)
store, for every triple slot, its position inside the corresponding
IndexList; this is what makes O(1) removal possible.
A triple's reverse-index slot is only meaningful for the (s,p,o) component the triple actually has; readers must always validate via the indicesLarger[posLarger] == tripleIndex cross-check.
The reverse-index arrays are kept the same length as the underlying
keys array of the TripleSet; whenever the triple set grows
its keys array, the growReverseIndices hook is invoked to grow the
reverse arrays too.
-
Constructor Summary
ConstructorsConstructorDescriptionEagerStoreStrategy(TripleSet triples) Build a new eager strategy and index the triple set sequentially.EagerStoreStrategy(TripleSet triples, boolean parallel) Build a new eager strategy over the given triple set, indexing every triple already present.EagerStoreStrategy(TripleSet triples, EagerStoreStrategy strategyToCopyIndicesFrom) Copy constructor that reuses an already-built index. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddToIndex(Triple triple, int index) Notify the strategy that a triple was added to the underlying triple set at the given index.voidDiscard any auxiliary index data held by the strategy.booleanbooleanbooleancontainsAnyPreObj(Node p, Node o) booleanbooleancontainsSubAnyObj(Node s, Node o) booleancontainsSubPreAny(Node s, Node p) findAnyPreObj(Node p, Node o) findSubAnyObj(Node s, Node o) findSubPreAny(Node s, Node p) booleanCheck if the index has been initialized and all triples are indexed.voidremoveFromIndex(Triple triple, int index) Notify the strategy that the triple at the given index has been removed from the underlying triple set.streamAnyPreObj(Node p, Node o) streamSubAnyObj(Node s, Node o) streamSubPreAny(Node s, Node p)
-
Constructor Details
-
EagerStoreStrategy
Build a new eager strategy over the given triple set, indexing every triple already present.- Parameters:
triples- the canonical triple setparallel- iftrue, build the three indices concurrently; otherwise build them sequentially
-
EagerStoreStrategy
Build a new eager strategy and index the triple set sequentially. Equivalent toEagerStoreStrategy(triples, false).- Parameters:
triples- the canonical triple set
-
EagerStoreStrategy
Copy constructor that reuses an already-built index. Used when copying anIndexedSetTripleStorewhose source already has its eager index built, so that the copy can avoid the cost of rebuilding it.The
triplesparameter must be a copy of the original triple set (the indices reference triple slots by index, so the two sets must have identical layouts).- Parameters:
triples- the (already-copied) triple set the new strategy will operate onstrategyToCopyIndicesFrom- the strategy whose indices should be cloned
-
-
Method Details
-
isIndexInitialized
public boolean isIndexInitialized()Description copied from interface:StoreStrategyCheck if the index has been initialized and all triples are indexed.- Specified by:
isIndexInitializedin interfaceStoreStrategy- Returns:
- true if the index is initialized, false otherwise
-
addToIndex
Description copied from interface:StoreStrategyNotify the strategy that a triple was added to the underlying triple set at the given index. Implementations that maintain an index must update it; implementations without an index are free to no-op.- Specified by:
addToIndexin interfaceStoreStrategy- Parameters:
triple- the newly added tripleindex- the stable index it now occupies in the triple set
-
removeFromIndex
Description copied from interface:StoreStrategyNotify the strategy that the triple at the given index has been removed from the underlying triple set. Implementations that maintain an index must remove the triple from it; implementations without an index are free to no-op.- Specified by:
removeFromIndexin interfaceStoreStrategy- Parameters:
triple- the removed tripleindex- the index it occupied immediately before removal
-
clearIndex
public void clearIndex()Description copied from interface:StoreStrategyDiscard any auxiliary index data held by the strategy. Implementations without an index may no-op.- Specified by:
clearIndexin interfaceStoreStrategy
-
containsSubAnyAny
- Specified by:
containsSubAnyAnyin interfaceStoreStrategy
-
containsAnyPreAny
- Specified by:
containsAnyPreAnyin interfaceStoreStrategy
-
containsAnyAnyObj
- Specified by:
containsAnyAnyObjin interfaceStoreStrategy
-
containsSubPreAny
- Specified by:
containsSubPreAnyin interfaceStoreStrategy
-
containsSubAnyObj
- Specified by:
containsSubAnyObjin interfaceStoreStrategy
-
containsAnyPreObj
- Specified by:
containsAnyPreObjin interfaceStoreStrategy
-
streamSubAnyAny
- Specified by:
streamSubAnyAnyin interfaceStoreStrategy
-
streamAnyPreAny
- Specified by:
streamAnyPreAnyin interfaceStoreStrategy
-
streamAnyAnyObj
- Specified by:
streamAnyAnyObjin interfaceStoreStrategy
-
streamSubPreAny
- Specified by:
streamSubPreAnyin interfaceStoreStrategy
-
streamSubAnyObj
- Specified by:
streamSubAnyObjin interfaceStoreStrategy
-
streamAnyPreObj
- Specified by:
streamAnyPreObjin interfaceStoreStrategy
-
findSubAnyAny
- Specified by:
findSubAnyAnyin interfaceStoreStrategy
-
findAnyPreAny
- Specified by:
findAnyPreAnyin interfaceStoreStrategy
-
findAnyAnyObj
- Specified by:
findAnyAnyObjin interfaceStoreStrategy
-
findSubPreAny
- Specified by:
findSubPreAnyin interfaceStoreStrategy
-
findSubAnyObj
- Specified by:
findSubAnyObjin interfaceStoreStrategy
-
findAnyPreObj
- Specified by:
findAnyPreObjin interfaceStoreStrategy
-