Class 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 name that maps each projection variable name to one of subject, predicate, object or context.

    Author:
    Jeen Broekstra
    See Also:
    Serialized Form
    • Constructor Detail

      • ProjectionElem

        public ProjectionElem()
        Create a new empty ProjectionElem.
      • ProjectionElem

        public ProjectionElem​(String name)
        Create a new ProjectionElem with a variable name.
        Parameters:
        name - The name of the projection element (typically the name of the variable in the select expressions). May not be null.
      • ProjectionElem

        public ProjectionElem​(String name,
                              String targetName)
        Create a new ProjectionElem with a variable name and an additional mapped target name
        Parameters:
        name - The name of the projection element (typically the name of the variable in the select expressions). May not be null.
        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 be null.
    • 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. Use getName() 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. Use setName(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 be null.
      • 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.
      • equals

        public boolean equals​(Object other)
        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 interface QueryModelNode
        Overrides:
        equals in class Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • 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.