Interface PQuery
- All Superinterfaces:
PQueryHeader
,PTraceable
- All Known Subinterfaces:
InitializablePQuery
- All Known Implementing Classes:
BasePQuery
IQueryBackend
).
End-users of Refinery Intepreter should access a query as an IQuerySpecification instead.
PQuerys are definitions of queries usable inside pattern descriptions. Such description always has (a non-null) name. The query
itself is defined as a (non-empty) set of PBody
instances, the result is the disjunction of the single
PBody
instances.
A PQuery might be constructed from erroneous patterns or might be uninitialized - this is represented by its status.
- Since:
- 0.8.0
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionvoid
Before a modification operation is executed, a mutability check is performed (via thegetStatus()
implementation, and in case of problems anIllegalStateException
is thrown.void
If the query definition is uninitialized, initializes it.Returns all queries required to evaluate this query (transitively).Returns all queries directly referred in the constraints.Returns all bodies associated with the query in their canonical form.Optional hints regarding the query evaluation strategy, to be interpreted by the query engine.Returns a list describing the problems that were found in this query.Returns the initialization status of the definitionType information, expressed on query parameters, that all matches of the query are guaranteed to respect.boolean
An option to check mutability of the query.Returns the end-user query specification API objects that wrap 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
-
getDisjunctBodies
PDisjunction getDisjunctBodies()Returns all bodies associated with the query in their canonical form. If called multiple times, the same set with the same contents will be returned. -
getDirectReferredQueries
Returns all queries directly referred in the constraints. They are all required to evaluate this query- Returns:
- a non-null, but possibly empty list of query definitions
-
getAllReferredQueries
Returns all queries required to evaluate this query (transitively).- Returns:
- a non-null, but possibly empty list of query definitions
-
getStatus
PQuery.PQueryStatus getStatus()Returns the initialization status of the definition -
getPProblems
Returns a list describing the problems that were found in this query.TODO: formulate invariant connecting
getPProblems()
andgetStatus()
.- Returns:
- a non-null, but possibly empty list of problems
-
checkMutability
void checkMutability()Before a modification operation is executed, a mutability check is performed (via thegetStatus()
implementation, and in case of problems anIllegalStateException
is thrown. -
isMutable
boolean isMutable()An option to check mutability of the query. It can be used to avoid getting anIllegalStateException
by the execution ofcheckMutability()
.- Returns:
- true if the query specification is still editable
-
getEvaluationHints
QueryEvaluationHint getEvaluationHints()Optional hints regarding the query evaluation strategy, to be interpreted by the query engine.To ensure the possibility of external overrides, the evaluation engine should not directly consult this field, but use an
IQueryBackendHintProvider
instead. -
getTypeGuarantees
Set<TypeJudgement> getTypeGuarantees()Type information, expressed on query parameters, that all matches of the query are guaranteed to respect.At the very minimum, this should include the declared types of the parameters.
The type judgement tuples shall contain the parameter index, NOT the
PParameter
object.- Returns:
- a non-null set of type judgements that the query guarantees for its matches
-
ensureInitialized
void ensureInitialized()If the query definition is uninitialized, initializes it.- Throws:
InterpreterRuntimeException
- if initialization of query specification fails
-
publishedAs
Returns the end-user query specification API objects that wrap this query.Intended for traceability and debug purposes, not part of normal operation. Returned list is intended to be appended during query specification construction time.
- Returns:
- a non-null, but possibly empty list of query specification objects;
-