Class SPARQLExtQuery

java.lang.Object
org.apache.jena.sparql.core.Prologue
org.apache.jena.query.Query
fr.mines_stetienne.ci.sparql_generate.query.SPARQLExtQuery
All Implemented Interfaces:
Cloneable, org.apache.jena.atlas.io.Printable

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

    Fields
    Modifier and Type
    Field
    Description
    static final int
    The query type of SPARQL-Function queries.
    static final int
    The query type of SPARQL-Generate queries.
    static final int
    The query type of SPARQL-Perform queries.
    static final int
    The query type of SPARQL-Template queries.

    Fields inherited from class org.apache.jena.query.Query

    constructTemplate, distinct, groupVars, havingExprs, NOLIMIT, ORDER_ASCENDING, ORDER_DEFAULT, ORDER_DESCENDING, ORDER_UNKNOW, projectVars, queryResultStar, QueryTypeAsk, QueryTypeConstruct, QueryTypeDescribe, QueryTypeJson, QueryTypeSelect, QueryTypeUnknown, reduced, resultNodes, strictQuery, valuesDataBlock

    Fields inherited from class org.apache.jena.sparql.core.Prologue

    prefixMap, resolver, seenBaseURI
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new empty query.
    SPARQLExtQuery(org.apache.jena.sparql.core.Prologue prologue)
    Creates a new empty query with the given prologue.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addGraphExpr(org.apache.jena.sparql.expr.Expr expr)
    adds a FROM varOrIri clause
    void
    adds a FROM GENERATE clause
    void
    Deprecated.
    void
    addNamedGraphExpr(org.apache.jena.sparql.expr.Expr expr)
    adds a FROM NAMED varOrIri clause
    void
    addNamedGraphQuery(org.apache.jena.sparql.expr.Expr expr, SPARQLExtQuery generate)
    adds a FROM NAMED varOrIri clause
    void
    Deprecated.
    void
    addPostSelect(org.apache.jena.sparql.core.Var v, org.apache.jena.sparql.expr.Expr expr)
     
     
    void
    GENERATE, TEMPLATE and SELECT queries of SPARQL-Generate may have no WHERE clause: Jena would warn "No query pattern in non-DESCRIBE query" for each of them.
    boolean
    equals(Object other)
    final List<org.apache.jena.sparql.syntax.Element>
    Gets the list of SOURCE and ITERATOR clauses.
    final org.apache.jena.sparql.expr.ExprList
    Gets the call parameters of the query, or null.
    org.apache.jena.sparql.core.DatasetDescription
    Deprecated.
    Gets the list of FROM clauses
    final org.apache.jena.sparql.expr.Expr
    Gets the function expression of the query, or null.
    final List<org.apache.jena.sparql.syntax.Element>
    Gets the GENERATE form, or null if is is a URI.
    Deprecated.
    final org.apache.jena.sparql.expr.Expr
    Gets the name of the query, or null.
    Deprecated.
    final List<org.apache.jena.sparql.syntax.Element>
    Get the elements in the PERFORM clause.
    org.apache.jena.sparql.core.VarExprList
     
    int
     
    final List<org.apache.jena.sparql.core.Var>
    Gets the signature of the query, or null.
    final List<org.apache.jena.sparql.syntax.Element>
    Gets the elements in the TEMPLATE clause.
    org.apache.jena.sparql.expr.Expr
    Returns the after expression in the TEMPLATE clause.
    org.apache.jena.sparql.expr.Expr
    Returns the before expression in the TEMPLATE clause.
    org.apache.jena.sparql.expr.Expr
    Returns the separator expression in the TEMPLATE clause.
    final boolean
    Gets if the query has at least one SOURCE or ITERATOR clause.
    final boolean
    Gets if the query has call parameters.
    boolean
    Deprecated.
    boolean
    Returns if the query contains expressions in literals, URIs, or in place of variables.
    void
    hasEmbeddedExpressions(boolean hasEmbeddedExpressions)
    Sets if the query contains expressions in literals, URIs, or in place of variables.
    final boolean
    Gets if the query has a function expression.
    final boolean
    Gets if the query has a GENERATE clause
    int
     
    final boolean
    Gets if the query has a name.
    final boolean
    Gets if the query has a PERFORM clause.
    boolean
     
    final boolean
    Gets if the query has a signature.
    final boolean
    Gets if the query has a TEMPLATE clause.
    boolean
    Returns if this query has a after expression in the TEMPLATE clause.
    boolean
    Returns if this query has a before expression in the TEMPLATE clause.
    boolean
    Returns if this query has a separator expression in the TEMPLATE clause.
    boolean
     
    boolean
     
    boolean
     
    boolean
    Gets if the Query is a SPARQL-Function query.
    boolean
    Gets if the Query is a SPARQL-Generate query.
    boolean
    Gets if the Query is a SPARQL-Perform query.
    boolean
     
    boolean
    Returns if the query is a sub query of another query.
    void
    isSubQuery(boolean isSubQuery)
    Sets if the query is a sub query of another query.
    boolean
    Gets if the Query is a SPARQL-Template query.
    boolean
     
    void
    Change this query to a semantically equivalent one, but with aggregates only in EXPRESSIONS clause
    void
    Change this query to a semantically equivalent one, but with no BNode common to a query and a subquery.
    void
    Change this query to a semantically equivalent one, but with no embedded expressions.
    void
     
    final void
    setBindingClauses(List<org.apache.jena.sparql.syntax.Element> list)
    Sets the list of SOURCE and ITERATOR clauses.
    final void
    setCallParameters(org.apache.jena.sparql.expr.ExprList parameters)
    Sets the call parameters of the query.
    void
    Gets the list of FROM clauses
    final void
    setFunctionExpression(org.apache.jena.sparql.expr.Expr functionExpression)
    Sets the function expression of the query.
    final void
    setGenerateClause(List<org.apache.jena.sparql.syntax.Element> generateClause)
    Set the elements in the GENERATE clause.
    final void
    setName(org.apache.jena.sparql.expr.Expr name)
    Sets the name of the query.
    final void
    setPerformClause(List<org.apache.jena.sparql.syntax.Element> performClause)
    Set the elements in the PERFORM clause.
    void
     
    void
     
    void
     
    void
    Specifies that the Query is a SPARQL-Function query.
    void
    Specifies that the Query is a SPARQL-Generate query.
    void
    Specifies that the Query is a SPARQL-Perform query.
    void
     
    void
    Specifies that the Query is a SPARQL-Template query.
    final void
    setSignature(List<org.apache.jena.sparql.core.Var> signature)
    Sets the signature of the query.
    final void
    setTemplateClause(List<org.apache.jena.sparql.syntax.Element> templateClause)
    Set the elements in the TEMPLATE clause.
    void
    setTemplateClauseAfter(org.apache.jena.sparql.expr.Expr templateClauseAfter)
    Set the after expression in the TEMPLATE clause.
    void
    setTemplateClauseBefore(org.apache.jena.sparql.expr.Expr templateClauseBefore)
    Set the before expression in the TEMPLATE clause.
    void
    setTemplateClauseSeparator(org.apache.jena.sparql.expr.Expr templateClauseSeparator)
    Set the separator expression in the TEMPLATE clause.
    boolean
    Deprecated.
    boolean
    Deprecated.
    void
    Visits the query by a SPARQLExt Query visitor.
    void
    visit(org.apache.jena.query.QueryVisitor visitor)
    Visits the query by a SPARQLExt Query visitor, or throw an exception.

    Methods inherited from class org.apache.jena.query.Query

    addDescribeNode, addGroupBy, addGroupBy, addGroupBy, addGroupBy, addHavingCondition, addJsonMapping, addOrderBy, addOrderBy, addOrderBy, addOrderBy, addProjectVars, addResultVar, addResultVar, addResultVar, addResultVar, addResultVar, allocAggregate, clone, getAggregators, getConstructTemplate, getGroupBy, getHavingExprs, getJsonMapping, getLimit, getOffset, getOrderBy, getProject, getProjectVars, getPrologue, getQueryPattern, getResultURIs, getResultVars, getSyntax, getValuesData, getValuesVariables, hasAggregators, hasGroupBy, hasHaving, hasLimit, hasOffset, hasOrderBy, hasValues, isConstructQuad, isDistinct, isJsonType, isOrdered, isQueryResultStar, isReduced, isStrict, output, queryType, serialize, serialize, serialize, serialize, serialize, serialize, setConstructTemplate, setDistinct, setJsonMapping, setLimit, setOffset, setQueryJsonType, setQueryPattern, setQueryResultStar, setReduced, setResultVars, setStrict, setSyntax, setValuesDataBlock, toString, toString

    Methods inherited from class org.apache.jena.sparql.core.Prologue

    copy, expandPrefixedName, explicitlySetBaseURI, getBase, getBaseURI, getPrefix, getPrefixMapping, getResolver, getVersion, hash, samePrologue, setBase, setBaseURI, setPrefix, setPrefixMapping, setVersion, shortForm

    Methods inherited from class java.lang.Object

    finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • QueryTypeGenerate

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

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

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

      public static final int QueryTypeFunction
      The query type of SPARQL-Function queries.
      See Also:
  • Constructor Details

    • SPARQLExtQuery

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

      public SPARQLExtQuery(org.apache.jena.sparql.core.Prologue prologue)
      Creates a new empty query with the given prologue.
  • Method Details

    • ensureResultVars

      public void ensureResultVars()
      GENERATE, TEMPLATE and SELECT queries of SPARQL-Generate may have no WHERE clause: Jena would warn "No query pattern in non-DESCRIBE query" for each of them.
      Overrides:
      ensureResultVars in class org.apache.jena.query.Query
    • resetResultVars

      public void resetResultVars()
      Overrides:
      resetResultVars in class org.apache.jena.query.Query
    • 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.
    • setQuerySelectType

      public void setQuerySelectType()
      Overrides:
      setQuerySelectType in class org.apache.jena.query.Query
    • setQueryConstructType

      public void setQueryConstructType()
      Overrides:
      setQueryConstructType in class org.apache.jena.query.Query
    • setQueryDescribeType

      public void setQueryDescribeType()
      Overrides:
      setQueryDescribeType in class org.apache.jena.query.Query
    • setQueryAskType

      public void setQueryAskType()
      Overrides:
      setQueryAskType in class org.apache.jena.query.Query
    • getQueryType

      public int getQueryType()
    • isSelectType

      public boolean isSelectType()
      Overrides:
      isSelectType in class org.apache.jena.query.Query
    • isConstructType

      public boolean isConstructType()
      Overrides:
      isConstructType in class org.apache.jena.query.Query
    • isDescribeType

      public boolean isDescribeType()
      Overrides:
      isDescribeType in class org.apache.jena.query.Query
    • isAskType

      public boolean isAskType()
      Overrides:
      isAskType in class org.apache.jena.query.Query
    • isUnknownType

      public boolean isUnknownType()
      Overrides:
      isUnknownType in class org.apache.jena.query.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(org.apache.jena.sparql.core.Var v, org.apache.jena.sparql.expr.Expr expr)
    • getPostSelect

      public org.apache.jena.sparql.core.VarExprList getPostSelect()
    • 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 org.apache.jena.sparql.expr.Expr getName()
      Gets the name of the query, or null.
      Returns:
      the name node.
    • setName

      public final void setName(org.apache.jena.sparql.expr.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<org.apache.jena.sparql.core.Var> getSignature()
      Gets the signature of the query, or null.
      Returns:
      the signature of the query.
    • setSignature

      public final void setSignature(List<org.apache.jena.sparql.core.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 org.apache.jena.sparql.expr.ExprList getCallParameters()
      Gets the call parameters of the query, or null.
      Returns:
      call parameters.
    • setCallParameters

      public final void setCallParameters(org.apache.jena.sparql.expr.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<org.apache.jena.sparql.syntax.Element> getGenerateClause()
      Gets the GENERATE form, or null if is is a URI.
      Returns:
      -
    • setGenerateClause

      public final void setGenerateClause(List<org.apache.jena.sparql.syntax.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<org.apache.jena.sparql.syntax.Element> getTemplateClause()
      Gets the elements in the TEMPLATE clause.
      Returns:
      -
    • setTemplateClause

      public final void setTemplateClause(List<org.apache.jena.sparql.syntax.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 org.apache.jena.sparql.expr.Expr getTemplateClauseSeparator()
      Returns the separator expression in the TEMPLATE clause.
      Returns:
      the separator expression in the TEMPLATE clause
    • setTemplateClauseSeparator

      public void setTemplateClauseSeparator(org.apache.jena.sparql.expr.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 org.apache.jena.sparql.expr.Expr getTemplateClauseBefore()
      Returns the before expression in the TEMPLATE clause.
      Returns:
      the before expression in the TEMPLATE clause
    • setTemplateClauseBefore

      public void setTemplateClauseBefore(org.apache.jena.sparql.expr.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 org.apache.jena.sparql.expr.Expr getTemplateClauseAfter()
      Returns the after expression in the TEMPLATE clause.
      Returns:
      the after expression in the TEMPLATE clause
    • setTemplateClauseAfter

      public void setTemplateClauseAfter(org.apache.jena.sparql.expr.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<org.apache.jena.sparql.syntax.Element> getPerformClause()
      Get the elements in the PERFORM clause.
      Returns:
      the clause.
    • setPerformClause

      public final void setPerformClause(List<org.apache.jena.sparql.syntax.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 org.apache.jena.sparql.expr.Expr getFunctionExpression()
      Gets the function expression of the query, or null.
      Returns:
      the function expression.
    • setFunctionExpression

      public final void setFunctionExpression(org.apache.jena.sparql.expr.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(org.apache.jena.sparql.expr.Expr expr)
      adds a FROM varOrIri clause
      Parameters:
      expr -
    • addNamedGraphExpr

      public void addNamedGraphExpr(org.apache.jena.sparql.expr.Expr expr)
      adds a FROM NAMED varOrIri clause
      Parameters:
      expr -
    • addNamedGraphQuery

      public void addNamedGraphQuery(org.apache.jena.sparql.expr.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 -
    • getGraphURIs

      @Deprecated public List<String> getGraphURIs()
      Deprecated.
      Overrides:
      getGraphURIs in class org.apache.jena.query.Query
    • addGraphURI

      @Deprecated public void addGraphURI(String s)
      Deprecated.
      Throws UnsupportedOperationException
      Overrides:
      addGraphURI in class org.apache.jena.query.Query
    • addNamedGraphURI

      @Deprecated public void addNamedGraphURI(String s)
      Deprecated.
      Throws UnsupportedOperationException
      Overrides:
      addNamedGraphURI in class org.apache.jena.query.Query
    • usesGraphURI

      @Deprecated public boolean usesGraphURI(String uri)
      Deprecated.
      Throws UnsupportedOperationException
      Overrides:
      usesGraphURI in class org.apache.jena.query.Query
    • getNamedGraphURIs

      @Deprecated public List<String> getNamedGraphURIs()
      Deprecated.
      Throws UnsupportedOperationException
      Overrides:
      getNamedGraphURIs in class org.apache.jena.query.Query
    • usesNamedGraphURI

      @Deprecated public boolean usesNamedGraphURI(String uri)
      Deprecated.
      Throws UnsupportedOperationException
      Overrides:
      usesNamedGraphURI in class org.apache.jena.query.Query
    • hasDatasetDescription

      @Deprecated public boolean hasDatasetDescription()
      Deprecated.
      Throws UnsupportedOperationException
      Overrides:
      hasDatasetDescription in class org.apache.jena.query.Query
    • getDatasetDescription

      @Deprecated public org.apache.jena.sparql.core.DatasetDescription getDatasetDescription()
      Deprecated.
      Throws UnsupportedOperationException
      Overrides:
      getDatasetDescription in class org.apache.jena.query.Query
    • hasBindingClauses

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

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

      public final List<org.apache.jena.sparql.syntax.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(org.apache.jena.query.QueryVisitor visitor)
      Visits the query by a SPARQLExt Query visitor, or throw an exception.
      Overrides:
      visit in class org.apache.jena.query.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 org.apache.jena.query.Query
    • cloneQuery

      public SPARQLExtQuery cloneQuery()
      Overrides:
      cloneQuery in class org.apache.jena.query.Query
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class org.apache.jena.query.Query