public class StaticAnalysisBase extends Object
| Modifier and Type | Field and Description |
|---|---|
protected IEvaluationContext |
evaluationContext |
protected QueryRoot |
queryRoot |
| Modifier | Constructor and Description |
|---|---|
protected |
StaticAnalysisBase(QueryRoot queryRoot,
IEvaluationContext evaluationContext) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addAll(Set<IVariable<?>> bindings,
IGroupMemberNode op)
Add all variables spanned by the operator.
|
NamedSubqueryRoot |
getNamedSubqueryRoot(String name)
Return the corresponding
NamedSubqueryRoot. |
QueryRoot |
getQueryRoot()
Return the
QueryRoot parameter given to the constructor. |
protected NamedSubqueryRoot |
getRequiredNamedSubqueryRoot(String name)
Deprecated.
Caller's MUST BE CHANGED to look for both a
NamedSubqueryRoot and an ISolutionSetStats
and then handle these as appropriate. In one case, that means
static analysis of the NamedSubqueryRoot. In the
other, the relevant information are present in pre-computed
metadata on the ISolutionSetStats. |
ISolutionSetStats |
getSolutionSetStats(String name)
Return the
ISolutionSetStats for the named solution set. |
Set<IVariable<?>> |
getSpannedVariables(BOp op,
boolean filters,
Set<IVariable<?>> varSet)
Return the distinct variables in the operator tree.
|
Set<IVariable<?>> |
getSpannedVariables(BOp op,
Set<IVariable<?>> varSet)
Return the distinct variables in the operator tree, including on those on
annotations attached to operators.
|
static Set<IVariable<?>> |
getSPOVariables(StatementPatternNode sp)
Return any variables appearing in the Subject, Predicate, or Object
position (the Context position is ignored).
|
boolean |
isFullyBound(FilterNode f,
Set<IVariable<?>> vars)
Return
true if the FilterNode is fully bound for the
given variables. |
protected final QueryRoot queryRoot
protected final IEvaluationContext evaluationContext
protected StaticAnalysisBase(QueryRoot queryRoot, IEvaluationContext evaluationContext)
queryRoot - The root of the query. We need to have this on hand in order
to resolve NamedSubqueryIncludes during static
analysis.evaluationContext - The evaluation context provides access to the
ISolutionSetStats and the ISolutionSetManager for
named solution sets.public QueryRoot getQueryRoot()
QueryRoot parameter given to the constructor.public Set<IVariable<?>> getSpannedVariables(BOp op, Set<IVariable<?>> varSet)
NamedSubqueryInclude are also reported,
but not those used within the WHERE clause of the corresponding
NamedSubqueryRoot.public Set<IVariable<?>> getSpannedVariables(BOp op, boolean filters, Set<IVariable<?>> varSet)
NamedSubqueryInclude are
also reported, but not those used within the WHERE clause of the
corresponding NamedSubqueryRoot.op - An operator.filters - When true, variables on FilterNodes are
also reported.varSet - The variables are inserted into this Set.Set.
TODO Unit tests for different kinds of AST nodes to make sure
that we always get/ignore the variables in filters as appropriate.
For example, an optional StatementPatternNode can have
filter nodes attached.protected NamedSubqueryRoot getRequiredNamedSubqueryRoot(String name)
NamedSubqueryRoot and an ISolutionSetStats
and then handle these as appropriate. In one case, that means
static analysis of the NamedSubqueryRoot. In the
other, the relevant information are present in pre-computed
metadata on the ISolutionSetStats.NamedSubqueryRoot.name - The name of the solution set.NamedSubqueryRoot and never null.RuntimeException - if no NamedSubqueryRoot was found for the named set
associated with this NamedSubqueryInclude.public NamedSubqueryRoot getNamedSubqueryRoot(String name)
NamedSubqueryRoot.
Note: You can not resolve pre-existing named solution sets with this
method, only those which are defined within the scope of a query by a
NamedSubqueryRoot.
Note: Typically, callers MUST look for both a NamedSubqueryRoot
and an ISolutionSetStats and then handle these as appropriate. In
one case, that means static analysis of the NamedSubqueryRoot. In
the other, the relevant information are present in pre-computed metadata
on the ISolutionSetStats.
name - The name of the solution set.NamedSubqueryRoot -or- null if none was
found.getSolutionSetStats(String)public ISolutionSetStats getSolutionSetStats(String name)
ISolutionSetStats for the named solution set.
Note: This does NOT report on NamedSubqueryRoots for the query.
It only checks the ISolutionSetManager.
Note: Typically, callers MUST look for both a NamedSubqueryRoot
and an ISolutionSetStats and then handle these as appropriate. In
one case, that means static analysis of the NamedSubqueryRoot. In
the other, the relevant information are present in pre-computed metadata
on the ISolutionSetStats.
name - The name of the solution set.ISolutionSetStats and never null.RuntimeException - if there is no such pre-existing named solution set.getNamedSubqueryRoot(String)protected void addAll(Set<IVariable<?>> bindings, IGroupMemberNode op)
WARNING: This method does not consider the variable
scoping rules. It is safe to use with a FILTER as all variables will be
in scope, but it is not safe to use with a SubqueryBase as only
the projected variables will be in scope.
bindings - The set to which the variables will be added.op - The operator.public boolean isFullyBound(FilterNode f, Set<IVariable<?>> vars)
true if the FilterNode is fully bound for the
given variables.f - The FilterNodevars - Some collection of variables which are known to be bound.true if all variables on which the filter depends
are present in that collection.public static Set<IVariable<?>> getSPOVariables(StatementPatternNode sp)
sp - The statement pattern.Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.