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 viaexecuteSelectQuery(Query).
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 Summary
FieldsModifier and TypeFieldDescriptionprotected final FederationAccessManagerprotected final QueryProcessorprotected boolean -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedHeFQUINEngine(FederationAccessManager fedAccessMgr, QueryProcessor qProc) -
Method Summary
Modifier and TypeMethodDescriptionprotected QueryProcessingStatsAndExceptions_execAndPrint(org.apache.jena.query.Query query, org.apache.jena.sparql.resultset.ResultsFormat outputFormat, PrintStream output) 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) Executes the given query and prints the result in text format to stdout.executeQueryAndPrintResult(org.apache.jena.query.Query query, PrintStream output) Executes the given query and prints the result in text format to the given output.executeQueryAndPrintResult(org.apache.jena.query.Query query, org.apache.jena.sparql.resultset.ResultsFormat outputFormat) Executes the given query and prints the result to stdout, in the given format.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.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.Returns a current version of the statistics collected by theFederationAccessManagerthat this engine uses.voidshutdown()Shuts down the relevant components used by this engine, such as the federation access manager and the query processor component.
-
Field Details
-
fedAccessMgr
-
qProc
-
wasShutDown
protected boolean wasShutDown
-
-
Constructor Details
-
HeFQUINEngine
-
-
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 executedoutputFormat- - 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 executedoutput- - 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 executedoutputFormat- - the format to be used for writing the resultoutput- - 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 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.
-
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) 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
-