Package org.eclipse.viatra.query.runtime.emf

## Class EMFQueryMetaContext

- java.lang.Object
- - org.eclipse.viatra.query.runtime.matchers.context.AbstractQueryMetaContext
  - - org.eclipse.viatra.query.runtime.emf.EMFQueryMetaContext

- All Implemented Interfaces:
    `IQueryMetaContext`

      public final class EMFQueryMetaContext
      extends AbstractQueryMetaContext

  The meta context information for EMF scopes.

  The runtime context may specialize answers with a given scope. In a static context, a conservative default version (`DEFAULT`) can be used instead.

  TODO generics?

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static EMFQueryMetaContext` | `DEFAULT` | Default static instance that only makes conservative assumptions that are valid for any `EMFScope` (but not if objects are used).
    `static EMFQueryMetaContext` | `DEFAULT_SURROGATE` | Default static instance that only makes conservative assumptions that are valid for any scope, even with surrogate objects.

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `EMFQueryMetaContext​(EMFScope scope)` | Instantiates a specialized meta information that is aware of scope-specific details.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `boolean` | `canLeadOutOfScope​(org.eclipse.emf.ecore.EReference reference)` | Tells whether the given reference may lead out of scope.
    `boolean` | `canLeadOutOfScope​(IInputKey key)` | Tells whether the given `IInputKey` is an edge and may lead out of scope.
    `void` | `ensureValidKey​(IInputKey key)` |
    `org.eclipse.emf.ecore.EReference` | `featureOpposite​(org.eclipse.emf.ecore.EStructuralFeature typeObject)` |
    `org.eclipse.emf.ecore.EClass` | `featureSourceType​(org.eclipse.emf.ecore.EStructuralFeature feature)` |
    `org.eclipse.emf.ecore.EClassifier` | `featureTargetType​(org.eclipse.emf.ecore.EStructuralFeature typeObject)` |
    `java.util.Map<InputKeyImplication,​java.util.Set<InputKeyImplication>>` | `getConditionalImplications​(IInputKey implyingKey)` | Returns known "double dispatch" implications, where the given implying key implies other input keys under certain additional conditions (themselves input keys).
    `java.util.Map<java.util.Set<java.lang.Integer>,​java.util.Set<java.lang.Integer>>` | `getFunctionalDependencies​(IInputKey key)` | Returns functional dependencies of the input key expressed in terms of column indices.
    `java.util.Collection<InputKeyImplication>` | `getImplications​(IInputKey implyingKey)` | Returns known direct implications, e.g.
    `EClassTransitiveInstancesKey` | `getSourceTypeKey​(EStructuralFeatureInstancesKey key)` |
    `java.util.Comparator<IInputKey>` | `getSuggestedEliminationOrdering()` | For query normalizing, this is the order suggested for trying to eliminate input keys.
    `IInputKey` | `getTargetTypeKey​(EStructuralFeatureInstancesKey key)` |
    `java.util.Collection<InputKeyImplication>` | `getWeakenedAlternatives​(IInputKey implyingKey)` | Returns a set of implications (weakened alternatives), with a suggestion for the query planner that satisfying them first may help in satisfying the implying key.
    `void` | `illegalInputKey​(IInputKey key)` |
    `boolean` | `isEnumerable​(IInputKey key)` | Returns true iff instance tuples of the given key can be enumerated.
    `boolean` | `isFeatureMultiplicityOneTo​(org.eclipse.emf.ecore.EStructuralFeature typeObject)` |
    `boolean` | `isFeatureMultiplicityToOne​(org.eclipse.emf.ecore.EStructuralFeature feature)` |
    `static boolean` | `isFeatureOneToMultiplicity​(org.eclipse.emf.ecore.EStructuralFeature typeObject)` |
    `static boolean` | `isFeatureToOneMultiplicity​(org.eclipse.emf.ecore.EStructuralFeature feature)` |
    `boolean` | `isStateless​(IInputKey key)` | Returns true iff the set of instance tuples of the given key is immutable.

    - ### Methods inherited from class org.eclipse.viatra.query.runtime.matchers.context.AbstractQueryMetaContext

      `getPosetComparator, isPosetKey`

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

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

- - ### Field Detail

    - #### DEFAULT

          public static final EMFQueryMetaContext DEFAULT

      Default static instance that only makes conservative assumptions that are valid for any `EMFScope` (but not if objects are used).
      Since:
        1.6

    - #### DEFAULT_SURROGATE

          public static final EMFQueryMetaContext DEFAULT_SURROGATE

      Default static instance that only makes conservative assumptions that are valid for any scope, even with surrogate objects. Unscoped types are used for inference, but not emitted as replacement candidates, as they cannot be checked at runtime.
      Since:
        2.1

  - ### Constructor Detail

    - #### EMFQueryMetaContext

          public EMFQueryMetaContext​(EMFScope scope)

      Instantiates a specialized meta information that is aware of scope-specific details.
      Since:
        2.1

  - ### Method Detail

    - #### isEnumerable

          public boolean isEnumerable​(IInputKey key)

      Description copied from interface: `IQueryMetaContext`
      Returns true iff instance tuples of the given key can be enumerated.

      If false, the runtime can only test tuple membership in the extensional relation identified by the key, but not enumerate member tuples in general.

      Equivalent to `IInputKey.isEnumerable()`.

    - #### canLeadOutOfScope

          public boolean canLeadOutOfScope​(IInputKey key)

      Description copied from interface: `IQueryMetaContext`
      Tells whether the given `IInputKey` is an edge and may lead out of scope.
      Specified by:
        `canLeadOutOfScope` in interface `IQueryMetaContext`
      Overrides:
        `canLeadOutOfScope` in class `AbstractQueryMetaContext`

    - #### canLeadOutOfScope

          public boolean canLeadOutOfScope​(org.eclipse.emf.ecore.EReference reference)

      Tells whether the given reference may lead out of scope.
      Since:
        2.1

    - #### isStateless

          public boolean isStateless​(IInputKey key)

      Description copied from interface: `IQueryMetaContext`
      Returns true iff the set of instance tuples of the given key is immutable.

      If false, the runtime provides notifications upon change.

    - #### getFunctionalDependencies

          public java.util.Map<java.util.Set<java.lang.Integer>,​java.util.Set<java.lang.Integer>> getFunctionalDependencies​(IInputKey key)

      Description copied from interface: `IQueryMetaContext`
      Returns functional dependencies of the input key expressed in terms of column indices.

      Each entry of the map is a functional dependency rule, where the entry key specifies source columns and the entry value specifies target columns.

    - #### getSourceTypeKey

          public EClassTransitiveInstancesKey getSourceTypeKey​(EStructuralFeatureInstancesKey key)

      Since:
        2.1

    - #### getTargetTypeKey

          public IInputKey getTargetTypeKey​(EStructuralFeatureInstancesKey key)

      Since:
        2.1

    - #### getImplications

          public java.util.Collection<InputKeyImplication> getImplications​(IInputKey implyingKey)

      Description copied from interface: `IQueryMetaContext`
      Returns known direct implications, e.g. edge supertypes, edge opposites, node type constraints, etc.

      Note that for the obvious reasons, enumerable keys can only be implied by enumerable keys.

    - #### getConditionalImplications

          public java.util.Map<InputKeyImplication,​java.util.Set<InputKeyImplication>> getConditionalImplications​(IInputKey implyingKey)

      Description copied from interface: `IQueryMetaContext`
      Returns known "double dispatch" implications, where the given implying key implies other input keys under certain additional conditions (themselves input keys). For example, a "type x, unscoped" input key may imply the "type x, in scope" input key under the condition of the input key "x is in scope"

      Note that for the obvious reasons, enumerable keys can only be implied by enumerable keys (either as the implying key or as the additional condition).

      Note that symmetry is not required, i.e. the additional conditions do not have to list the same conditional implication.

      Specified by:
        `getConditionalImplications` in interface `IQueryMetaContext`
      Overrides:
        `getConditionalImplications` in class `AbstractQueryMetaContext`
      Returns:
        multi-map, where the keys are additional conditions and the values are input key implications jointly implied by the condition and the given implying key.

    - #### getWeakenedAlternatives

          public java.util.Collection<InputKeyImplication> getWeakenedAlternatives​(IInputKey implyingKey)

      Description copied from interface: `IQueryMetaContext`
      Returns a set of implications (weakened alternatives), with a suggestion for the query planner that satisfying them first may help in satisfying the implying key.

      Note that for the obvious reasons, enumerable keys can only be implied by enumerable keys.

      Must follow directly or transitively from implications of `IQueryMetaContext.getImplications(IInputKey)`.

      Specified by:
        `getWeakenedAlternatives` in interface `IQueryMetaContext`
      Overrides:
        `getWeakenedAlternatives` in class `AbstractQueryMetaContext`

    - #### ensureValidKey

          public void ensureValidKey​(IInputKey key)

    - #### illegalInputKey

          public void illegalInputKey​(IInputKey key)

    - #### isFeatureMultiplicityToOne

          public boolean isFeatureMultiplicityToOne​(org.eclipse.emf.ecore.EStructuralFeature feature)

    - #### isFeatureMultiplicityOneTo

          public boolean isFeatureMultiplicityOneTo​(org.eclipse.emf.ecore.EStructuralFeature typeObject)

    - #### isFeatureToOneMultiplicity

          public static boolean isFeatureToOneMultiplicity​(org.eclipse.emf.ecore.EStructuralFeature feature)

      Since:
        2.9

    - #### isFeatureOneToMultiplicity

          public static boolean isFeatureOneToMultiplicity​(org.eclipse.emf.ecore.EStructuralFeature typeObject)

      Since:
        2.9

    - #### featureSourceType

          public org.eclipse.emf.ecore.EClass featureSourceType​(org.eclipse.emf.ecore.EStructuralFeature feature)

    - #### featureTargetType

          public org.eclipse.emf.ecore.EClassifier featureTargetType​(org.eclipse.emf.ecore.EStructuralFeature typeObject)

    - #### featureOpposite

          public org.eclipse.emf.ecore.EReference featureOpposite​(org.eclipse.emf.ecore.EStructuralFeature typeObject)

    - #### getSuggestedEliminationOrdering

          public java.util.Comparator<IInputKey> getSuggestedEliminationOrdering()

      Description copied from interface: `IQueryMetaContext`
      For query normalizing, this is the order suggested for trying to eliminate input keys.
      Specified by:
        `getSuggestedEliminationOrdering` in interface `IQueryMetaContext`
      Overrides:
        `getSuggestedEliminationOrdering` in class `AbstractQueryMetaContext`