Package tools.refinery.interpreter.api
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 Summary
Modifier and TypeMethodDescriptionReturns the definition of the query in a format intended for consumption by the query evaluator.getMatcher
(InterpreterEngine engine) Initializes the pattern matcher within an existingInterpreterEngine
.Returns a list describing the problems that were found in this query.Class
<? extends QueryScope> The query is formulated over this kind of modeling platform.default PQuery.PQueryStatus
Returns the initialization status of the query specificationCreates a new uninitialized matcher, which is not functional until an engine initializes it.Returns an empty, mutable Match compatible with matchers of this query.Returns a new (partial) Match object compatible with matchers of this query.Methods inherited from interface tools.refinery.interpreter.matchers.psystem.queries.PQueryHeader
getAllAnnotations, getAnnotationsByName, getFirstAnnotationByName, getFullyQualifiedName, getParameter, getParameterNames, getParameters, getPositionOfParameter, getSimpleName, getVisibility
-
Method Details
-
getMatcher
Initializes the pattern matcher within an existingInterpreterEngine
. 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
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, theinvalid reference
EMFScope
-
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.
-
getStatus
Returns the initialization status of the query specification- Since:
- 2.9
- See Also:
-
getPProblems
Returns a list describing the problems that were found in this query.- Returns:
- a non-null, but possibly empty list of problems
- Since:
- 2.9
- See Also:
-
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 theInterpreterEngine
instance to instantiate matchers.- Throws:
InterpreterRuntimeException
- Since:
- 1.4
-