Package org.eclipse.rdf4j.query.algebra
Class ProjectionElem
java.lang.Object
org.eclipse.rdf4j.query.algebra.AbstractQueryModelNode
org.eclipse.rdf4j.query.algebra.ProjectionElem
- All Implemented Interfaces:
Serializable
,Cloneable
,QueryModelNode
,VariableScopeChange
Projection elements control which of the selected expressions (produced by the WHERE clause of a query) are returned
in the solution, and the order in which they appear.
In SPARQL SELECT queries, projection elements are the variables determined by the algorithm for finding SELECT
expressions (see SPARQL 1.1 Query Language
Recommendation, section 18.2.4.4). Each projection element will be a single variable name (any aliasing is
handled by the use of Extension
s).
In SPARQL CONSTRUCT queries, the projection elements are used to map the variables obtained from the SELECT
expressions to the required statement patterns. In this case, each projection element will have an additional
target name
that maps each projection variable name to one of subject
,
predicate
, object
or context
.
- Author:
- Jeen Broekstra
- See Also:
-
Constructor Summary
ConstructorDescriptionCreate a new emptyProjectionElem
.ProjectionElem
(String name) Create a newProjectionElem
with a variable name.ProjectionElem
(String name, String targetName) Create a newProjectionElem
with a variable name and an additional mappedtarget name
-
Method Summary
Modifier and TypeMethodDescriptionclone()
Returns a (deep) clone of this query model node.boolean
Returns true if this query model node and its children are recursively equal to o and its children.getName()
Get the name of the projection element (typically the name of the variable in the select expressions)Get the alias the projection element value should be mapped to.Default implementation ofQueryModelNode.getSignature()
that prints the name of the node's class.boolean
int
hashCode()
void
replaceChildNode
(QueryModelNode current, QueryModelNode replacement) Replaces one of the child nodes with a new node.void
setAggregateOperatorInExpression
(boolean aggregateOperatorInExpression) void
Set the name of the projection element (typically the name of the variable in the select expressions)void
setProjectionAlias
(String alias) Set the alias the projection element value should be mapped to.void
setSourceExpression
(ExtensionElem sourceExpression) <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 org.eclipse.rdf4j.query.algebra.AbstractQueryModelNode
getCardinality, getCostEstimate, getParentNode, getResultSizeActual, getResultSizeEstimate, getTotalTimeNanosActual, isCardinalitySet, isVariableScopeChange, nullEquals, replaceNodeInList, replaceWith, resetCardinality, setCardinality, setCostEstimate, setParentNode, setResultSizeActual, setResultSizeEstimate, setTotalTimeNanosActual, setVariableScopeChange, shouldCacheCardinality, toString
-
Constructor Details
-
ProjectionElem
public ProjectionElem()Create a new emptyProjectionElem
. -
ProjectionElem
Create a newProjectionElem
with a variable name.- Parameters:
name
- The name of the projection element (typically the name of the variable in the select expressions). May not benull
.
-
ProjectionElem
Create a newProjectionElem
with a variable name and an additional mappedtarget name
- Parameters:
name
- The name of the projection element (typically the name of the variable in the select expressions). May not benull
.targetName
- The name of the variable the projection element value should be mapped to, to produce the projection. Used in CONSTRUCT queries for mapping select expressions to statement patterns. May benull
.
-
-
Method Details
-
getName
Get the name of the projection element (typically the name of the variable in the select expressions) -
setName
Set the name of the projection element (typically the name of the variable in the select expressions)- Parameters:
name
- the projection variable name. May not benull
.
-
getProjectionAlias
Get the alias the projection element value should be mapped to. Used in CONSTRUCT queries for mapping select expressions to statement patterns.- Returns:
- an optionally empty projection alias.
-
setProjectionAlias
Set the alias the projection element value should be mapped to. Used in CONSTRUCT queries for mapping select expressions to statement patterns.- Parameters:
alias
- the projection alias.
-
visit
Description copied from interface:QueryModelNode
Visits this node. The node reports itself to the visitor with the proper runtime type.- Throws:
X
-
visitChildren
Description copied from interface:QueryModelNode
Visits the children of this node. The node callsQueryModelNode.visit(QueryModelVisitor)
on all of its child nodes.- Throws:
X
-
replaceChildNode
Description copied from interface:QueryModelNode
Replaces one of the child nodes with a new node.- Parameters:
current
- The current child node.replacement
- The new child node.
-
getSignature
Description copied from class:AbstractQueryModelNode
Default implementation ofQueryModelNode.getSignature()
that prints the name of the node's class.- Specified by:
getSignature
in interfaceQueryModelNode
- Overrides:
getSignature
in classAbstractQueryModelNode
- Returns:
- The node's signature, e.g. SLICE (offset=10, limit=10).
-
equals
Description copied from interface:QueryModelNode
Returns true if this query model node and its children are recursively equal to o and its children.- Specified by:
equals
in interfaceQueryModelNode
- Overrides:
equals
in classObject
-
hashCode
public int hashCode() -
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 classAbstractQueryModelNode
- Returns:
- A deep clone of this query model node.
-
hasAggregateOperatorInExpression
public boolean hasAggregateOperatorInExpression()- Returns:
- Returns the aggregateOperatorInExpression.
-
setAggregateOperatorInExpression
public void setAggregateOperatorInExpression(boolean aggregateOperatorInExpression) - Parameters:
aggregateOperatorInExpression
- The aggregateOperatorInExpression to set.
-
getSourceExpression
- Returns:
- Returns the sourceExpression.
-
setSourceExpression
- Parameters:
sourceExpression
- The sourceExpression to set.
-