Interface StorageNode<D,​C,​V>

    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      Object chooseSubStore​(V store, int subStoreIdx)  
      default Object chooseSubStoreRaw​(Object store, int subStoreIdx)  
      List<? extends StorageNode<D,​C,​?>> getChildren()
      Each node in the storage expression may have 0 or more children
      C getKeyComponentRaw​(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 null
      default StorageNode<D,​C,​V> getPublicDelegate()  
      default List<?> getStoreAsList​(Object store)  
      default Map<?,​?> getStoreAsMap​(Object store)  
      default 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.
      default boolean holdsDomainTuples()
      Flag that when true indicates that this storage node's values are tuples of type D - i.e.
      default boolean isAltNode()
      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.
      default boolean isDelegate()
      Attempt to access a store as a map.
      default boolean isListNode()
      Whether this storage node stores are lists Experimental method; may be replaced by a generic getStoreType() method that returns e.g Alt.class, Set.class, etc.
      default boolean isMapNode()
      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.
      default boolean isSetNode()
      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.
      default java.util.stream.Stream<?> streamEntries​(V store)  
      <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
      default java.util.stream.Stream<?> streamEntriesRaw​(Object store)
      Generic method to stream the content - mainly for debugging
      default <T> java.util.stream.Stream<?> streamEntriesRaw​(Object store, T tupleLike, org.aksw.commons.tuple.TupleAccessorCore<? super T,​? extends C> tupleAccessor)  
      <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 using getKeyComponentRaw(Object, int) There are as many components as the length of getKeyTupleIdxs() If there is 0 components then any invocation of getKeyComponentRaw(Object, int) will fail with a UnsupportedOperationException.
      <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
    • Method Detail

      • getChildren

        List<? extends StorageNode<D,​C,​?>> getChildren()
        Each node in the storage expression may have 0 or more children
        Returns:
      • isDelegate

        default boolean isDelegate()
        Attempt 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.
        Parameters:
        store -
        Returns:
      • getPublicDelegate

        default StorageNode<D,​C,​V> getPublicDelegate()
      • isAltNode

        default boolean isAltNode()
        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.
        Returns:
      • isSetNode

        default boolean isSetNode()
        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.
        Returns:
      • isListNode

        default boolean isListNode()
        Whether this storage node stores are lists Experimental method; may be replaced by a generic getStoreType() method that returns e.g Alt.class, Set.class, etc.
        Returns:
      • isMapNode

        default boolean isMapNode()
        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.
        Returns:
      • holdsDomainTuples

        default boolean holdsDomainTuples()
        Flag that when true indicates that this storage node's values are tuples of type D - i.e. "domain tuples".
        Returns:
      • getStoreAsMap

        default Map<?,​?> getStoreAsMap​(Object store)
      • getStoreAsList

        default List<?> getStoreAsList​(Object store)
      • getStoreAsSet

        default Set<?> getStoreAsSet​(Object store)
      • getKeyTupleIdxs

        int[] getKeyTupleIdxs()
        The component indexes by which this node indexes May be empty but never null
        Returns:
      • getTupleAccessor

        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. O(1) or O(log(n)) or O(n)
        Returns:
      • streamerForKeysAsComponent

        <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. The keys must be instances of the component type otherwise an exception is raised
        Returns:
      • streamerForKeysAsTuples

        <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. 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
        Parameters:
        store -
        Returns:
      • streamerForKeys

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

        C getKeyComponentRaw​(Object key,
                             int idx)
        Obtain components from the internal representation of key that was used for indexing w.r.t. getKeyTupleIdxs().
        Parameters:
        key -
        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

        Object chooseSubStore​(V store,
                              int subStoreIdx)
      • chooseSubStoreRaw

        default Object chooseSubStoreRaw​(Object store,
                                         int subStoreIdx)
      • streamerForValues

        <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
        Type Parameters:
        T -
        Parameters:
        pattern -
        accessor -
        Returns:
      • streamerForKeyAndSubStoreAlts

        <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 using getKeyComponentRaw(Object, int) There are as many components as the length of getKeyTupleIdxs() If there is 0 components then any invocation of getKeyComponentRaw(Object, int) will fail with a UnsupportedOperationException. To extract a specific alternative from the substore use chooseSubStore(Object, int). If 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
        Type Parameters:
        T -
        Parameters:
        pattern -
        accessor -
        Returns:
      • streamEntries

        <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
        Type Parameters:
        T -
        Parameters:
        store -
        tupleLike -
        tupleAccessor -
        Returns:
      • streamEntriesRaw

        default <T> java.util.stream.Stream<?> streamEntriesRaw​(Object store,
                                                                T tupleLike,
                                                                org.aksw.commons.tuple.TupleAccessorCore<? super T,​? extends C> tupleAccessor)
      • streamEntriesRaw

        default java.util.stream.Stream<?> streamEntriesRaw​(Object store)
        Generic method to stream the content - mainly for debugging
        Returns:
      • streamEntries

        default java.util.stream.Stream<?> streamEntries​(V store)