Interface CollectionFactory
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
DefaultCollectionFactory,MapDb3CollectionFactory,MapDbCollectionFactory
A Factory that may generate optimised and/or disk based collections
Factories like this should not be cached but created a new everytime as the closing is important if they are disk
based.
-
Method Summary
Modifier and TypeMethodDescriptionvoidclose()createBindingSetKey(BindingSet bindingSet, List<Function<BindingSet, Value>> getValues, ToIntFunction<BindingSet> hashOfBindingSetCalculator) default Queue<BindingSet>default Queue<BindingSet>createBindingSetQueue(Supplier<MutableBindingSet> create, Function<String, Predicate<BindingSet>> getHas, Function<String, Function<BindingSet, Value>> getget, Function<String, BiConsumer<Value, MutableBindingSet>> getSet) <E> Map<BindingSetKey,E> <T> List<T><K,V> Map<K, V> <T> Queue<T><T> Set<T>default Set<BindingSet>createSetOfBindingSets(Supplier<MutableBindingSet> create, Function<String, Predicate<BindingSet>> getHas, Function<String, Function<BindingSet, Value>> getGet, Function<String, BiConsumer<Value, MutableBindingSet>> getSet) Allows optimizations beyond what would otherwise be possible, regarding disk access and storage.default inthashAValue(Function<BindingSet, Value> getValue, int nextHash, BindingSet bs) Hashes a value that complies with the hashCode/equals conception but only in context of this collection/factory storage layer.default ToIntFunction<BindingSet>hashOfBindingSetFuntion(List<Function<BindingSet, Value>> getValues) Generate a method that calculates a hash code that is valid in context of a single store implementation and QueryExecutionContext.
-
Method Details
-
close
- Specified by:
closein interfaceAutoCloseable- Throws:
RDF4JException
-
createList
- Type Parameters:
T- of the list- Returns:
- a list that may be optimised and/or disk based
-
createValueList
- Returns:
- a list that may be optimised and/or disk based for Values only
-
createSet
- Type Parameters:
T- of the set- Returns:
- a set that may be optimised and/or disk based
-
createSetOfBindingSets
- Returns:
- a set that may be optimised and/or disk based
-
createSetOfBindingSets
Set<BindingSet> createSetOfBindingSets(Supplier<MutableBindingSet> create, Function<String, Predicate<BindingSet>> getHas, Function<String, Function<BindingSet, Value>> getGet, Function<String, BiConsumer<Value, MutableBindingSet>> getSet) Allows optimizations beyond what would otherwise be possible, regarding disk access and storage.- Parameters:
create- a supplier that makes bindingsetsa- supplier used to create prebound hasBinding predicatesa- supplier used to create prebound getValue functionsa- supplier used to create prebound setValue functions- Returns:
- a set that may be optimised and/or disk based
-
createValueSet
- Returns:
- a set that may be optimised and/or disk based for Values
-
createMap
- Type Parameters:
K- key typeV- value type- Returns:
- a map
-
createValueKeyedMap
- Type Parameters:
V- value type- Returns:
- a map
-
createQueue
- Type Parameters:
T- of the contents of the queue- Returns:
- a new queue
-
createValueQueue
- Returns:
- a new queue
-
createBindingSetQueue
@Experimental default Queue<BindingSet> createBindingSetQueue(Supplier<MutableBindingSet> create, Function<String, Predicate<BindingSet>> getHas, Function<String, Function<BindingSet, Value>> getget, Function<String, BiConsumer<Value, MutableBindingSet>> getSet) - Returns:
- a new queue that may be optimized and may use the functions passed in.
-
createBindingSetQueue
- Returns:
- a new queue optimized for bindingsets
-
createGroupByMap
-
createBindingSetKey
@InternalUseOnly BindingSetKey createBindingSetKey(BindingSet bindingSet, List<Function<BindingSet, Value>> getValues, ToIntFunction<BindingSet> hashOfBindingSetCalculator) -
hashAValue
@InternalUseOnly default int hashAValue(Function<BindingSet, Value> getValue, int nextHash, BindingSet bs) Hashes a value that complies with the hashCode/equals conception but only in context of this collection/factory storage layer. Potentially also only valid during a single transaction scope.- Parameters:
getValue- the function to extract the value to hashnextHash- any previously calculated hash value for earlier values in the BindingSetbs- the bindingset to take the value from- Returns:
- a hash function
-
hashOfBindingSetFuntion
@InternalUseOnly default ToIntFunction<BindingSet> hashOfBindingSetFuntion(List<Function<BindingSet, Value>> getValues) Generate a method that calculates a hash code that is valid in context of a single store implementation and QueryExecutionContext.- Parameters:
getValues- that should be considered in the hash- Returns:
- a hash function
-