|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.bigdata.rdf.sparql.ast.StaticAnalysisBase
public class StaticAnalysisBase
Base class for static analysis.
| Field Summary | |
|---|---|
protected IEvaluationContext |
evaluationContext
|
protected QueryRoot |
queryRoot
|
| Constructor Summary | |
|---|---|
protected |
StaticAnalysisBase(QueryRoot queryRoot,
IEvaluationContext evaluationContext)
|
| Method Summary | |
|---|---|
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. |
boolean |
isFullyBound(FilterNode f,
Set<IVariable<?>> vars)
Return true if the FilterNode is fully bound for the
given variables. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final QueryRoot queryRoot
protected final IEvaluationContext evaluationContext
| Constructor Detail |
|---|
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 ISparqlCache for
named solution sets.| Method Detail |
|---|
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.
op - An operator.varSet - The variables are inserted into this Set.
Set.
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 ISparqlCache.
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 -or- null 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.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||