Class AGQuery

java.lang.Object
org.eclipse.rdf4j.query.impl.AbstractOperation
org.eclipse.rdf4j.query.impl.AbstractQuery
com.franz.agraph.repository.AGQuery
All Implemented Interfaces:
org.eclipse.rdf4j.query.Operation, org.eclipse.rdf4j.query.Query
Direct Known Subclasses:
AGBooleanQuery, AGGraphQuery, AGTupleQuery, AGUpdate

public abstract class AGQuery extends org.eclipse.rdf4j.query.impl.AbstractQuery
An abstract query class common to Boolean, Graph and Tuple Queries.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface org.eclipse.rdf4j.query.Query

    org.eclipse.rdf4j.query.Query.QueryType
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The default entailment regime to use when inferences are included.
    static final String
    An entailment regime that includes hasValue, someValuesFrom and allValuesFrom reasoning in addition to RDFS++ entailment.
    static final String
    The default query planner for SPARQL.
    static final String
    A query planner for SPARQL that processes queries without doing any reordering of clauses or optimization, useful if the user knows the best order for processing the query.
  • Constructor Summary

    Constructors
    Constructor
    Description
    AGQuery(AGRepositoryConnection con, org.eclipse.rdf4j.query.QueryLanguage ql, String queryString, String baseURI)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the query analysis for the query.
    void
    download(File file)
    Evaluates the query and saves the results to a file.
    void
    download(File file, String mimeType)
    Evaluates the query and saves the results to a file.
    void
    Evaluates the query and saves the results to a file.
    void
    download(String file, String mimeType)
    Evaluates the query and saves the results to a file.
    Gets the baseURI for this query.
    org.eclipse.rdf4j.query.Binding[]
     
    Deprecated.
    internal use only
    Gets the entailment regime being used when including inferences with this query.
    static String
    Returns a String of the form "PREFIX franzOption_OPTION: <franz:VALUE> " suitable for appending to a SPARQL query.
    org.eclipse.rdf4j.query.QueryLanguage
    Gets the query language for this query.
    int
    Gets the limit on the number of solutions for this query.
    Gets the savedName for the query.
    int
    Gets the offset, the number of solutions to skip for this query.
    Gets the query planner that processes the query.
    Gets the query string for this query.
    int
     
    boolean
    Gets the flag for checkVariables.
    boolean
    Gets the loggingEnabled setting for this query.
    boolean
    Gets the prepared flag for the query.
    void
    setCheckVariables(boolean checkVariables)
    A boolean that defaults to false, indicating whether an error should be raised when a SPARQL query selects variables that are not mentioned in the query body.
    void
    setEngine(String engine)
    Deprecated.
    internal use only
    void
    setEntailmentRegime(String entailmentRegime)
    Sets the entailment regime to use when including inferences with this query.
    void
    setIncludeInferred(boolean includeInferred)
    Determine whether evaluation results of this query should include inferred statements (if any inferred statements are present in the repository).
    void
    setLimit(int limit)
    Sets the limit.
    void
    setLoggingEnabled(boolean loggingEnabled)
    Sets the loggingEnabled parameter for this query.
    void
    setOffset(int offset)
    Sets the offset.
    void
    setPlanner(String planner)
    Sets the query planner to use when processing the query.
    void
    setPrepared(boolean prepared)
    Sets the prepared flag for the query.
    void
    Sets the name to use when saving this query with the server's saved query service.
    Evaluates the query and returns the result as an input stream.
    stream(String mimeType)
    Evaluates the query and returns the result as an input stream.
     

    Methods inherited from class org.eclipse.rdf4j.query.impl.AbstractQuery

    getMaxQueryTime, setMaxQueryTime

    Methods inherited from class org.eclipse.rdf4j.query.impl.AbstractOperation

    clearBindings, getBindings, getDataset, getIncludeInferred, getMaxExecutionTime, removeBinding, setBinding, setDataset, setMaxExecutionTime

    Methods inherited from class java.lang.Object

    equals, getClass, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.eclipse.rdf4j.query.Operation

    clearBindings, getBindings, getDataset, getIncludeInferred, getMaxExecutionTime, removeBinding, setBinding, setDataset, setMaxExecutionTime

    Methods inherited from interface org.eclipse.rdf4j.query.Query

    explain
  • Field Details

    • SPARQL_COVERAGE_PLANNER

      public static final String SPARQL_COVERAGE_PLANNER
      The default query planner for SPARQL.
      See Also:
    • SPARQL_IDENTITY_PLANNER

      public static final String SPARQL_IDENTITY_PLANNER
      A query planner for SPARQL that processes queries without doing any reordering of clauses or optimization, useful if the user knows the best order for processing the query.
      See Also:
    • RDFS_PLUS_PLUS

      public static final String RDFS_PLUS_PLUS
      The default entailment regime to use when inferences are included.
      See Also:
    • RESTRICTION

      public static final String RESTRICTION
      An entailment regime that includes hasValue, someValuesFrom and allValuesFrom reasoning in addition to RDFS++ entailment.
      See Also:
  • Constructor Details

  • Method Details

    • getFranzOptionPrefixString

      public static String getFranzOptionPrefixString(String option, String value)
      Returns a String of the form "PREFIX franzOption_OPTION: <franz:VALUE> " suitable for appending to a SPARQL query. VALUE is encoded per the rules for percent-encoding the query part of a URI (namely that the space char ' ' encoded as '%20' instead of '+'.
      Parameters:
      option - the name of a valid AllegroGraph SPARQL Query Option
      value - String value to be encoded as the value of the prefixOption
      Returns:
      String the generated prefix.
      See Also:
    • setIncludeInferred

      public void setIncludeInferred(boolean includeInferred)
      Determine whether evaluation results of this query should include inferred statements (if any inferred statements are present in the repository). The default setting is 'false'.
      Specified by:
      setIncludeInferred in interface org.eclipse.rdf4j.query.Operation
      Overrides:
      setIncludeInferred in class org.eclipse.rdf4j.query.impl.AbstractOperation
      Parameters:
      includeInferred - indicates whether inferred statements should included in the result.
      See Also:
    • getEntailmentRegime

      public String getEntailmentRegime()
      Gets the entailment regime being used when including inferences with this query.
      Returns:
      String the name of the entailment regime
    • setEntailmentRegime

      public void setEntailmentRegime(String entailmentRegime)
      Sets the entailment regime to use when including inferences with this query. Default is 'rdfs++'.
      Parameters:
      entailmentRegime - indicates the entailment regime to use when reasoning
      See Also:
    • getLanguage

      public org.eclipse.rdf4j.query.QueryLanguage getLanguage()
      Gets the query language for this query.
      Returns:
      the query language
    • getQueryString

      public String getQueryString()
      Gets the query string for this query.
      Returns:
      the query string
    • isLoggingEnabled

      public boolean isLoggingEnabled()
      Gets the loggingEnabled setting for this query.
      Returns:
      Boolean true if logging is enabled, else false
    • setLoggingEnabled

      public void setLoggingEnabled(boolean loggingEnabled)
      Sets the loggingEnabled parameter for this query.

      Default is false.

      Parameters:
      loggingEnabled - boolean indicating whether logging is enabled
    • getBaseURI

      public String getBaseURI()
      Gets the baseURI for this query.
      Returns:
      the base URI
    • getPlanner

      public String getPlanner()
      Gets the query planner that processes the query.
      Returns:
      the planner name
    • setPlanner

      public void setPlanner(String planner)
      Sets the query planner to use when processing the query.
      Parameters:
      planner - the planner name
    • getEngine

      @Deprecated public String getEngine()
      Deprecated.
      internal use only
      Returns:
      String the name of the engine used to perform this query
    • setEngine

      @Deprecated public void setEngine(String engine)
      Deprecated.
      internal use only
      This method is not for general use - configure server agraph.cfg QueryEngine instead.
      Parameters:
      engine - the name of the query engine to use for this query
      See Also:
    • setSaveName

      public void setSaveName(String name)
      Sets the name to use when saving this query with the server's saved query service.
      Parameters:
      name - the saved name
    • getName

      public String getName()
      Gets the savedName for the query.
      Returns:
      the saved name
    • isPrepared

      public boolean isPrepared()
      Gets the prepared flag for the query.
      Returns:
      the prepared flag
    • setPrepared

      public void setPrepared(boolean prepared)
      Sets the prepared flag for the query.
      Parameters:
      prepared - the prepared flag
    • download

      public void download(File file) throws org.eclipse.rdf4j.query.QueryEvaluationException
      Evaluates the query and saves the results to a file.

      Output format is determined by the server.

      Parameters:
      file - Output path.
      Throws:
      org.eclipse.rdf4j.query.QueryEvaluationException - if there is an error while evaluating query
    • download

      public void download(String file) throws org.eclipse.rdf4j.query.QueryEvaluationException
      Evaluates the query and saves the results to a file.

      Output format is determined by the server.

      Parameters:
      file - Output path.
      Throws:
      org.eclipse.rdf4j.query.QueryEvaluationException - if there is an error while evaluating query
    • download

      public void download(File file, String mimeType) throws org.eclipse.rdf4j.query.QueryEvaluationException
      Evaluates the query and saves the results to a file.
      Parameters:
      file - Output path.
      mimeType - MIME type that will be requested from the server (i.e. output format).
      Throws:
      org.eclipse.rdf4j.query.QueryEvaluationException - if there is an error while evaluating query
    • download

      public void download(String file, String mimeType) throws org.eclipse.rdf4j.query.QueryEvaluationException
      Evaluates the query and saves the results to a file.
      Parameters:
      file - Output path.
      mimeType - MIME type that will be requested from the server (i.e. output format).
      Throws:
      org.eclipse.rdf4j.query.QueryEvaluationException - if there is an error while evaluating query
    • stream

      public InputStream stream(String mimeType) throws org.eclipse.rdf4j.query.QueryEvaluationException
      Evaluates the query and returns the result as an input stream.

      Note that it is important to close the returned stream, to avoid resource leaks.

      Parameters:
      mimeType - MIME type that will be requested from the server (i.e. output format).
      Returns:
      An input stream containing response data. The caller MUST close this stream to release connection resources.
      Throws:
      org.eclipse.rdf4j.query.QueryEvaluationException - if there is an error while evaluating query
    • stream

      public InputStream stream() throws org.eclipse.rdf4j.query.QueryEvaluationException
      Evaluates the query and returns the result as an input stream.

      The output format will be chosen by the server.

      Returns:
      An input stream containing response data. The caller MUST close this stream to release connection resources.
      Throws:
      org.eclipse.rdf4j.query.QueryEvaluationException - if there is an error while evaluating query
    • analyze

      public String analyze() throws org.eclipse.rdf4j.query.QueryEvaluationException
      Returns the query analysis for the query.

      The query is not evaluated.

      Returns:
      the query analysis as a string
      Throws:
      org.eclipse.rdf4j.query.QueryEvaluationException - if there is an error while evaluating query
    • isCheckVariables

      public boolean isCheckVariables()
      Gets the flag for checkVariables.
      Returns:
      the checkVariables flag
    • setCheckVariables

      public void setCheckVariables(boolean checkVariables)
      A boolean that defaults to false, indicating whether an error should be raised when a SPARQL query selects variables that are not mentioned in the query body.
      Parameters:
      checkVariables - the checkVariables flag
    • getBindingsArray

      public org.eclipse.rdf4j.query.Binding[] getBindingsArray()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getLimit

      public int getLimit()
      Gets the limit on the number of solutions for this query.
      Returns:
      limit
    • setLimit

      public void setLimit(int limit)
      Sets the limit.

      By default, the value is -1, meaning no constraint is imposed.

      Parameters:
      limit - the max number of solutions to collect for this query
    • getOffset

      public int getOffset()
      Gets the offset, the number of solutions to skip for this query.
      Returns:
      offset
    • setOffset

      public void setOffset(int offset)
      Sets the offset.
      Parameters:
      offset - the number of solutions to skip for this query

      By default, the value is -1, meaning no constraint is imposed.

    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object