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,GraphPatternGroupable,QueryModelNode,VariableScopeChange
public class ProjectionElem extends AbstractQueryModelNode
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
Extensions).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 namethat maps each projection variable name to one ofsubject,predicate,objectorcontext.- Author:
- Jeen Broekstra
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description ProjectionElem()Create a new emptyProjectionElem.ProjectionElem(String name)Create a newProjectionElemwith a variable name.ProjectionElem(String name, String targetName)Create a newProjectionElemwith a variable name and an additional mappedtarget name
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description ProjectionElemclone()Returns a (deep) clone of this query model node.booleanequals(Object other)Returns true if this query model node and its children are recursively equal to o and its children.StringgetName()Get the name of the projection element (typically the name of the variable in the select expressions)Optional<String>getProjectionAlias()Get the alias the projection element value should be mapped to.StringgetSignature()Default implementation ofQueryModelNode.getSignature()that prints the name of the node's class.ExtensionElemgetSourceExpression()StringgetSourceName()Deprecated, for removal: This API element is subject to removal in a future version.since 4.1.1.StringgetTargetName()Deprecated, for removal: This API element is subject to removal in a future version.since 4.1.1.booleanhasAggregateOperatorInExpression()inthashCode()voidsetAggregateOperatorInExpression(boolean aggregateOperatorInExpression)voidsetName(String name)Set the name of the projection element (typically the name of the variable in the select expressions)voidsetProjectionAlias(String alias)Set the alias the projection element value should be mapped to.voidsetSourceExpression(ExtensionElem sourceExpression)voidsetSourceName(String sourceName)Deprecated, for removal: This API element is subject to removal in a future version.since 4.1.1.voidsetTargetName(String targetName)Deprecated, for removal: This API element is subject to removal in a future version.since 4.1.1.<X extends Exception>
voidvisit(QueryModelVisitor<X> visitor)Visits this node.<X extends Exception>
voidvisitChildren(QueryModelVisitor<X> visitor)Dummy implementation ofQueryModelNode.visitChildren(org.eclipse.rdf4j.query.algebra.QueryModelVisitor<X>)that does nothing.-
Methods inherited from class org.eclipse.rdf4j.query.algebra.AbstractQueryModelNode
getCardinality, getCostEstimate, getParentNode, getResultSizeActual, getResultSizeEstimate, getTotalTimeNanosActual, isCardinalitySet, isGraphPatternGroup, isVariableScopeChange, nullEquals, replaceChildNode, replaceNodeInList, replaceWith, resetCardinality, setCardinality, setCostEstimate, setGraphPatternGroup, setParentNode, setResultSizeActual, setResultSizeEstimate, setTotalTimeNanosActual, setVariableScopeChange, shouldCacheCardinality, toString
-
-
-
-
Constructor Detail
-
ProjectionElem
public ProjectionElem()
Create a new emptyProjectionElem.
-
ProjectionElem
public ProjectionElem(String name)
Create a newProjectionElemwith 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
public ProjectionElem(String name, String targetName)
Create a newProjectionElemwith 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 Detail
-
getName
public String getName()
Get the name of the projection element (typically the name of the variable in the select expressions)
-
getSourceName
@Deprecated(since="4.1.1", forRemoval=true) public String getSourceName()
Deprecated, for removal: This API element is subject to removal in a future version.since 4.1.1. UsegetName()instead.
-
setSourceName
@Deprecated(since="4.1.1", forRemoval=true) public void setSourceName(String sourceName)
Deprecated, for removal: This API element is subject to removal in a future version.since 4.1.1. UsesetName(String)instead.
-
setName
public void setName(String name)
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
public Optional<String> 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
public void setProjectionAlias(String alias)
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.
-
setTargetName
@Deprecated(since="4.1.1", forRemoval=true) public void setTargetName(String targetName)
Deprecated, for removal: This API element is subject to removal in a future version.since 4.1.1. UsesetProjectionAlias(String)instead.
-
getTargetName
@Deprecated(since="4.1.1", forRemoval=true) public String getTargetName()
Deprecated, for removal: This API element is subject to removal in a future version.since 4.1.1. UsegetProjectionAlias()instead.
-
visit
public <X extends Exception> void visit(QueryModelVisitor<X> visitor) throws X extends Exception
Description copied from interface:QueryModelNodeVisits this node. The node reports itself to the visitor with the proper runtime type.- Throws:
X extends Exception
-
visitChildren
public <X extends Exception> void visitChildren(QueryModelVisitor<X> visitor) throws X extends Exception
Description copied from class:AbstractQueryModelNodeDummy 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:
visitChildrenin interfaceQueryModelNode- Overrides:
visitChildrenin classAbstractQueryModelNode- Throws:
X extends Exception
-
getSignature
public String getSignature()
Description copied from class:AbstractQueryModelNodeDefault implementation ofQueryModelNode.getSignature()that prints the name of the node's class.- Specified by:
getSignaturein interfaceQueryModelNode- Overrides:
getSignaturein classAbstractQueryModelNode- Returns:
- The node's signature, e.g. SLICE (offset=10, limit=10).
-
equals
public boolean equals(Object other)
Description copied from interface:QueryModelNodeReturns true if this query model node and its children are recursively equal to o and its children.- Specified by:
equalsin interfaceQueryModelNode- Overrides:
equalsin classObject
-
clone
public ProjectionElem clone()
Description copied from interface:QueryModelNodeReturns a (deep) clone of this query model node. This method recursively clones the entire node tree, starting from this nodes.- Specified by:
clonein interfaceQueryModelNode- Overrides:
clonein 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
public ExtensionElem getSourceExpression()
- Returns:
- Returns the sourceExpression.
-
setSourceExpression
public void setSourceExpression(ExtensionElem sourceExpression)
- Parameters:
sourceExpression- The sourceExpression to set.
-
-