Class HeFQUINEngine

java.lang.Object
se.liu.ida.hefquin.engine.HeFQUINEngine

public class HeFQUINEngine extends Object
An object of this class can be used in two ways to process queries over the federation for which the engine has been set up:
  1. On the other hand, it can be used to process arbitrary queries and have the result written directly to stdout or to any other PrintStream, in a format that can be specified. This functionality is provided via the following functions.
  2. On the one hand, it can be used to process SELECT queries and obtain the query result as a ResultSet object, which can then be consumed in whatever way you like. This functionality is provided by via executeSelectQuery(Query).
To create a HeFQUINEngine object used HeFQUINEngineBuilder. Once you do not need it anymore, make sure to call shutdown().

Technically, this is a wrapper around the Jena/ARQ query processing machinery into which the query processor of this engine is integrated.

  • Field Details

  • Constructor Details

  • Method Details

    • executeQueryAndPrintResult

      public QueryProcessingStatsAndExceptions executeQueryAndPrintResult(org.apache.jena.query.Query query) throws UnsupportedQueryException, IllegalQueryException
      Executes the given query and prints the result in text format to stdout.
      Parameters:
      query - - the query to be executed
      Throws:
      UnsupportedQueryException - thrown if the given query uses features that are not supported by HeFQUIN; the message of the exception describes the specific limitation and can be passed directly to the user.
      IllegalQueryException - thrown if the given query is invalid; the message of the exception describes the issue and can be passed directly to the user.
    • executeQueryAndPrintResult

      public QueryProcessingStatsAndExceptions executeQueryAndPrintResult(org.apache.jena.query.Query query, org.apache.jena.sparql.resultset.ResultsFormat outputFormat) throws UnsupportedQueryException, IllegalQueryException
      Executes the given query and prints the result to stdout, in the given format.
      Parameters:
      query - - the query to be executed
      outputFormat - - the format to be used for writing the result
      Throws:
      UnsupportedQueryException - thrown if the given query uses features that are not supported by HeFQUIN; the message of the exception describes the specific limitation and can be passed directly to the user.
      IllegalQueryException - thrown if the given query is invalid; the message of the exception describes the issue and can be passed directly to the user.
    • executeQueryAndPrintResult

      public QueryProcessingStatsAndExceptions executeQueryAndPrintResult(org.apache.jena.query.Query query, PrintStream output) throws UnsupportedQueryException, IllegalQueryException
      Executes the given query and prints the result in text format to the given output.
      Parameters:
      query - - the query to be executed
      output - - the output stream to which the result shall written
      Throws:
      UnsupportedQueryException - thrown if the given query uses features that are not supported by HeFQUIN; the message of the exception describes the specific limitation and can be passed directly to the user.
      IllegalQueryException - thrown if the given query is invalid; the message of the exception describes the issue and can be passed directly to the user.
    • executeQueryAndPrintResult

      public QueryProcessingStatsAndExceptions executeQueryAndPrintResult(org.apache.jena.query.Query query, org.apache.jena.sparql.resultset.ResultsFormat outputFormat, PrintStream output) throws UnsupportedQueryException, IllegalQueryException
      Executes the given query and prints the result to the given output, in the given format.
      Parameters:
      query - - the query to be executed
      outputFormat - - the format to be used for writing the result
      output - - the output stream to which the result shall written
      Throws:
      UnsupportedQueryException - thrown if the given query uses features that are not supported by HeFQUIN; the message of the exception describes the specific limitation and can be passed directly to the user.
      IllegalQueryException - thrown if the given query is invalid; the message of the exception describes the issue and can be passed directly to the user.
    • executeSelectQuery

      public QueryProcessingOutput executeSelectQuery(org.apache.jena.query.Query query) throws UnsupportedQueryException, IllegalQueryException
      Assuming the given query is a SELECT query, this function executes that query and returns an output object from which the query result can be obtained as a ResultSet.
      Parameters:
      query - - the query to be executed; it needs to be a SELECT query
      Throws:
      UnsupportedQueryException - thrown if the given query uses features that are not supported by HeFQUIN; the message of the exception describes the specific limitation and can be passed directly to the user.
      IllegalQueryException - thrown if the given query is invalid; the message of the exception describes the issue and can be passed directly to the user.
    • getFederationAccessStats

      public FederationAccessStats getFederationAccessStats()
      Returns a current version of the statistics collected by the FederationAccessManager that this engine uses.

      This function simply calls FederationAccessManager.getStats() and forwards the returns stats.

    • shutdown

      public void shutdown()
      Shuts down the relevant components used by this engine, such as the federation access manager and the query processor component.
    • _execAndPrint

      protected QueryProcessingStatsAndExceptions _execAndPrint(org.apache.jena.query.Query query, org.apache.jena.sparql.resultset.ResultsFormat outputFormat, PrintStream output) throws UnsupportedQueryException, IllegalQueryException
      Throws:
      UnsupportedQueryException
      IllegalQueryException
    • _prepareExecution

      protected org.apache.jena.query.QueryExecution _prepareExecution(org.apache.jena.query.Query query) throws UnsupportedQueryException, IllegalQueryException
      Throws:
      UnsupportedQueryException
      IllegalQueryException
    • _execSelectQuery

      protected void _execSelectQuery(org.apache.jena.query.QueryExecution qe, org.apache.jena.sparql.resultset.ResultsFormat outputFormat, PrintStream output) throws Exception
      Throws:
      Exception
    • _execNonSelectQuery

      protected void _execNonSelectQuery(org.apache.jena.query.QueryExecution qe, org.apache.jena.sparql.resultset.ResultsFormat outputFormat, PrintStream output) throws Exception
      Throws:
      Exception