Package org.aksw.commons.index.core
Class StorageNodeForwarding<D,C,V,X extends StorageNode<D,C,V>>
- java.lang.Object
-
- org.aksw.commons.index.core.StorageNodeForwarding<D,C,V,X>
-
- Type Parameters:
D-C-V-X-
- All Implemented Interfaces:
StorageNode<D,C,V>
- Direct Known Subclasses:
StorageNodeMutableForwarding
public abstract class StorageNodeForwarding<D,C,V,X extends StorageNode<D,C,V>> extends Object implements StorageNode<D,C,V>
- Author:
- Claus Stadler 11/09/2020
-
-
Constructor Summary
Constructors Constructor Description StorageNodeForwarding()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description ObjectchooseSubStore(V store, int subStoreIdx)List<? extends StorageNode<D,C,?>>getChildren()Each node in the storage expression may have 0 or more childrenprotected abstract XgetDelegate()CgetKeyComponentRaw(Object key, int idx)Obtain components from the internal representation of key that was used for indexing w.r.t.int[]getKeyTupleIdxs()The component indexes by which this node indexes May be empty but never nullStorageNode<D,C,V>getPublicDelegate()Map<?,?>getStoreAsMap(Object store)Set<?>getStoreAsSet(Object store)org.aksw.commons.tuple.TupleAccessor<D,C>getTupleAccessor()Future: Allow the storageNode to answer how efficiently it can answer the constraints in a given constraint list E.g.booleanisAltNode()Whether this storage node stores are a sequences of alternatives Experimental method; may be replaced by a generic getStoreType() method that returns e.g Alt.class, Set.class, etc.booleanisDelegate()Attempt to access a store as a map.booleanisMapNode()Whether this storage node stores are a maps Experimental method; may be replaced by a generic getStoreType() method that returns e.g Alt.class, Set.class, etc.booleanisSetNode()Whether this storage node stores are sets Experimental method; may be replaced by a generic getStoreType() method that returns e.g Alt.class, Set.class, etc.<T> java.util.stream.Stream<?>streamEntries(V store, T tupleLike, org.aksw.commons.tuple.TupleAccessorCore<? super T,? extends C> tupleAccessor)Stream all entries under equality constraints obtained from a tuple-like pattern<T> Streamer<V,? extends Map.Entry<?,?>>streamerForKeyAndSubStoreAlts(T pattern, org.aksw.commons.tuple.TupleAccessorCore<? super T,? extends C> accessor)The streamer returns entry that hold a tuple-like key and conceptually alternatives of sub-stores The tuple components of the key can be accessed usingStorageNode.getKeyComponentRaw(Object, int)There are as many components as the length ofStorageNode.getKeyTupleIdxs()If there is 0 components then any invocation ofStorageNode.getKeyComponentRaw(Object, int)will fail with aUnsupportedOperationException.<T> Streamer<V,?>streamerForKeys(T pattern, org.aksw.commons.tuple.TupleAccessorCore<? super T,? extends C> accessor)<T> Streamer<V,C>streamerForKeysAsComponent(T pattern, org.aksw.commons.tuple.TupleAccessorCore<? super T,? extends C> accessor)Compiles from a given pattern a function that can stream the matching keys from the appropriate store.<T> Streamer<V,List<C>>streamerForKeysAsTuples(T pattern, org.aksw.commons.tuple.TupleAccessorCore<? super T,? extends C> accessor)Compiles from a given pattern a function that can stream the matching keys from the appropriate store.<T> Streamer<V,?>streamerForValues(T pattern, org.aksw.commons.tuple.TupleAccessorCore<? super T,? extends C> accessor)Returns an object that can extract the stream of values at an index node under constraints map: { entry.value | entry in map and entry.key matches condition} leafSet: set.entries.stream() A leaf set does not have any keys that could affect the result stream-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.aksw.commons.index.core.StorageNode
chooseSubStoreRaw, getStoreAsList, holdsDomainTuples, isListNode, streamEntries, streamEntriesRaw, streamEntriesRaw
-
-
-
-
Method Detail
-
getDelegate
protected abstract X getDelegate()
-
getPublicDelegate
public StorageNode<D,C,V> getPublicDelegate()
- Specified by:
getPublicDelegatein interfaceStorageNode<D,C,V>
-
isDelegate
public boolean isDelegate()
Description copied from interface:StorageNodeAttempt to access a store as a map. The StorageNode and the store must be of the appropriate types in order for this operation to succeed.- Specified by:
isDelegatein interfaceStorageNode<D,C,V>- Returns:
-
isAltNode
public boolean isAltNode()
Description copied from interface:StorageNodeWhether this storage node stores are a sequences of alternatives Experimental method; may be replaced by a generic getStoreType() method that returns e.g Alt.class, Set.class, etc.- Specified by:
isAltNodein interfaceStorageNode<D,C,V>- Returns:
-
isMapNode
public boolean isMapNode()
Description copied from interface:StorageNodeWhether this storage node stores are a maps Experimental method; may be replaced by a generic getStoreType() method that returns e.g Alt.class, Set.class, etc.- Specified by:
isMapNodein interfaceStorageNode<D,C,V>- Returns:
-
isSetNode
public boolean isSetNode()
Description copied from interface:StorageNodeWhether this storage node stores are sets Experimental method; may be replaced by a generic getStoreType() method that returns e.g Alt.class, Set.class, etc.- Specified by:
isSetNodein interfaceStorageNode<D,C,V>- Returns:
-
getStoreAsMap
public Map<?,?> getStoreAsMap(Object store)
- Specified by:
getStoreAsMapin interfaceStorageNode<D,C,V>
-
getStoreAsSet
public Set<?> getStoreAsSet(Object store)
- Specified by:
getStoreAsSetin interfaceStorageNode<D,C,V>
-
getChildren
public List<? extends StorageNode<D,C,?>> getChildren()
Description copied from interface:StorageNodeEach node in the storage expression may have 0 or more children- Specified by:
getChildrenin interfaceStorageNode<D,C,V>- Returns:
-
getKeyTupleIdxs
public int[] getKeyTupleIdxs()
Description copied from interface:StorageNodeThe component indexes by which this node indexes May be empty but never null- Specified by:
getKeyTupleIdxsin interfaceStorageNode<D,C,V>- Returns:
-
getTupleAccessor
public org.aksw.commons.tuple.TupleAccessor<D,C> getTupleAccessor()
Description copied from interface:StorageNodeFuture: Allow the storageNode to answer how efficiently it can answer the constraints in a given constraint list E.g. O(1) or O(log(n)) or O(n)- Specified by:
getTupleAccessorin interfaceStorageNode<D,C,V>- Returns:
-
streamerForKeysAsComponent
public <T> Streamer<V,C> streamerForKeysAsComponent(T pattern, org.aksw.commons.tuple.TupleAccessorCore<? super T,? extends C> accessor)
Description copied from interface:StorageNodeCompiles from a given pattern a function that can stream the matching keys from the appropriate store. The keys must be instances of the component type otherwise an exception is raised- Specified by:
streamerForKeysAsComponentin interfaceStorageNode<D,C,V>- Returns:
-
streamerForKeysAsTuples
public <T> Streamer<V,List<C>> streamerForKeysAsTuples(T pattern, org.aksw.commons.tuple.TupleAccessorCore<? super T,? extends C> accessor)
Description copied from interface:StorageNodeCompiles from a given pattern a function that can stream the matching keys from the appropriate store. The keys must be instances of the component type otherwise an exception is raised if getKeyTupleIdxs().length == 0 then returns a single tuple that projects no components- Specified by:
streamerForKeysAsTuplesin interfaceStorageNode<D,C,V>- Returns:
-
streamerForKeys
public <T> Streamer<V,?> streamerForKeys(T pattern, org.aksw.commons.tuple.TupleAccessorCore<? super T,? extends C> accessor)
- Specified by:
streamerForKeysin interfaceStorageNode<D,C,V>
-
getKeyComponentRaw
public C getKeyComponentRaw(Object key, int idx)
Description copied from interface:StorageNodeObtain components from the internal representation of key that was used for indexing w.r.t.StorageNode.getKeyTupleIdxs().- Specified by:
getKeyComponentRawin interfaceStorageNode<D,C,V>idx- In the range 0 to {@link getKeyTupleIdxs().length} (exclusive) If a key has no components calling this method will always raiseIndexOutOfBoundsException- Returns:
-
chooseSubStore
public Object chooseSubStore(V store, int subStoreIdx)
- Specified by:
chooseSubStorein interfaceStorageNode<D,C,V>
-
streamerForValues
public <T> Streamer<V,?> streamerForValues(T pattern, org.aksw.commons.tuple.TupleAccessorCore<? super T,? extends C> accessor)
Description copied from interface:StorageNodeReturns an object that can extract the stream of values at an index node under constraints map: { entry.value | entry in map and entry.key matches condition} leafSet: set.entries.stream() A leaf set does not have any keys that could affect the result stream- Specified by:
streamerForValuesin interfaceStorageNode<D,C,V>- Returns:
-
streamerForKeyAndSubStoreAlts
public <T> Streamer<V,? extends Map.Entry<?,?>> streamerForKeyAndSubStoreAlts(T pattern, org.aksw.commons.tuple.TupleAccessorCore<? super T,? extends C> accessor)
Description copied from interface:StorageNodeThe streamer returns entry that hold a tuple-like key and conceptually alternatives of sub-stores The tuple components of the key can be accessed usingStorageNode.getKeyComponentRaw(Object, int)There are as many components as the length ofStorageNode.getKeyTupleIdxs()If there is 0 components then any invocation ofStorageNode.getKeyComponentRaw(Object, int)will fail with aUnsupportedOperationException. To extract a specific alternative from the substore useStorageNode.chooseSubStore(Object, int). IfStorageNode.getChildren()is not empty then there are as many substore indices as there are children If there are no children then there is an implicit single sub store with index 0- Specified by:
streamerForKeyAndSubStoreAltsin interfaceStorageNode<D,C,V>- Returns:
-
streamEntries
public <T> java.util.stream.Stream<?> streamEntries(V store, T tupleLike, org.aksw.commons.tuple.TupleAccessorCore<? super T,? extends C> tupleAccessor)
Description copied from interface:StorageNodeStream all entries under equality constraints obtained from a tuple-like pattern- Specified by:
streamEntriesin interfaceStorageNode<D,C,V>- Returns:
-
-