Package org.eclipse.viatra.query.runtime.api

## Interface IRunOnceQueryEngine

- All Known Implementing Classes:
    `RunOnceQueryEngine`

      public interface IRunOnceQueryEngine

  A run-once query engine is used to get matches for queries without incremental support. Users can create a query engine with a given `Notifier` as scope and use a query specification to retrieve the current match set with this scope (see `getAllMatches(org.eclipse.viatra.query.runtime.api.IQuerySpecification<? extends org.eclipse.viatra.query.runtime.api.ViatraQueryMatcher<Match>>)`).

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `<Match extends IPatternMatch> java.util.Collection<Match>` | `getAllMatches​(IQuerySpecification<? extends ViatraQueryMatcher<Match>> querySpecification)` | Returns the set of all matches for the given query in the scope of the engine.
    `BaseIndexOptions` | `getBaseIndexOptions()` | The base index options specifies how the base index is built, including wildcard mode (defaults to false) and dynamic EMF mode (defaults to false).
    `org.eclipse.emf.common.notify.Notifier` | `getScope()` |
    `void` | `resampleOnNextCall()` | If automatic resampling is enabled and the value of derived features may change without model modifications, calling this method will make sure that re-sampling will occur before returning match results.
    `void` | `setAutomaticResampling​(boolean automaticResampling)` | When set to true, the run-once query engine will not dispose it's engine and will resample the values of derived features before returning matches if the model changed since the last call.

- - ### Method Detail

    - #### getAllMatches

          <Match extends IPatternMatch> java.util.Collection<Match> getAllMatches​(IQuerySpecification<? extends ViatraQueryMatcher<Match>> querySpecification)

      Returns the set of all matches for the given query in the scope of the engine.
      Parameters:
        `querySpecification` - the query that is evaluated
      Returns:
        matches represented as a Match object.

    - #### getScope

          org.eclipse.emf.common.notify.Notifier getScope()

      Returns:
        the scope of pattern matching, i.e. the root of the EMF model tree that this engine is attached to.

    - #### getBaseIndexOptions

          BaseIndexOptions getBaseIndexOptions()

      The base index options specifies how the base index is built, including wildcard mode (defaults to false) and dynamic EMF mode (defaults to false). See `NavigationHelper` for the explanation of wildcard mode and dynamic EMF mode.

      The returned options can be modified in order to affect subsequent calls of `getAllMatches(org.eclipse.viatra.query.runtime.api.IQuerySpecification<? extends org.eclipse.viatra.query.runtime.api.ViatraQueryMatcher<Match>>)`.
      Returns:
        the base index options used by the engine.

    - #### setAutomaticResampling

          void setAutomaticResampling​(boolean automaticResampling)

      When set to true, the run-once query engine will not dispose it's engine and will resample the values of derived features before returning matches if the model changed since the last call. If the values of derived features may change without any model modification, call `resampleOnNextCall()` before subsequent calls of `getAllMatches(org.eclipse.viatra.query.runtime.api.IQuerySpecification<? extends org.eclipse.viatra.query.runtime.api.ViatraQueryMatcher<Match>>)`.
      Parameters:
        `automaticResampling` -

    - #### resampleOnNextCall

          void resampleOnNextCall()

      If automatic resampling is enabled and the value of derived features may change without model modifications, calling this method will make sure that re-sampling will occur before returning match results.