Class ServletUtils

java.lang.Object
se.liu.ida.hefquin.service.ServletUtils

public class ServletUtils extends Object
Utility class for servlet-based integration of the HeFQUIN query engine.
  • Constructor Details

    • ServletUtils

      public ServletUtils()
  • Method Details

    • getCtx

      public static HeFQUINEngineConfigReader.Context getCtx(String fedConfFilename)
      Constructs a HeFQUINEngineConfigReader.Context using the given federation configuration file. This context includes initialized executor services and the federation catalog, with default values for optional flags.
      Parameters:
      fedConfFilename - the path to the federation configuration file
      Returns:
      a configured HeFQUINEngineConfigReader.Context instance
    • getConfDesc

      public static org.apache.jena.rdf.model.Model getConfDesc(String engineConfFilename)
      Loads the engine configuration model from the specified RDF or Turtle file.
      Parameters:
      engineConfFilename - the path to the engine configuration file
      Returns:
      a Jena Model representing the engine configuration
    • getEngine

      public static HeFQUINEngine getEngine(HeFQUINEngineConfigReader.Context ctx, org.apache.jena.rdf.model.Model confDescr)
      Instantiates a HeFQUINEngine using the provided configuration context and RDF model. This method initializes Apache Jena (via ARQ.init()) and integrates the HeFQUIN engine into the Jena environment.
      Parameters:
      ctx - the engine configuration context, including executors and federation metadata
      confDescr - the RDF model containing engine configuration
      Returns:
      a fully configured and integrated HeFQUINEngine instance
    • convert

      public static org.apache.jena.sparql.resultset.ResultsFormat convert(String mimeType)
      Converts a MIME type string into a corresponding ResultsFormat supported by Jena's SPARQL result serialization. Recognized MIME types: - application/sparql-results+json - application/sparql-results+xml - text/csv - text/tab-separated-values If the MIME type is unrecognized or null, ResultsFormat.FMT_RS_CSV is returned by default.
      Parameters:
      mimeType - the MIME type string from the HTTP Accept header or elsewhere
      Returns:
      the corresponding ResultsFormat, or null if the input was null
    • getExceptions

      public static org.apache.jena.atlas.json.JsonArray getExceptions(List<Exception> exceptions)
      Converts a list of exceptions into a JSON array, including class name, message, and full stack trace for each exception.
      Parameters:
      exceptions - the list of exceptions encountered during query processing; may be null or empty
      Returns:
      a JSON array where each entry is a string representation of an exception and its stack trace