org.eclipse.viatra.query.runtime.matchers.psystem.analysis

## Class QueryAnalyzer

- java.lang.Object
- - org.eclipse.viatra.query.runtime.matchers.psystem.analysis.QueryAnalyzer

-     public final class QueryAnalyzer
      extends java.lang.Object

  Object responsible for computing and caching static query analysis results.

  Any client can instantiate this to statically analyze queries. Query backends should share an instance obtained via `IQueryBackendContext` to save resources.

  Precondition: all involved queries must be initialized.

  Since:
    1.5
  No Instantiate:
    Considered unstable API; subject to change in future versions. Either use the analyzer provided by `IQueryBackendContext`, or anticipate potential future breakage when instantiating your own analyzer.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `QueryAnalyzer(IQueryMetaContext metaContext)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.util.Map<java.util.Set<PVariable>,java.util.Set<PVariable>>` | `getFunctionalDependencies(java.util.Set<PConstraint> constraints, boolean strict)` Functional dependency information, expressed on PVariables within a body, that the selected constraints imply.
    `java.util.Map<java.util.Set<java.lang.Integer>,java.util.Set<java.lang.Integer>>` | `getProjectedFunctionalDependencies(PQuery query, boolean strict)` Functional dependency information, expressed on query parameters, that the match set of the query is guaranteed to respect.

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

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

- - ### Constructor Detail

    - #### QueryAnalyzer

          public QueryAnalyzer(IQueryMetaContext metaContext)

  - ### Method Detail

    - #### getProjectedFunctionalDependencies

          public java.util.Map<java.util.Set<java.lang.Integer>,java.util.Set<java.lang.Integer>> getProjectedFunctionalDependencies(PQuery query,
                                                                                                                                     boolean strict)

      Functional dependency information, expressed on query parameters, that the match set of the query is guaranteed to respect.

      The type dependencies shall be expressed on the parameter index integers, NOT the `PParameter` object.

      Parameters:
        `strict` - if true, only "hard" dependencies are taken into account that are strictly enforced by the model representation; if false, user-provided soft dependencies (@FunctionalDependency) are included as well, that are anticipated but not guaranteed by the storage mechanism; use true if superfluous dependencies may taint the correctness of a computation, false if they would merely impact performance
      Returns:
        a non-null map of functional dependencies on parameters that can be processed by `FunctionalDependencyHelper`
      Since:
        1.5

    - #### getFunctionalDependencies

          public java.util.Map<java.util.Set<PVariable>,java.util.Set<PVariable>> getFunctionalDependencies(java.util.Set<PConstraint> constraints,
                                                                                                            boolean strict)

      Functional dependency information, expressed on PVariables within a body, that the selected constraints imply.
      Parameters:
        `constraints` - the set of constraints whose consequences will be analyzed
        `strict` - if true, only "hard" dependencies are taken into account that are strictly enforced by the model representation; if false, user-provided soft dependencies (@FunctionalDependency) are included as well, that are anticipated but not guaranteed by the storage mechanism; use true if superfluous dependencies may taint the correctness of a computation, false if they would merely impact performance
      Returns:
        a non-null map of functional dependencies on PVariables that can be processed by `FunctionalDependencyHelper`
      Since:
        1.5