Hi all,
I am trying to implement a custom QueryEngine that would handle query
optimization and evaluation for a custom Dataset implementation, as
mentioned in the documentation (
https://jena.apache.org/documentation/query/arq-query-eval.html#custom-query-engines
).
Following the lines in the example in
src-examples/arq.examples.engine.MyQueryEngine, I implemented a similar
MyQueryEngine and MyQueryEngineFactory, with the accept() implementation
looking like the following:
public boolean accept(Query query, DatasetGraph dataset, Context context) {
return dataset instanceof MyDatasetGraph;
}
where MyDatasetGraph is a DatasetGraph implementation, backing the
custom Dataset implementation, for which I want to use MyQueryEngine.
While this works fine for a simple query without any FROM/FROM NAMED
clause, the above accept() method does not work anymore when the query
includes a dataset specification in a FROM/FROM NAMED clause.
This happens because in the query processing phase occurring in
SPARQL_QueryDataset, MyDatasetGraph gets wrapped in a
DynamicDatasetGraph, which does not seem to have any public methods to
get the wrapped graph.
Q1: Is there a way to determine whether a DynamicDatasetGraph wraps an
instance of MyDatasetGraph? If not, could I somehow use Context to
determine the type of Dataset/DatasetGraph being queried?
Q2: I noticed that this behaviour occurs only in SPARQL_QueryDataset, which
is the default ActionService for the "query" Operation in Fuseki. It could
be that using SPARQL_QueryGeneral for the Query operation might solve the
problem for me, but can this be configured in Fuseki configuration? I could
not find anything relevant in
https://jena.apache.org/documentation/fuseki2/fuseki-config-endpoint.html.
Q3: By digging some more, I saw that SPARQL_QueryGeneral is registered as
an ActionService for the "query" operation when Fuseki starts with either
of the --sparqler or --general arguments. Nevertheless, I should mention
that I have a strong preference in starting Fuseki as a WAR with just a
configuration template for my new dataset type. Can I pass command line
arguments or even start Fuseki programmatically while still running it as a
Web Application?
Thanks in advance,
Dimitris