Class StorageNodeLeafComponentSet<D,​C,​V,​S extends Set<V>>

  • Type Parameters:
    D -
    C -
    V -
    All Implemented Interfaces:
    StorageNode<D,​C,​S>, StorageNodeMutable<D,​C,​S>

    public class StorageNodeLeafComponentSet<D,​C,​V,​S extends Set<V>>
    extends StorageNodeBase<D,​C,​S>
    Essentially a view of a Set as a Map
    Author:
    Claus Stadler 11/09/2020
    • Field Detail

      • keyToComponent

        protected org.aksw.commons.tuple.TupleAccessorCore<? super V,​? extends C> keyToComponent
    • Constructor Detail

      • StorageNodeLeafComponentSet

        public StorageNodeLeafComponentSet​(int[] tupleIdxs,
                                           org.aksw.commons.tuple.TupleAccessor<D,​C> tupleAccessor,
                                           SetSupplier setSupplier,
                                           TupleValueFunction<C,​V> valueFunction,
                                           org.aksw.commons.tuple.TupleAccessorCore<? super V,​? extends C> keyToComponent)
    • Method Detail

      • tupleToValue

        public V tupleToValue​(D tupleLike)
      • getChildren

        public List<StorageNode<D,​C,​?>> getChildren()
        Description copied from interface: StorageNode
        Each node in the storage expression may have 0 or more children
        Returns:
      • add

        public boolean add​(S set,
                           D tupleLike)
      • remove

        public boolean remove​(S set,
                              D tupleLike)
      • clear

        public void clear​(S store)
        Description copied from interface: StorageNodeMutable
        Clear a store's content. Cascades to any sub-stores.
      • streamerForKeysAsComponent

        public <T> Streamer<S,​C> streamerForKeysAsComponent​(T pattern,
                                                                  org.aksw.commons.tuple.TupleAccessorCore<? super T,​? extends C> accessor)
        Description copied from interface: StorageNode
        Compiles 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
        Returns:
      • streamerForKeysUnderConstraints

        public <T> Streamer<S,​V> streamerForKeysUnderConstraints​(T tupleLike,
                                                                       org.aksw.commons.tuple.TupleAccessorCore<? super T,​? extends C> tupleAccessor)
      • streamerForKeysAsTuples

        public <T> Streamer<S,​List<C>> streamerForKeysAsTuples​(T pattern,
                                                                     org.aksw.commons.tuple.TupleAccessorCore<? super T,​? extends C> accessor)
        Description copied from interface: StorageNode
        Compiles 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
        Returns:
      • streamerForValues

        public <T> Streamer<S,​V> streamerForValues​(T pattern,
                                                         org.aksw.commons.tuple.TupleAccessorCore<? super T,​? extends C> accessor)
        Description copied from interface: StorageNode
        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
        Returns:
      • streamEntries

        public <T> java.util.stream.Stream<V> streamEntries​(S set,
                                                            T tupleLike,
                                                            org.aksw.commons.tuple.TupleAccessorCore<? super T,​? extends C> tupleAccessor)
        Description copied from interface: StorageNode
        Stream all entries under equality constraints obtained from a tuple-like pattern
        Returns:
      • streamerForKeys

        public <T> Streamer<S,​?> streamerForKeys​(T pattern,
                                                       org.aksw.commons.tuple.TupleAccessorCore<? super T,​? extends C> accessor)
      • getKeyComponentRaw

        public C getKeyComponentRaw​(Object key,
                                    int idx)
        Description copied from interface: StorageNode
        Obtain components from the internal representation of key that was used for indexing w.r.t. StorageNode.getKeyTupleIdxs().
        idx - In the range 0 to {@link getKeyTupleIdxs().length} (exclusive) If a key has no components calling this method will always raise IndexOutOfBoundsException
        Returns:
      • chooseSubStore

        public Object chooseSubStore​(S store,
                                     int subStoreIdx)
      • isSetNode

        public boolean isSetNode()
        Description copied from interface: StorageNode
        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.
        Specified by:
        isSetNode in interface StorageNode<D,​C,​V>
        Returns: