Class HeFQUINEngine
java.lang.Object
se.liu.ida.hefquin.engine.HeFQUINEngine
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:
- 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. - On the one hand, it can be used to process SELECT queries and
obtain the query result as a
ResultSetobject, which can then be consumed in whatever way you like. This functionality is provided by via the following functions.
HeFQUINEngine object used HeFQUINEngineBuilder.
When 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 Summary
FieldsModifier and TypeFieldDescriptionprotected final ExecutorServiceprotected final FederationAccessManagerprotected final FederationCatalogprotected final QueryProcessorprotected boolean -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedHeFQUINEngine(FederationCatalog fedCatalog, FederationAccessManager fedAccessMgr, QueryProcessor qProc, ExecutorService execServiceForPlanTasks) -
Method Summary
Modifier and TypeMethodDescriptionprotected QueryProcessingStatsAndExceptions_execAndPrint(org.apache.jena.query.Query query, org.apache.jena.sparql.resultset.ResultsFormat outputFormat, PrintStream output, QueryProcContext ctx) protected void_execNonSelectQuery(org.apache.jena.query.QueryExecution qe, org.apache.jena.sparql.resultset.ResultsFormat outputFormat, PrintStream output) protected void_execSelectQuery(org.apache.jena.query.QueryExecution qe, org.apache.jena.sparql.resultset.ResultsFormat outputFormat, PrintStream output) protected org.apache.jena.query.QueryExecution_prepareExecution(org.apache.jena.query.Query query) executeQueryAndPrintResult(org.apache.jena.query.Query query, org.apache.jena.sparql.resultset.ResultsFormat outputFormat, PrintStream output) Executes the given query and prints the result to the given output, in the given format.executeQueryAndPrintResult(org.apache.jena.query.Query query, org.apache.jena.sparql.resultset.ResultsFormat outputFormat, PrintStream output, QueryProcContext ctx) Executes the given query and prints the result to the given output, in the given format.executeSelectQuery(org.apache.jena.query.Query query) 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 aResultSet.executeSelectQuery(org.apache.jena.query.Query query, QueryProcContext ctx) 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 aResultSet.Returns a current version of the statistics collected by theFederationAccessManagerthat this engine uses.Returns a newly-createdQueryProcContextBuilderthat can be used to create customizableQueryProcContextobjects to be used when calling any of the following functions of thisHeFQUINEngine.voidshutdown()Shuts down the relevant components used by this engine, such as the federation access manager and the query processor component.
-
Field Details
-
fedCatalog
-
fedAccessMgr
-
qProc
-
execServiceForPlanTasks
-
wasShutDown
protected boolean wasShutDown
-
-
Constructor Details
-
HeFQUINEngine
protected HeFQUINEngine(FederationCatalog fedCatalog, FederationAccessManager fedAccessMgr, QueryProcessor qProc, ExecutorService execServiceForPlanTasks)
-
-
Method Details
-
getQueryProcContextBuilder
Returns a newly-createdQueryProcContextBuilderthat can be used to create customizableQueryProcContextobjects to be used when calling any of the following functions of thisHeFQUINEngine.executeQueryAndPrintResult(Query, ResultsFormat, PrintStream, QueryProcContext)executeSelectQuery(Query, QueryProcContext)
QueryProcContextBuildercan be used multiple times (i.e., to created multipleQueryProcContextobjects), but notice that aQueryProcContextobject can also be used multiple times.- Returns:
- a newly-created
QueryProcContextBuilder
-
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 executedoutputFormat- - the format to be used for writing the result (may be used as a default)invalid reference
ResultsFormat.FMT_TEXToutput- - 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, QueryProcContext ctx) 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 executedoutputFormat- - the format to be used for writing the result (may be used as a default)invalid reference
ResultsFormat.FMT_TEXToutput- - the output stream to which the result shall writtenctx- - object that contains options to be considered during query processing; to create such an object, use theQueryProcContextBuilderthat can be obtained viagetQueryProcContextBuilder()- 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 aResultSet.- 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.
-
executeSelectQuery
public QueryProcessingOutput executeSelectQuery(org.apache.jena.query.Query query, QueryProcContext ctx) 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 aResultSet.- Parameters:
query- - the query to be executed; it needs to be a SELECT queryctx- - object that contains options to be considered during query processing; to create such an object, use theQueryProcContextBuilderthat can be obtained viagetQueryProcContextBuilder()- 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
Returns a current version of the statistics collected by theFederationAccessManagerthat 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, QueryProcContext ctx) throws UnsupportedQueryException, IllegalQueryException -
_prepareExecution
protected org.apache.jena.query.QueryExecution _prepareExecution(org.apache.jena.query.Query query) 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
-