Class CheckStatementPattern
- java.lang.Object
-
- org.eclipse.rdf4j.federated.algebra.CheckStatementPattern
-
- All Implemented Interfaces:
Serializable
,Cloneable
,BoundJoinTupleExpr
,FedXTupleExpr
,QueryRef
,StatementTupleExpr
,VariableExpr
,QueryModelNode
,TupleExpr
public class CheckStatementPattern extends Object implements StatementTupleExpr, BoundJoinTupleExpr
A statement pattern with no free variables when provided with some particular BindingSet in evaluate. For evaluation a boolean ASK query is performed. Wraps a StatementTupleExpr- Author:
- Andreas Schwarte
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description CheckStatementPattern(StatementTupleExpr stmt, QueryInfo queryInfo)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CheckStatementPattern
clone()
Returns a (deep) clone of this query model node.CloseableIteration<BindingSet,QueryEvaluationException>
evaluate(BindingSet bindings)
Evaluate this expression using the provided bindingsSet<String>
getAssuredBindingNames()
Gets the names of the bindings that are guaranteed to be present in the results produced by this tuple expression.Set<String>
getBindingNames()
Gets the names of the bindings that are, or can be, returned by this tuple expression when it is evaluated.double
getCostEstimate()
int
getFreeVarCount()
List<String>
getFreeVars()
String
getId()
QueryModelNode
getParentNode()
Gets the node's parent.QueryInfo
getQueryInfo()
Retrieve the attached query information of the tuple expressionlong
getResultSizeActual()
double
getResultSizeEstimate()
Returns the number of tuples that this QueryNode predicts will be outputted.String
getSignature()
Returns the signature of this query model node.StatementPattern
getStatementPattern()
List<StatementSource>
getStatementSources()
long
getTotalTimeNanosActual()
boolean
hasFreeVarsFor(BindingSet binding)
returns true iff this statement has free variables in the presence of the specified binding setvoid
replaceChildNode(QueryModelNode current, QueryModelNode replacement)
Replaces one of the child nodes with a new node.void
replaceWith(QueryModelNode replacement)
Substitutes this node with a new node in the query model tree.void
setCostEstimate(double costEstimate)
void
setParentNode(QueryModelNode parent)
Sets the node's parent.void
setResultSizeActual(long resultSizeActual)
void
setResultSizeEstimate(double resultSizeEstimate)
void
setTotalTimeNanosActual(long totalTimeNanosActual)
<X extends Exception>
voidvisit(QueryModelVisitor<X> visitor)
Visits this node.<X extends Exception>
voidvisitChildren(QueryModelVisitor<X> visitor)
Visits the children of this node.-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.eclipse.rdf4j.query.algebra.QueryModelNode
equals, toString
-
-
-
-
Field Detail
-
stmt
protected final StatementTupleExpr stmt
-
id
protected final String id
-
queryInfo
protected final QueryInfo queryInfo
-
-
Constructor Detail
-
CheckStatementPattern
public CheckStatementPattern(StatementTupleExpr stmt, QueryInfo queryInfo)
-
-
Method Detail
-
getStatementPattern
public StatementPattern getStatementPattern()
-
getFreeVarCount
public int getFreeVarCount()
- Specified by:
getFreeVarCount
in interfaceFedXTupleExpr
- Returns:
- the number of free (i.e. unbound) variables in this expression
-
getFreeVars
public List<String> getFreeVars()
- Specified by:
getFreeVars
in interfaceVariableExpr
- Returns:
- a list of free (i.e. unbound) variables in this expression
-
getId
public String getId()
- Specified by:
getId
in interfaceStatementTupleExpr
- Returns:
- the id of this expr
-
getStatementSources
public List<StatementSource> getStatementSources()
- Specified by:
getStatementSources
in interfaceStatementTupleExpr
- Returns:
- a list of sources that are relevant for evaluation of this expression
-
hasFreeVarsFor
public boolean hasFreeVarsFor(BindingSet binding)
Description copied from interface:StatementTupleExpr
returns true iff this statement has free variables in the presence of the specified binding set- Specified by:
hasFreeVarsFor
in interfaceStatementTupleExpr
- Returns:
- whether the statement has free vars
-
getAssuredBindingNames
public Set<String> getAssuredBindingNames()
Description copied from interface:TupleExpr
Gets the names of the bindings that are guaranteed to be present in the results produced by this tuple expression.- Specified by:
getAssuredBindingNames
in interfaceTupleExpr
- Returns:
- A set of binding names.
-
getBindingNames
public Set<String> getBindingNames()
Description copied from interface:TupleExpr
Gets the names of the bindings that are, or can be, returned by this tuple expression when it is evaluated.- Specified by:
getBindingNames
in interfaceTupleExpr
- Returns:
- A set of binding names.
-
getParentNode
public QueryModelNode getParentNode()
Description copied from interface:QueryModelNode
Gets the node's parent.- Specified by:
getParentNode
in interfaceQueryModelNode
- Returns:
- The parent node, if any.
-
getSignature
public String getSignature()
Description copied from interface:QueryModelNode
Returns the signature of this query model node. Signatures normally include the node's name and any parameters, but not parent or child nodes. This method is used byQueryModelNode.toString()
.- Specified by:
getSignature
in interfaceQueryModelNode
- Returns:
- The node's signature, e.g. SLICE (offset=10, limit=10).
-
replaceChildNode
public void replaceChildNode(QueryModelNode current, QueryModelNode replacement)
Description copied from interface:QueryModelNode
Replaces one of the child nodes with a new node.- Specified by:
replaceChildNode
in interfaceQueryModelNode
- Parameters:
current
- The current child node.replacement
- The new child node.
-
replaceWith
public void replaceWith(QueryModelNode replacement)
Description copied from interface:QueryModelNode
Substitutes this node with a new node in the query model tree.- Specified by:
replaceWith
in interfaceQueryModelNode
- Parameters:
replacement
- The new node.
-
setParentNode
public void setParentNode(QueryModelNode parent)
Description copied from interface:QueryModelNode
Sets the node's parent.- Specified by:
setParentNode
in interfaceQueryModelNode
- Parameters:
parent
- The parent node for this node.
-
visit
public <X extends Exception> void visit(QueryModelVisitor<X> visitor) throws X extends Exception
Description copied from interface:QueryModelNode
Visits this node. The node reports itself to the visitor with the proper runtime type.- Specified by:
visit
in interfaceQueryModelNode
- Throws:
X extends Exception
-
visitChildren
public <X extends Exception> void visitChildren(QueryModelVisitor<X> visitor) throws X extends Exception
Description copied from interface:QueryModelNode
Visits the children of this node. The node callsQueryModelNode.visit(QueryModelVisitor)
on all of its child nodes.- Specified by:
visitChildren
in interfaceQueryModelNode
- Throws:
X extends Exception
-
clone
public CheckStatementPattern clone()
Description copied from interface:QueryModelNode
Returns a (deep) clone of this query model node. This method recursively clones the entire node tree, starting from this nodes.
-
getResultSizeEstimate
public double getResultSizeEstimate()
Description copied from interface:QueryModelNode
Returns the number of tuples that this QueryNode predicts will be outputted. For a StatementPattern this would be the estimated cardinality provided by the EvaluationStatistics. For a Join the would be the resulting number of joined tuples.- Specified by:
getResultSizeEstimate
in interfaceQueryModelNode
- Returns:
- rows
-
setResultSizeEstimate
public void setResultSizeEstimate(double resultSizeEstimate)
- Specified by:
setResultSizeEstimate
in interfaceQueryModelNode
-
getResultSizeActual
public long getResultSizeActual()
- Specified by:
getResultSizeActual
in interfaceQueryModelNode
-
setResultSizeActual
public void setResultSizeActual(long resultSizeActual)
- Specified by:
setResultSizeActual
in interfaceQueryModelNode
-
getCostEstimate
public double getCostEstimate()
- Specified by:
getCostEstimate
in interfaceQueryModelNode
-
setCostEstimate
public void setCostEstimate(double costEstimate)
- Specified by:
setCostEstimate
in interfaceQueryModelNode
-
getTotalTimeNanosActual
public long getTotalTimeNanosActual()
- Specified by:
getTotalTimeNanosActual
in interfaceQueryModelNode
-
setTotalTimeNanosActual
public void setTotalTimeNanosActual(long totalTimeNanosActual)
- Specified by:
setTotalTimeNanosActual
in interfaceQueryModelNode
-
evaluate
public CloseableIteration<BindingSet,QueryEvaluationException> evaluate(BindingSet bindings) throws QueryEvaluationException
Description copied from interface:StatementTupleExpr
Evaluate this expression using the provided bindings- Specified by:
evaluate
in interfaceStatementTupleExpr
- Returns:
- the result iteration
- Throws:
QueryEvaluationException
-
getQueryInfo
public QueryInfo getQueryInfo()
Description copied from interface:QueryRef
Retrieve the attached query information of the tuple expression- Specified by:
getQueryInfo
in interfaceQueryRef
- Returns:
- the
QueryInfo
-
-