java.lang.Object
org.apache.jena.mem2.store.legacy.LegacyTripleStore
- All Implemented Interfaces:
org.apache.jena.atlas.lib.Copyable<TripleStore>,TripleStore
Successor of
GraphTripleStoreMem that uses term-equality
instead of literal value equality.
This implementation also does not support Iterator.remove().
Inner structure:
- three NodeToTriplesMapMem instances for each of the three triple fields (subject, predicate, object)
- each of these maps is a HashCommonMap with Node keys and JenaSet values.
- for up to 9 triples with the same subject, predicate or object, the JenaSet is
a ArrayBunch, otherwise it is a HashedTripleBunch.
Additional optimizations:
- because we know that if a triple exists in one of the maps, it also exists in the other two, we can use the
JenaSet.addUnchecked(java.lang.Object) and
JenaMapSetCommon.removeUnchecked(java.lang.Object) methods to avoid
unnecessary checks.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a triple to the map.voidclear()Remove all triples from the map.booleanAnswer true if the graph contains any triple matchingt.copy()Return a new triple store that is a copy of this one.intReturn the number of triples in the map.Returns anExtendedIteratorof all triples in the graph matching the given triple match.booleanisEmpty()Return true if the map is empty.voidRemove a triple from the map.stream()Returns aStreamof all triples in the graph.Returns aStreamof Triples matching the given pattern.
-
Constructor Details
-
LegacyTripleStore
public LegacyTripleStore()
-
-
Method Details
-
add
Description copied from interface:TripleStoreAdd a triple to the map.- Specified by:
addin interfaceTripleStore- Parameters:
triple- to add
-
remove
Description copied from interface:TripleStoreRemove a triple from the map.- Specified by:
removein interfaceTripleStore- Parameters:
triple- to remove
-
clear
public void clear()Description copied from interface:TripleStoreRemove all triples from the map.- Specified by:
clearin interfaceTripleStore
-
countTriples
public int countTriples()Description copied from interface:TripleStoreReturn the number of triples in the map.- Specified by:
countTriplesin interfaceTripleStore
-
isEmpty
public boolean isEmpty()Description copied from interface:TripleStoreReturn true if the map is empty.- Specified by:
isEmptyin interfaceTripleStore
-
contains
Description copied from interface:TripleStoreAnswer true if the graph contains any triple matchingt.- Specified by:
containsin interfaceTripleStore- Parameters:
tripleMatch- triple match pattern, which may be contained
-
stream
Description copied from interface:TripleStoreReturns aStreamof all triples in the graph. Note:BaseStream.parallel()is supported.- Specified by:
streamin interfaceTripleStore- Returns:
- a stream of triples in this graph.
-
stream
Description copied from interface:TripleStoreReturns aStreamof Triples matching the given pattern. Note:BaseStream.parallel()is supported.- Specified by:
streamin interfaceTripleStore- Parameters:
tripleMatch- triple match pattern- Returns:
- a stream of triples in this graph matching the pattern.
-
find
Description copied from interface:TripleStoreReturns anExtendedIteratorof all triples in the graph matching the given triple match.- Specified by:
findin interfaceTripleStore
-
copy
Description copied from interface:TripleStoreReturn a new triple store that is a copy of this one. Since Nodes and Triples are immutable and shared, the copy can share the same Nodes and Triples.- Specified by:
copyin interfaceorg.apache.jena.atlas.lib.Copyable<TripleStore>- Specified by:
copyin interfaceTripleStore- Returns:
- an independent copy of this store
-