Interface IQuerySpecification<Matcher extends InterpreterMatcher<? extends IPatternMatch>>

All Superinterfaces:
PQueryHeader
All Known Implementing Classes:
BaseQuerySpecification, GenericQuerySpecification

public interface IQuerySpecification<Matcher extends InterpreterMatcher<? extends IPatternMatch>> extends PQueryHeader
API interface for a Refinery Interpreter query specification. Each query is associated with a pattern. Methods instantiate a matcher of the pattern with various parameters.

As of 0.9.0, some internal details (mostly relevant for query evaluator backends) have been moved to getInternalQueryRepresentation().

  • Method Details

    • getMatcher

      Matcher getMatcher(InterpreterEngine engine)
      Initializes the pattern matcher within an existing InterpreterEngine. If the pattern matcher is already constructed in the engine, only a lightweight reference is created.

      The match set will be incrementally refreshed upon updates.

      Parameters:
      engine - the existing Refinery Interpreter engine in which this matcher will be created.
      Throws:
      InterpreterRuntimeException - if an error occurs during pattern matcher creation
    • newEmptyMatch

      IPatternMatch newEmptyMatch()
      Returns an empty, mutable Match compatible with matchers of this query. Fields of the mutable match can be filled to create a partial match, usable as matcher input. This can be used to call the matcher with a partial match even if the specific class of the matcher or the match is unknown.
      Returns:
      the empty match
    • newMatch

      IPatternMatch newMatch(Object... parameters)
      Returns a new (partial) Match object compatible with matchers of this query. This can be used e.g. to call the matcher with a partial match.

      The returned match will be immutable. Use newEmptyMatch() to obtain a mutable match object.

      Parameters:
      parameters - the fixed value of pattern parameters, or null if not bound.
      Returns:
      the (partial) match object.
    • getPreferredScopeClass

      Class<? extends QueryScope> getPreferredScopeClass()
      The query is formulated over this kind of modeling platform. E.g. for queries over EMF models, the
      invalid reference
      EMFScope
      class is returned.
    • getInternalQueryRepresentation

      PQuery getInternalQueryRepresentation()
      Returns the definition of the query in a format intended for consumption by the query evaluator.
      Returns:
      the internal representation of the query.
    • instantiate

      Matcher instantiate()
      Creates a new uninitialized matcher, which is not functional until an engine initializes it. Clients should not call this method, it is used by the InterpreterEngine instance to instantiate matchers.
      Throws:
      InterpreterRuntimeException
      Since:
      1.4