Class ServletUtils
java.lang.Object
se.liu.ida.hefquin.service.ServletUtils
Utility class for servlet-based integration of the HeFQUIN query engine.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.jena.sparql.resultset.ResultsFormat
Converts a MIME type string into a correspondingResultsFormat
supported by Jena's SPARQL result serialization.static org.apache.jena.rdf.model.Model
getConfDesc
(String engineConfFilename) Loads the engine configuration model from the specified RDF or Turtle file.Constructs aHeFQUINEngineConfigReader.Context
using the given federation configuration file.static HeFQUINEngine
getEngine
(HeFQUINEngineConfigReader.Context ctx, org.apache.jena.rdf.model.Model confDescr) Instantiates aHeFQUINEngine
using the provided configuration context and RDF model.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.
-
Constructor Details
-
ServletUtils
public ServletUtils()
-
-
Method Details
-
getCtx
Constructs aHeFQUINEngineConfigReader.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
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 aHeFQUINEngine
using the provided configuration context and RDF model. This method initializes Apache Jena (viaARQ.init()
) and integrates the HeFQUIN engine into the Jena environment.- Parameters:
ctx
- the engine configuration context, including executors and federation metadataconfDescr
- the RDF model containing engine configuration- Returns:
- a fully configured and integrated
HeFQUINEngine
instance
-
convert
Converts a MIME type string into a correspondingResultsFormat
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
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
-