public abstract class AbstractOptimizerTestCase.Helper extends Object
TestASTStaticJoinOptimizer.test_simpleOptional01A()
is based on
the comments of
TestASTStaticJoinOptimizer.test_simpleOptional01()
and
demonstrates that the comment is out of date.
NB: Given this goal, several Java naming conventions are ignored. e.g. methods whose names are ALLCAPS or the same as ClassNames
Also, note that the intent is that this class be used in
anonymous subclasses with a single invocation of the test()
method,
and the two fields given
and expected
initialized
in the subclasses constructor (i.e. inside a second pair of braces).
All of the protected members are wrappers around constructors, to allow the initialization of these two fields, to have a style much more like Prolog than Java.
Modifier and Type | Class and Description |
---|---|
protected class |
AbstractOptimizerTestCase.Helper.StatementPatternProperty
Wrapper for the annotation property name-value.
|
Modifier and Type | Field and Description |
---|---|
protected IV |
a
Constants ...
|
protected IV |
b
Constants ...
|
protected IV |
c
Constants ...
|
protected IV |
d
Constants ...
|
protected IV |
e
Constants ...
|
protected QueryRoot |
expected
The expected AST output from the
IASTOptimizer . |
protected IV |
f
Constants ...
|
protected IV |
g
Constants ...
|
protected QueryRoot |
given
The given AST is the input to the
IASTOptimizer . |
protected IV |
h
Constants ...
|
protected String |
o
Variables
|
protected String |
p
Variables
|
protected String |
s
Variables
|
protected ASTBase |
tmp
Field for construction of arbitrary AST nodes.
|
protected String |
w
Variables
|
protected String |
x
Variables
|
protected String |
y
Variables
|
protected String |
z
Variables
|
Constructor and Description |
---|
AbstractOptimizerTestCase.Helper() |
Modifier and Type | Method and Description |
---|---|
protected <T extends ASTBase> |
applyAnnotations(T target,
AbstractOptimizerTestCase.ApplyAnnotation... annotations) |
protected ArbitraryLengthPathNode |
arbitartyLengthPropertyPath(TermNode left,
TermNode right,
com.bigdata.rdf.sparql.ast.optimizers.AbstractOptimizerTestCase.HelperFlag card,
JoinGroupNode joinGroupNode) |
protected SubqueryRoot |
ask(VarNode varNode,
JoinGroupNode where)
Return an ASK subquery.
|
protected AssignmentNode |
bind(IValueExpressionNode valueNode,
VarNode varNode)
BIND(expression AS variable) |
protected FunctionNode |
bound(VarNode varNode) |
protected TermNode |
constantNode(IV iv) |
protected TermNode |
constantNode(String c) |
protected AbstractOptimizerTestCase.ApplyAnnotation |
dependsOn(String... dependsOn) |
protected ExistsNode |
exists(VarNode v,
GraphPatternGroup<IGroupMemberNode> jg) |
protected FilterNode |
filter(IValueExpressionNode f) |
protected IValueExpressionNode |
functionNode(String uri,
ValueExpressionNode... args)
Return a
FunctionNode |
protected IValueExpressionNode |
functionNode(org.openrdf.model.URI uri,
ValueExpressionNode... args)
Return a
FunctionNode |
protected ASTBase |
getTmp() |
protected JoinGroupNode |
joinGroupNode(Object... statements)
Wrap the arguments in a
JoinGroupNode and apply any
inter-mixed HelperFlag s. |
protected JoinGroupNode |
joinGroupNode(TermNode context,
Object... statements)
Return a graph join group.
|
protected AbstractOptimizerTestCase.ApplyAnnotation |
joinOn(VarNode... joinVars) |
protected FunctionNode |
knownUnbound(VarNode varNode) |
protected VarNode |
leftVar() |
protected NamedSubqueryRoot |
namedSubQuery(String name,
VarNode varNode,
JoinGroupNode where,
AbstractOptimizerTestCase.ApplyAnnotation... annotations)
Return a named subquery.
|
protected GroupMemberNodeBase |
namedSubQueryInclude(String name,
AbstractOptimizerTestCase.ApplyAnnotation... annotations) |
protected NotExistsNode |
notExists(VarNode v,
GraphPatternGroup<IGroupMemberNode> jg) |
protected FunctionNode |
or(ValueExpressionNode v1,
ValueExpressionNode v2)
Logical OR of two value expressions.
|
protected PathNode |
pathNode(String pattern)
This method is only implemented in part.
|
protected ProjectionNode |
projection(AssignmentNode... assignmentNodes)
Return a PROJECTION node.
|
protected ProjectionNode |
projection(VarNode... varNodes)
Return a PROJECTION node.
|
protected AbstractOptimizerTestCase.Helper.StatementPatternProperty |
property(String name,
Object value) |
protected PropertyPathNode |
propertyPathNode(TermNode s,
String pattern,
TermNode o) |
protected PropertyPathUnionNode |
propertyPathUnionNode(Object... statements) |
protected VarNode |
rightVar() |
protected QueryRoot |
select(ProjectionNode projection,
JoinGroupNode where,
com.bigdata.rdf.sparql.ast.optimizers.AbstractOptimizerTestCase.HelperFlag... flags) |
protected QueryRoot |
select(VarNode[] varNodes,
JoinGroupNode where,
com.bigdata.rdf.sparql.ast.optimizers.AbstractOptimizerTestCase.HelperFlag... flags) |
protected QueryRoot |
select(VarNode[] varNodes,
NamedSubqueryRoot namedSubQuery,
JoinGroupNode where,
com.bigdata.rdf.sparql.ast.optimizers.AbstractOptimizerTestCase.HelperFlag... flags)
Create a top-level SELECT query.
|
protected QueryRoot |
select(VarNode varNode,
JoinGroupNode where,
com.bigdata.rdf.sparql.ast.optimizers.AbstractOptimizerTestCase.HelperFlag... flags) |
protected QueryRoot |
select(VarNode varNode,
NamedSubqueryRoot namedSubQuery,
JoinGroupNode where,
com.bigdata.rdf.sparql.ast.optimizers.AbstractOptimizerTestCase.HelperFlag... flags) |
protected SubqueryRoot |
selectSubQuery(ProjectionNode projection,
JoinGroupNode where,
com.bigdata.rdf.sparql.ast.optimizers.AbstractOptimizerTestCase.HelperFlag... flags) |
protected ServiceNode |
service(TermNode serviceRef,
GraphPatternGroup<IGroupMemberNode> groupNode) |
protected AbstractOptimizerTestCase.ApplyAnnotation |
slice(long offset,
long limit) |
protected StatementPatternNode |
statementPatternNode(TermNode s,
TermNode p,
TermNode o,
Object... more)
Create a statement pattern node.
|
void |
test()
|
void |
testWhileIgnoringExplainHints()
|
protected IConstant<? extends IV> |
toValueExpression(ConstantNode v) |
protected IVariable<? extends IV> |
toValueExpression(VarNode v) |
protected UnionNode |
unionNode(Object... statements) |
protected VarNode |
varNode(String varName) |
protected VarNode[] |
varNodes(String... names) |
protected JoinGroupNode |
where(IGroupMemberNode... statements)
Wrap the triple patterns in a WHERE clause (aka join group).
|
protected VarNode |
wildcard() |
protected QueryRoot given
IASTOptimizer
.protected QueryRoot expected
IASTOptimizer
.protected ASTBase tmp
protected final String w
protected final String x
protected final String y
protected final String z
protected final String s
protected final String p
protected final String o
protected final IV a
protected final IV b
protected final IV c
protected final IV d
protected final IV e
protected final IV f
protected final IV g
protected final IV h
public void test()
public void testWhileIgnoringExplainHints()
given
AST by
the IASTOptimizer
with the expected
AST. Thereby,
explain hints attached to the computed AST are ignored when comparing
the ASTs.protected VarNode wildcard()
protected QueryRoot select(VarNode[] varNodes, NamedSubqueryRoot namedSubQuery, JoinGroupNode where, com.bigdata.rdf.sparql.ast.optimizers.AbstractOptimizerTestCase.HelperFlag... flags)
varNodes
- The projected variables.namedSubQuery
- A named subquery that is declared to that top-level query.where
- The WHERE clause of the top-level query.flags
- The flags to be applied to the resulting AST.protected QueryRoot select(VarNode[] varNodes, JoinGroupNode where, com.bigdata.rdf.sparql.ast.optimizers.AbstractOptimizerTestCase.HelperFlag... flags)
varNodes
- The variables that will appear in the projection.where
- The top-level WHERE clause.flags
- Zero or more flags that are applied to the operations.QueryRoot
.protected ProjectionNode projection(VarNode... varNodes)
varNodes
- The variables that will appear in the projection.protected ProjectionNode projection(AssignmentNode... assignmentNodes)
assignmentNodes
- The BIND()s that will appear in the projection.protected QueryRoot select(ProjectionNode projection, JoinGroupNode where, com.bigdata.rdf.sparql.ast.optimizers.AbstractOptimizerTestCase.HelperFlag... flags)
projection
- The projection.where
- The top-level WHERE clause.flags
- Zero or more flags that are applied to the operations.QueryRoot
.protected QueryRoot select(VarNode varNode, NamedSubqueryRoot namedSubQuery, JoinGroupNode where, com.bigdata.rdf.sparql.ast.optimizers.AbstractOptimizerTestCase.HelperFlag... flags)
protected QueryRoot select(VarNode varNode, JoinGroupNode where, com.bigdata.rdf.sparql.ast.optimizers.AbstractOptimizerTestCase.HelperFlag... flags)
protected SubqueryRoot selectSubQuery(ProjectionNode projection, JoinGroupNode where, com.bigdata.rdf.sparql.ast.optimizers.AbstractOptimizerTestCase.HelperFlag... flags)
protected SubqueryRoot ask(VarNode varNode, JoinGroupNode where)
varNode
- The "ASK" variable. See
SubqueryRoot.Annotations#ASK_VAR
.where
- The WHERE clause.protected NamedSubqueryRoot namedSubQuery(String name, VarNode varNode, JoinGroupNode where, AbstractOptimizerTestCase.ApplyAnnotation... annotations)
name
- The name associated with the named subquery result.varNode
- The projected variable.where
- The where clause.protected GroupMemberNodeBase namedSubQueryInclude(String name, AbstractOptimizerTestCase.ApplyAnnotation... annotations)
protected <T extends ASTBase> T applyAnnotations(T target, AbstractOptimizerTestCase.ApplyAnnotation... annotations)
protected VarNode leftVar()
protected VarNode rightVar()
protected ArbitraryLengthPathNode arbitartyLengthPropertyPath(TermNode left, TermNode right, com.bigdata.rdf.sparql.ast.optimizers.AbstractOptimizerTestCase.HelperFlag card, JoinGroupNode joinGroupNode)
protected PropertyPathNode propertyPathNode(TermNode s, String pattern, TermNode o)
protected PathNode pathNode(String pattern)
pattern
- protected AbstractOptimizerTestCase.Helper.StatementPatternProperty property(String name, Object value)
protected StatementPatternNode statementPatternNode(TermNode s, TermNode p, TermNode o, Object... more)
s
- p
- o
- more
- protected JoinGroupNode joinGroupNode(TermNode context, Object... statements)
context
- The graph (named graph variable or IRI).statements
- The children (including any optional HelperFlag
s).protected JoinGroupNode joinGroupNode(Object... statements)
JoinGroupNode
and apply any
inter-mixed HelperFlag
s.statements
- The arguments (group group members or HelperFlag
s)JoinGroupNode
.protected JoinGroupNode where(IGroupMemberNode... statements)
statements
- The triple patterns.JoinGroupNode
protected PropertyPathUnionNode propertyPathUnionNode(Object... statements)
protected FunctionNode bound(VarNode varNode)
protected FunctionNode knownUnbound(VarNode varNode)
protected FilterNode filter(IValueExpressionNode f)
protected IValueExpressionNode functionNode(String uri, ValueExpressionNode... args)
FunctionNode
uri
- the function URI. see FunctionRegistry
args
- the arguments to the function.protected IValueExpressionNode functionNode(org.openrdf.model.URI uri, ValueExpressionNode... args)
FunctionNode
uri
- the function URI. see FunctionRegistry
args
- the arguments to the function.protected ServiceNode service(TermNode serviceRef, GraphPatternGroup<IGroupMemberNode> groupNode)
protected AssignmentNode bind(IValueExpressionNode valueNode, VarNode varNode)
BIND(expression AS variable)
valueNode
- The expressionvarNode
- The variable.protected FunctionNode or(ValueExpressionNode v1, ValueExpressionNode v2)
protected ExistsNode exists(VarNode v, GraphPatternGroup<IGroupMemberNode> jg)
protected IConstant<? extends IV> toValueExpression(ConstantNode v)
protected NotExistsNode notExists(VarNode v, GraphPatternGroup<IGroupMemberNode> jg)
protected ASTBase getTmp()
protected AbstractOptimizerTestCase.ApplyAnnotation joinOn(VarNode... joinVars)
protected AbstractOptimizerTestCase.ApplyAnnotation dependsOn(String... dependsOn)
protected AbstractOptimizerTestCase.ApplyAnnotation slice(long offset, long limit)
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.