Package org.eclipse.rdf4j.query.algebra
Class AbstractQueryModelNode
- java.lang.Object
-
- org.eclipse.rdf4j.query.algebra.AbstractQueryModelNode
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,GraphPatternGroupable
,QueryModelNode
,VariableScopeChange
- Direct Known Subclasses:
Add
,ArbitraryLengthPath
,BinaryTupleOperator
,BinaryValueOperator
,BindingSetAssignment
,BNodeGenerator
,Bound
,Clear
,Copy
,Create
,DeleteData
,EmptySet
,ExtensionElem
,FunctionCall
,GroupElem
,If
,InsertData
,Load
,Modify
,Move
,NAryValueOperator
,OrderElem
,ProjectionElem
,ProjectionElemList
,QueryModelNodeBase
,SingletonSet
,StatementPattern
,SubQueryValueOperator
,TripleRef
,UnaryTupleOperator
,UnaryValueOperator
,ValueConstant
,ValueExprTripleRef
,Var
,ZeroLengthPath
public abstract class AbstractQueryModelNode extends java.lang.Object implements QueryModelNode, VariableScopeChange, GraphPatternGroupable
Base implementation ofQueryModelNode
.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private double
cardinality
private static double
CARDINALITY_NOT_SET
private double
costEstimate
private boolean
isVariableScopeChange
private QueryModelNode
parent
private long
resultSizeActual
private double
resultSizeEstimate
private static long
serialVersionUID
private long
totalTimeNanosActual
-
Constructor Summary
Constructors Constructor Description AbstractQueryModelNode()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description AbstractQueryModelNode
clone()
Returns a (deep) clone of this query model node.double
getCardinality()
double
getCostEstimate()
QueryModelNode
getParentNode()
Gets the node's parent.long
getResultSizeActual()
double
getResultSizeEstimate()
Returns the number of tuples that this QueryNode predicts will be outputted.java.lang.String
getSignature()
Default implementation ofQueryModelNode.getSignature()
that prints the name of the node's class.long
getTotalTimeNanosActual()
boolean
isCardinalitySet()
boolean
isGraphPatternGroup()
Deprecated.boolean
isVariableScopeChange()
indicates if the node represents a variable scope change.protected boolean
nullEquals(java.lang.Object o1, java.lang.Object o2)
void
replaceChildNode(QueryModelNode current, QueryModelNode replacement)
Default implementation ofQueryModelNode.replaceChildNode(QueryModelNode, QueryModelNode)
that throws anIllegalArgumentException
indicating that current is not a child node of this node.protected <T extends QueryModelNode>
booleanreplaceNodeInList(java.util.List<T> list, QueryModelNode current, QueryModelNode replacement)
void
replaceWith(QueryModelNode replacement)
Default implementation ofQueryModelNode.replaceWith(QueryModelNode)
that throws anIllegalArgumentException
indicating that current is not a child node of this node.void
resetCardinality()
void
setCardinality(double cardinality)
void
setCostEstimate(double costEstimate)
void
setGraphPatternGroup(boolean isGraphPatternGroup)
Deprecated.void
setParentNode(QueryModelNode parent)
Sets the node's parent.void
setResultSizeActual(long resultSizeActual)
void
setResultSizeEstimate(double resultSizeEstimate)
void
setTotalTimeNanosActual(long totalTimeNanosActual)
void
setVariableScopeChange(boolean isVariableScopeChange)
Set the value ofVariableScopeChange.isVariableScopeChange()
to true or false.protected boolean
shouldCacheCardinality()
(package private) static java.lang.String
toHumanReadbleNumber(double number)
java.lang.String
toString()
Returns an indented print of the node tree, starting from this node.<X extends java.lang.Exception>
voidvisitChildren(QueryModelVisitor<X> visitor)
Dummy implementation ofQueryModelNode.visitChildren(org.eclipse.rdf4j.query.algebra.QueryModelVisitor<X>)
that does nothing.-
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.rdf4j.query.algebra.QueryModelNode
equals, visit
-
-
-
-
Field Detail
-
CARDINALITY_NOT_SET
private static final double CARDINALITY_NOT_SET
- See Also:
- Constant Field Values
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
parent
private QueryModelNode parent
-
isVariableScopeChange
private boolean isVariableScopeChange
-
resultSizeEstimate
private double resultSizeEstimate
-
resultSizeActual
private long resultSizeActual
-
costEstimate
private double costEstimate
-
totalTimeNanosActual
private long totalTimeNanosActual
-
cardinality
private double cardinality
-
-
Method Detail
-
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.
-
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.
-
isVariableScopeChange
public boolean isVariableScopeChange()
Description copied from interface:VariableScopeChange
indicates if the node represents a variable scope change.- Specified by:
isVariableScopeChange
in interfaceVariableScopeChange
- Returns:
- true iff the node represents a variable scope change.
-
setVariableScopeChange
public void setVariableScopeChange(boolean isVariableScopeChange)
Description copied from interface:VariableScopeChange
Set the value ofVariableScopeChange.isVariableScopeChange()
to true or false.- Specified by:
setVariableScopeChange
in interfaceVariableScopeChange
-
isGraphPatternGroup
@Deprecated public boolean isGraphPatternGroup()
Deprecated.Description copied from interface:GraphPatternGroupable
indicates if the node represents the root of a graph pattern group.- Specified by:
isGraphPatternGroup
in interfaceGraphPatternGroupable
- Returns:
- true iff the node represents the node of a graph pattern group.
-
setGraphPatternGroup
@Deprecated public void setGraphPatternGroup(boolean isGraphPatternGroup)
Deprecated.Description copied from interface:GraphPatternGroupable
Set the value ofGraphPatternGroupable.isGraphPatternGroup()
to true or false.- Specified by:
setGraphPatternGroup
in interfaceGraphPatternGroupable
-
visitChildren
public <X extends java.lang.Exception> void visitChildren(QueryModelVisitor<X> visitor) throws X extends java.lang.Exception
Dummy implementation ofQueryModelNode.visitChildren(org.eclipse.rdf4j.query.algebra.QueryModelVisitor<X>)
that does nothing. Subclasses should override this method when they have child nodes.- Specified by:
visitChildren
in interfaceQueryModelNode
- Throws:
X extends java.lang.Exception
-
replaceChildNode
public void replaceChildNode(QueryModelNode current, QueryModelNode replacement)
Default implementation ofQueryModelNode.replaceChildNode(QueryModelNode, QueryModelNode)
that throws anIllegalArgumentException
indicating that current is not a child node of this node.- Specified by:
replaceChildNode
in interfaceQueryModelNode
- Parameters:
current
- The current child node.replacement
- The new child node.
-
replaceWith
public void replaceWith(QueryModelNode replacement)
Default implementation ofQueryModelNode.replaceWith(QueryModelNode)
that throws anIllegalArgumentException
indicating that current is not a child node of this node.- Specified by:
replaceWith
in interfaceQueryModelNode
- Parameters:
replacement
- The new node.
-
getSignature
public java.lang.String getSignature()
Default implementation ofQueryModelNode.getSignature()
that prints the name of the node's class.- Specified by:
getSignature
in interfaceQueryModelNode
- Returns:
- The node's signature, e.g. SLICE (offset=10, limit=10).
-
toString
public java.lang.String toString()
Description copied from interface:QueryModelNode
Returns an indented print of the node tree, starting from this node.- Specified by:
toString
in interfaceQueryModelNode
- Overrides:
toString
in classjava.lang.Object
-
clone
public AbstractQueryModelNode 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.- Specified by:
clone
in interfaceQueryModelNode
- Overrides:
clone
in classjava.lang.Object
- Returns:
- A deep clone of this query model node.
-
replaceNodeInList
protected <T extends QueryModelNode> boolean replaceNodeInList(java.util.List<T> list, QueryModelNode current, QueryModelNode replacement)
-
nullEquals
protected boolean nullEquals(java.lang.Object o1, java.lang.Object o2)
-
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
-
toHumanReadbleNumber
static java.lang.String toHumanReadbleNumber(double number)
- Returns:
- Human readable number. Eg. 12.1M for 1212213.4 and UNKNOWN for -1.
-
getCardinality
@Experimental public double getCardinality()
-
setCardinality
@Experimental public void setCardinality(double cardinality)
-
resetCardinality
@Experimental public void resetCardinality()
-
isCardinalitySet
@Experimental public boolean isCardinalitySet()
-
shouldCacheCardinality
@Experimental protected boolean shouldCacheCardinality()
-
-