org.eclipse.viatra.query.runtime.matchers.planning.helpers

## Class FunctionalDependencyHelper

- java.lang.Object
- - org.eclipse.viatra.query.runtime.matchers.planning.helpers.FunctionalDependencyHelper

-     public class FunctionalDependencyHelper
      extends java.lang.Object

  Helper utility class for functional dependency analysis. Throughout this class attribute sets are represented as generic sets and functional dependencies as maps from attribute set (generic sets) to attribute set (generic sets)

- - ### Method Summary

    All Methods Static Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static <A> java.util.Set<A>` | `closureOf(java.util.Collection<A> attributes, java.util.Map<java.util.Set<A>,java.util.Set<A>> dependencies)` Get the closure of the specified attribute set relative to the specified functional dependencies.
    `static <A> void` | `includeDependencies(java.util.Map<java.util.Set<A>,java.util.Set<A>> accumulator, java.util.Map<java.util.Set<A>,java.util.Set<A>> additionalDependencies)` Adds all given dependencies to a mutable accumulator.
    `static <A> void` | `includeDependency(java.util.Map<java.util.Set<A>,java.util.Set<A>> accumulator, java.util.Set<A> left, java.util.Set<A> right)` Adds a given dependency to a mutable accumulator.
    `static <A> boolean` | `isTrivial(java.util.Set<A> left, java.util.Set<A> right)`
    `static <A> java.util.Map<java.util.Set<A>,java.util.Set<A>>` | `projectDependencies(java.util.Map<java.util.Set<A>,java.util.Set<A>> originalDependencies, java.util.Set<A> targetAttributes)` Returns the dependency set over attributes in `targetAttributes` that are implied by a given source dependency set.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### closureOf

          public static <A> java.util.Set<A> closureOf(java.util.Collection<A> attributes,
                                                       java.util.Map<java.util.Set<A>,java.util.Set<A>> dependencies)

      Get the closure of the specified attribute set relative to the specified functional dependencies.
      Parameters:
        `attributes` - The attributes to get the closure of.
        `dependencies` - The functional dependencies of which the closure operation is relative to.
      Returns:
        The closure of the specified attribute set relative to the specified functional dependencies.

    - #### isTrivial

          public static <A> boolean isTrivial(java.util.Set<A> left,
                                              java.util.Set<A> right)

      Returns:
        true if the dependency from the left set to the right set is trivial
      Since:
        1.5

    - #### projectDependencies

          public static <A> java.util.Map<java.util.Set<A>,java.util.Set<A>> projectDependencies(java.util.Map<java.util.Set<A>,java.util.Set<A>> originalDependencies,
                                                                                                 java.util.Set<A> targetAttributes)

      Returns the dependency set over attributes in `targetAttributes` that are implied by a given source dependency set.

      Note: exponential in the size of the target attribute set.

      Note: minimality of the returned dependency set is currently not guaranteed.

      Parameters:
        `originalDependencies` - all dependencies that are known to hold on a wider set of attributes
        `targetAttributes` - the set of attributes we are interested in
      Since:
        1.5

    - #### includeDependency

          public static <A> void includeDependency(java.util.Map<java.util.Set<A>,java.util.Set<A>> accumulator,
                                                   java.util.Set<A> left,
                                                   java.util.Set<A> right)

      Adds a given dependency to a mutable accumulator.
      Since:
        1.5

    - #### includeDependencies

          public static <A> void includeDependencies(java.util.Map<java.util.Set<A>,java.util.Set<A>> accumulator,
                                                     java.util.Map<java.util.Set<A>,java.util.Set<A>> additionalDependencies)

      Adds all given dependencies to a mutable accumulator.
      Since:
        1.5