Class BuildHelper
java.lang.Object
tools.refinery.interpreter.matchers.planning.helpers.BuildHelper
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
areAllVariablesDetermined
(SubPlan plan, Collection<PVariable> determining, QueryAnalyzer analyzer, boolean strict) static boolean
areVariablesDetermined
(SubPlan plan, Collection<PVariable> determining, Collection<PVariable> determined, QueryAnalyzer analyzer, boolean strict) static SubPlan
Skips the last few steps, if any, that are projections, so that a custom projection can be added instead.static void
finalCheck
(PBody pSystem, SubPlan plan, IQueryMetaContext context) Verifies whether all constraints are enforced and exported parameters are present.static PConstraint
getAnyUnenforcedConstraint
(PBody pSystem, SubPlan plan) Finds an arbitrary constraint that is not enforced at the given plan.static SubPlan
trimUnneccessaryVariables
(SubPlanFactory planFactory, SubPlan plan, boolean onlyIfNotDetermined, QueryAnalyzer analyzer) Reduces the number of tuples by trimming (existentially quantifying) the set of variables that are visible in the subplan, are not exported parameters, have all their constraints already enforced in the subplan, and thus will not be needed anymore.
-
Method Details
-
trimUnneccessaryVariables
public static SubPlan trimUnneccessaryVariables(SubPlanFactory planFactory, SubPlan plan, boolean onlyIfNotDetermined, QueryAnalyzer analyzer) Reduces the number of tuples by trimming (existentially quantifying) the set of variables that- are visible in the subplan,
- are not exported parameters,
- have all their constraints already enforced in the subplan,
- Parameters:
onlyIfNotDetermined
- if true, no trimming performed unless there is at least one variable that is not functionally determined- Returns:
- the plan after the trimming (possibly the original)
- Since:
- 1.5
-
areAllVariablesDetermined
public static boolean areAllVariablesDetermined(SubPlan plan, Collection<PVariable> determining, QueryAnalyzer analyzer, boolean strict) - Parameters:
strict
- if true, only "hard" dependencies are taken into account that are strictly enforced by the model representation; if false, user-provided soft dependencies are included as well, that are anticipated but not guaranteed by the storage mechanism; use true if superfluous dependencies may taint the correctness of a computation, false if they would merely impact performance- Returns:
- true iff a set of given variables functionally determine all visible variables in the subplan according to the subplan's constraints
- Since:
- 1.5
-
areVariablesDetermined
public static boolean areVariablesDetermined(SubPlan plan, Collection<PVariable> determining, Collection<PVariable> determined, QueryAnalyzer analyzer, boolean strict) - Parameters:
strict
- if true, only "hard" dependencies are taken into account that are strictly enforced by the model representation; if false, user-provided soft dependencies are included as well, that are anticipated but not guaranteed by the storage mechanism; use true if superfluous dependencies may taint the correctness of a computation, false if they would merely impact performance- Returns:
- true iff one set of given variables functionally determine the other set according to the subplan's constraints
- Since:
- 1.5
-
getAnyUnenforcedConstraint
Finds an arbitrary constraint that is not enforced at the given plan.- Parameters:
pSystem
-plan
-- Returns:
- a PConstraint that is not enforced, if any, or null if all are enforced
-
eliminateTrailingProjections
Skips the last few steps, if any, that are projections, so that a custom projection can be added instead. Useful for connecting body final plans into the production node.- Since:
- 2.1
-
finalCheck
Verifies whether all constraints are enforced and exported parameters are present.- Parameters:
pSystem
-plan
-- Throws:
InterpreterRuntimeException
-