Class SPARQLExtQuery

  • All Implemented Interfaces:
    Cloneable, org.apache.jena.atlas.io.Printable

    public class SPARQLExtQuery
    extends Query
    Represents a SPARQL-Generate or SPARQL-Template query.
    Author:
    Maxime Lefrançois
    • Field Detail

      • QueryTypeGenerate

        public static final int QueryTypeGenerate
        The query type of SPARQL-Generate queries.
        See Also:
        Constant Field Values
      • QueryTypeTemplate

        public static final int QueryTypeTemplate
        The query type of SPARQL-Template queries.
        See Also:
        Constant Field Values
      • QueryTypePerform

        public static final int QueryTypePerform
        The query type of SPARQL-Perform queries.
        See Also:
        Constant Field Values
      • QueryTypeFunction

        public static final int QueryTypeFunction
        The query type of SPARQL-Function queries.
        See Also:
        Constant Field Values
    • Constructor Detail

      • SPARQLExtQuery

        public SPARQLExtQuery()
        Creates a new empty query.
      • SPARQLExtQuery

        public SPARQLExtQuery​(Prologue prologue)
        Creates a new empty query with the given prologue.
    • Method Detail

      • setQueryGenerateType

        public void setQueryGenerateType()
        Specifies that the Query is a SPARQL-Generate query.
      • setQueryTemplateType

        public void setQueryTemplateType()
        Specifies that the Query is a SPARQL-Template query.
      • setQueryPerformType

        public void setQueryPerformType()
        Specifies that the Query is a SPARQL-Perform query.
      • setQueryFunctionType

        public void setQueryFunctionType()
        Specifies that the Query is a SPARQL-Function query.
      • isSelectType

        public boolean isSelectType()
        Overrides:
        isSelectType in class Query
      • isAskType

        public boolean isAskType()
        Overrides:
        isAskType in class Query
      • isUnknownType

        public boolean isUnknownType()
        Overrides:
        isUnknownType in class Query
      • isGenerateType

        public boolean isGenerateType()
        Gets if the Query is a SPARQL-Generate query.
      • isTemplateType

        public boolean isTemplateType()
        Gets if the Query is a SPARQL-Template query.
      • isPerformType

        public boolean isPerformType()
        Gets if the Query is a SPARQL-Perform query.
      • isFunctionType

        public boolean isFunctionType()
        Gets if the Query is a SPARQL-Function query.
      • hasEmbeddedExpressions

        public void hasEmbeddedExpressions​(boolean hasEmbeddedExpressions)
        Sets if the query contains expressions in literals, URIs, or in place of variables.
        Parameters:
        hasEmbeddedExpressions -
      • hasEmbeddedExpressions

        public boolean hasEmbeddedExpressions()
        Returns if the query contains expressions in literals, URIs, or in place of variables.
      • hasPostSelect

        public boolean hasPostSelect()
      • addPostSelect

        public void addPostSelect​(Var v,
                                  Expr expr)
      • isSubQuery

        public boolean isSubQuery()
        Returns if the query is a sub query of another query.
      • isSubQuery

        public void isSubQuery​(boolean isSubQuery)
        Sets if the query is a sub query of another query.
        Parameters:
        isSubQuery -
      • hasName

        public final boolean hasName()
        Gets if the query has a name.
        Returns:
        -
      • getName

        public final Expr getName()
        Gets the name of the query, or null.
        Returns:
        the name node.
      • setName

        public final void setName​(Expr name)
        Sets the name of the query.
        Parameters:
        name - the name of the query
      • hasSignature

        public final boolean hasSignature()
        Gets if the query has a signature.
        Returns:
        -
      • getSignature

        public final List<Var> getSignature()
        Gets the signature of the query, or null.
        Returns:
        the signature of the query.
      • setSignature

        public final void setSignature​(List<Var> signature)
        Sets the signature of the query.
        Parameters:
        signature - the signature of the query
      • hasCallParameters

        public final boolean hasCallParameters()
        Gets if the query has call parameters.
        Returns:
        -
      • getCallParameters

        public final ExprList getCallParameters()
        Gets the call parameters of the query, or null.
        Returns:
        call parameters.
      • setCallParameters

        public final void setCallParameters​(ExprList parameters)
        Sets the call parameters of the query.
        Parameters:
        parameters - the call parameters of the query
      • hasGenerateClause

        public final boolean hasGenerateClause()
        Gets if the query has a GENERATE clause
        Returns:
        -
      • getGenerateClause

        public final List<Element> getGenerateClause()
        Gets the GENERATE form, or null if is is a URI.
        Returns:
        -
      • setGenerateClause

        public final void setGenerateClause​(List<Element> generateClause)
        Set the elements in the GENERATE clause.
        Parameters:
        generateClause - the template.
      • hasTemplateClause

        public final boolean hasTemplateClause()
        Gets if the query has a TEMPLATE clause.
        Returns:
        -
      • getTemplateClause

        public final List<Element> getTemplateClause()
        Gets the elements in the TEMPLATE clause.
        Returns:
        -
      • setTemplateClause

        public final void setTemplateClause​(List<Element> templateClause)
        Set the elements in the TEMPLATE clause.
        Parameters:
        templateClause - the template.
      • hasTemplateClauseSeparator

        public boolean hasTemplateClauseSeparator()
        Returns if this query has a separator expression in the TEMPLATE clause.
        Returns:
        if this query has a separator expression in the TEMPLATE clause
      • getTemplateClauseSeparator

        public Expr getTemplateClauseSeparator()
        Returns the separator expression in the TEMPLATE clause.
        Returns:
        the separator expression in the TEMPLATE clause
      • setTemplateClauseSeparator

        public void setTemplateClauseSeparator​(Expr templateClauseSeparator)
        Set the separator expression in the TEMPLATE clause.
        Parameters:
        templateClauseSeparator - the separator.
      • hasTemplateClauseBefore

        public boolean hasTemplateClauseBefore()
        Returns if this query has a before expression in the TEMPLATE clause.
        Returns:
        if this query has a before expression in the TEMPLATE clause
      • getTemplateClauseBefore

        public Expr getTemplateClauseBefore()
        Returns the before expression in the TEMPLATE clause.
        Returns:
        the before expression in the TEMPLATE clause
      • setTemplateClauseBefore

        public void setTemplateClauseBefore​(Expr templateClauseBefore)
        Set the before expression in the TEMPLATE clause.
        Parameters:
        templateClauseBefore - the before string.
      • hasTemplateClauseAfter

        public boolean hasTemplateClauseAfter()
        Returns if this query has a after expression in the TEMPLATE clause.
        Returns:
        if this query has a after expression in the TEMPLATE clause
      • getTemplateClauseAfter

        public Expr getTemplateClauseAfter()
        Returns the after expression in the TEMPLATE clause.
        Returns:
        the after expression in the TEMPLATE clause
      • setTemplateClauseAfter

        public void setTemplateClauseAfter​(Expr templateClauseAfter)
        Set the after expression in the TEMPLATE clause.
        Parameters:
        templateClauseAfter - the after string.
      • hasPerformClause

        public final boolean hasPerformClause()
        Gets if the query has a PERFORM clause.
        Returns:
        -
      • getPerformClause

        public final List<Element> getPerformClause()
        Get the elements in the PERFORM clause.
        Returns:
        the clause.
      • setPerformClause

        public final void setPerformClause​(List<Element> performClause)
        Set the elements in the PERFORM clause.
        Parameters:
        performClause - the template.
      • hasFunctionExpression

        public final boolean hasFunctionExpression()
        Gets if the query has a function expression.
        Returns:
        -
      • getFunctionExpression

        public final Expr getFunctionExpression()
        Gets the function expression of the query, or null.
        Returns:
        the function expression.
      • setFunctionExpression

        public final void setFunctionExpression​(Expr functionExpression)
        Sets the function expression of the query.
        Parameters:
        functionExpression - the function expression
      • getFromClauses

        public List<FromClause> getFromClauses()
        Gets the list of FROM clauses
        Returns:
      • setFromClauses

        public void setFromClauses​(List<FromClause> fromClauses)
        Gets the list of FROM clauses
      • addGraphExpr

        public void addGraphExpr​(Expr expr)
        adds a FROM varOrIri clause
        Parameters:
        expr -
      • addNamedGraphExpr

        public void addNamedGraphExpr​(Expr expr)
        adds a FROM NAMED varOrIri clause
        Parameters:
        expr -
      • addNamedGraphQuery

        public void addNamedGraphQuery​(Expr expr,
                                       SPARQLExtQuery generate)
        adds a FROM NAMED varOrIri clause
        Parameters:
        expr -
      • addGraphQuery

        public void addGraphQuery​(SPARQLExtQuery generate)
        adds a FROM GENERATE clause
        Parameters:
        q -
      • hasBindingClauses

        public final boolean hasBindingClauses()
        Gets if the query has at least one SOURCE or ITERATOR clause.
        Returns:
        -
      • setBindingClauses

        public final void setBindingClauses​(List<Element> list)
        Sets the list of SOURCE and ITERATOR clauses.
        Parameters:
        list - -
      • getBindingClauses

        public final List<Element> getBindingClauses()
        Gets the list of SOURCE and ITERATOR clauses.
        Returns:
        -
      • normalizeXExpr

        public void normalizeXExpr()
        Change this query to a semantically equivalent one, but with no embedded expressions.
      • normalizeBNode

        public void normalizeBNode()
        Change this query to a semantically equivalent one, but with no BNode common to a query and a subquery.
      • normalizeAggregates

        public void normalizeAggregates()
        Change this query to a semantically equivalent one, but with aggregates only in EXPRESSIONS clause
      • visit

        public void visit​(QueryVisitor visitor)
        Visits the query by a SPARQLExt Query visitor, or throw an exception.
        Overrides:
        visit in class Query
        Parameters:
        visitor - must be a SPARQLExt Query visitor.
        Throws:
        IllegalArgumentException - if the query is not a SPARQLExtQuery Query.
      • visit

        public void visit​(SPARQLExtQueryVisitor visitor)
        Visits the query by a SPARQLExt Query visitor.
        Parameters:
        visitor - the SPARQLExt Query visitor.
      • equals

        public boolean equals​(Object other)
        Overrides:
        equals in class Query
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Query