Class GenericQuerySpecification<Matcher extends GenericPatternMatcher>
- java.lang.Object
-
- org.eclipse.viatra.query.runtime.api.impl.BaseQuerySpecification<Matcher>
-
- org.eclipse.viatra.query.runtime.api.GenericQuerySpecification<Matcher>
-
- All Implemented Interfaces:
IQuerySpecification<Matcher>
,PQueryHeader
- Direct Known Subclasses:
BaseGeneratedEMFQuerySpecificationWithGenericMatcher
,GenericQuerySpecification
public abstract class GenericQuerySpecification<Matcher extends GenericPatternMatcher> extends BaseQuerySpecification<Matcher>
This is a generic query specification for VIATRA pattern matchers, for "interpretative" query execution. Should be subclassed by query specification implementations specific to query languages.When available, consider using the pattern-specific generated matcher API instead.
The created matcher will be of type
GenericPatternMatcher
. Matches of the pattern will be represented asGenericPatternMatch
.Note for overriding (if you have your own query language or ): Derived classes should use
defaultInstantiate(ViatraQueryEngine)
for implementingBaseQuerySpecification.instantiate(ViatraQueryEngine)
if they useGenericPatternMatcher
proper.- Since:
- 0.9
- See Also:
GenericPatternMatcher
,GenericPatternMatch
,GenericMatchProcessor
- No Instantiate:
- This class is not intended to be instantiated by end-users.
-
-
Field Summary
-
Fields inherited from class org.eclipse.viatra.query.runtime.api.impl.BaseQuerySpecification
wrappedPQuery
-
-
Constructor Summary
Constructors Constructor Description GenericQuerySpecification(PQuery wrappedPQuery)
Instantiates query specification for the given internal query representation.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected GenericPatternMatcher
defaultInstantiate(ViatraQueryEngine engine)
Derived classes should use this implementation ofBaseQuerySpecification.instantiate(ViatraQueryEngine)
if they useGenericPatternMatcher
proper.PVisibility
getVisibility()
Returns the visibility information about the query.GenericPatternMatch
newEmptyMatch()
Returns an empty, mutable Match compatible with matchers of this query.GenericPatternMatch
newMatch(java.lang.Object... parameters)
Returns a new (partial) Match object compatible with matchers of this query.-
Methods inherited from class org.eclipse.viatra.query.runtime.api.impl.BaseQuerySpecification
ensureInitializedInternal, getAllAnnotations, getAnnotationsByName, getFirstAnnotationByName, getFullyQualifiedName, getInternalQueryRepresentation, getMatcher, getParameterNames, getParameters, getPositionOfParameter, instantiate, instantiate, processInitializerError
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.eclipse.viatra.query.runtime.api.IQuerySpecification
getPProblems, getPreferredScopeClass, getStatus
-
Methods inherited from interface org.eclipse.viatra.query.runtime.matchers.psystem.queries.PQueryHeader
getParameter, getSimpleName
-
-
-
-
Constructor Detail
-
GenericQuerySpecification
public GenericQuerySpecification(PQuery wrappedPQuery)
Instantiates query specification for the given internal query representation.
-
-
Method Detail
-
newEmptyMatch
public GenericPatternMatch newEmptyMatch()
Description copied from interface:IQuerySpecification
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
public GenericPatternMatch newMatch(java.lang.Object... parameters)
Description copied from interface:IQuerySpecification
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
IQuerySpecification.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.
-
defaultInstantiate
protected GenericPatternMatcher defaultInstantiate(ViatraQueryEngine engine)
Derived classes should use this implementation ofBaseQuerySpecification.instantiate(ViatraQueryEngine)
if they useGenericPatternMatcher
proper.- Throws:
ViatraQueryRuntimeException
-
getVisibility
public PVisibility getVisibility()
Description copied from interface:PQueryHeader
Returns the visibility information about the query.- Specified by:
getVisibility
in interfacePQueryHeader
- Overrides:
getVisibility
in classBaseQuerySpecification<Matcher extends GenericPatternMatcher>
- Since:
- 2.0
-
-