java.lang.Object
org.apache.jena.mem.store.indexed.IndexedSetTripleStore
- All Implemented Interfaces:
org.apache.jena.atlas.lib.Copyable<TripleStore>,TripleStore
TripleStore that stores all triples in a single
TripleSet and delegates pattern-matching to a configurable
StoreStrategy. The strategy is selected via an
IndexingStrategy and may swap itself out at runtime (e.g. a
LazyStoreStrategy replaces itself with an
EagerStoreStrategy as soon as the first pattern lookup is
performed).
The triples themselves are kept in triples; each triple has a
stable index in that set, which the strategy uses to maintain
subject/predicate/object indices of integer indices rather than triple
references.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates an indexed store with theIndexingStrategy.EAGERdefault indexing strategy.IndexedSetTripleStore(IndexingStrategy indexingStrategy) Creates an indexed store using the given indexing strategy. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a triple to the store.voidclear()Remove all triples from the store.booleanReturnstrueif the store contains any triple matching the given pattern.copy()Returns an independent copy of this store.intReturns the number of triples in the store.Returns anExtendedIteratorover every triple in the store matching the given pattern.Get the indexing strategy of this store.voidInitialize the index for this store.voidInitialize the index for this store in parallel.booleanisEmpty()Returnstrueif the store contains no triples.booleanCheck if the index has been initialized and all triples are indexed.voidRemove a triple from the store.voidReset the current strategy to the initial one.stream()Returns aStreamof all triples in the store.Returns aStreamof every triple in the store matching the given pattern.
-
Constructor Details
-
IndexedSetTripleStore
public IndexedSetTripleStore()Creates an indexed store with theIndexingStrategy.EAGERdefault indexing strategy. -
IndexedSetTripleStore
Creates an indexed store using the given indexing strategy.- Parameters:
indexingStrategy- the indexing strategy to use
-
-
Method Details
-
isIndexInitialized
public boolean isIndexInitialized()Check if the index has been initialized and all triples are indexed.- Returns:
- true if the index is initialized, false otherwise
-
getIndexingStrategy
Get the indexing strategy of this store.- Returns:
- the indexing strategy
-
resetIndexingStrategy
public void resetIndexingStrategy()Reset the current strategy to the initial one. -
initializeIndex
public void initializeIndex()Initialize the index for this store. -
initializeIndexParallel
public void initializeIndexParallel()Initialize the index for this store in parallel. This will index all triples in parallel, which can be faster for large datasets. -
add
Description copied from interface:TripleStoreAdd a triple to the store. Does nothing if the triple is already present.- Specified by:
addin interfaceTripleStore- Parameters:
triple- the triple to add
-
remove
Description copied from interface:TripleStoreRemove a triple from the store. Does nothing if the triple is not present.- Specified by:
removein interfaceTripleStore- Parameters:
triple- the triple to remove
-
clear
public void clear()Description copied from interface:TripleStoreRemove all triples from the store. After this call,TripleStore.isEmpty()returnstrueand any associated indices are emptied.- Specified by:
clearin interfaceTripleStore
-
countTriples
public int countTriples()Description copied from interface:TripleStoreReturns the number of triples in the store.- Specified by:
countTriplesin interfaceTripleStore- Returns:
- the number of triples
-
isEmpty
public boolean isEmpty()Description copied from interface:TripleStoreReturnstrueif the store contains no triples.- Specified by:
isEmptyin interfaceTripleStore- Returns:
trueif empty
-
contains
Description copied from interface:TripleStoreReturnstrueif the store contains any triple matching the given pattern. The pattern may contain wildcards (e.g.Node.ANY).- Specified by:
containsin interfaceTripleStore- Parameters:
tripleMatch- the triple pattern to match- Returns:
trueif at least one matching triple exists
-
stream
Description copied from interface:TripleStoreReturns aStreamof all triples in the store. The returned stream supportsBaseStream.parallel().- Specified by:
streamin interfaceTripleStore- Returns:
- a stream over every triple in this store
-
stream
Description copied from interface:TripleStoreReturns aStreamof every triple in the store matching the given pattern. The returned stream supportsBaseStream.parallel().- Specified by:
streamin interfaceTripleStore- Parameters:
tripleMatch- the triple pattern to match (may contain wildcards)- Returns:
- a stream over the matching triples
-
find
Description copied from interface:TripleStoreReturns anExtendedIteratorover every triple in the store matching the given pattern.- Specified by:
findin interfaceTripleStore- Parameters:
tripleMatch- the triple pattern to match (may contain wildcards)- Returns:
- an iterator over the matching triples
-
copy
Description copied from interface:TripleStoreReturns an independent copy of this store. SinceNodes andTriples are immutable, the copy may share node and triple instances with the original; only the container/index data structures are duplicated so that mutations in either store do not affect the other.- Specified by:
copyin interfaceorg.apache.jena.atlas.lib.Copyable<TripleStore>- Specified by:
copyin interfaceTripleStore- Returns:
- an independent copy of this store
-