You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Andrew Crapo <an...@naturalsemantics.com> on 2021/02/03 15:58:37 UTC
Possible to abort inference?
I am using the Jena GenericRuleReasoner. It is invoked in an Eclipse
environment. After creating an InfModel by calling
ModelFactory.createInfModel(reasoner, ontModel), I call
QueryExecutionFactory.create(QueryFactory.create(query, Syntax.syntaxARQ,
infModel). I then set the timeout by calling
queryExecution.setTimeout(timeoutTime). I then start to iterate over the
ResultSet returned by queryExecution.execSelect() by calling the
ResultSet's hasNext() method.
I would like to be able to cancel or abort if inference takes an excessive
amount of time. However, the call to the ResultSet hasNext() method results
in a call to FBRuleInfGraph find(s, p, o), which ultimately ends up at
LPBRuleEngine pump(gen), where gen is an LPInterpreterContext. Neither the
QueryExecution timeout nor a call to QueryExecution abort() has any effect
because control never gets out of the pump method. Is there a way to
terminate reasoner execution gracefully? If not, could one be implemented
by putting a check for cancellation, perhaps in the "while(!gen.isReady())"
or like the periodic check
if (count % CYCLES_BETWEEN_COMPLETION_CHECK == 0) {
....
}
and return cancelled?
There does not seem to be any way to terminate inference currently, even
though it is running as a separate Eclipse Job, so a separate thread. All
documentation that I find says that the process needs to check to see if it
has been cancelled; it can't be killed from outside.
Andy Crapo
Re: Possible to abort inference?
Posted by Andy Seaborne <an...@apache.org>.
Hi Andy,
Sorry, I don't think there is a way to do this currently.
Why is the pump method taking so long? It will make direct graph.find
requests (not SPARQL, and so no timeout). Is it doing a lot of these or
is it mostly inside the inference engine?
If it is a first-call effect then calling some trigger action before
making the query (in startup) may give a more useful experience. It does
not fix the problem - it only moves it out of query time.
Andy
On 03/02/2021 15:58, Andrew Crapo wrote:
> I am using the Jena GenericRuleReasoner. It is invoked in an Eclipse
> environment. After creating an InfModel by calling
> ModelFactory.createInfModel(reasoner, ontModel), I call
> QueryExecutionFactory.create(QueryFactory.create(query, Syntax.syntaxARQ,
> infModel). I then set the timeout by calling
> queryExecution.setTimeout(timeoutTime). I then start to iterate over the
> ResultSet returned by queryExecution.execSelect() by calling the
> ResultSet's hasNext() method.
>
> I would like to be able to cancel or abort if inference takes an excessive
> amount of time. However, the call to the ResultSet hasNext() method results
> in a call to FBRuleInfGraph find(s, p, o), which ultimately ends up at
> LPBRuleEngine pump(gen), where gen is an LPInterpreterContext. Neither the
> QueryExecution timeout nor a call to QueryExecution abort() has any effect
> because control never gets out of the pump method. Is there a way to
> terminate reasoner execution gracefully? If not, could one be implemented
> by putting a check for cancellation, perhaps in the "while(!gen.isReady())"
> or like the periodic check
>
> if (count % CYCLES_BETWEEN_COMPLETION_CHECK == 0) {
> ....
> }
>
> and return cancelled?
>
> There does not seem to be any way to terminate inference currently, even
> though it is running as a separate Eclipse Job, so a separate thread. All
> documentation that I find says that the process needs to check to see if it
> has been cancelled; it can't be killed from outside.
>
> Andy Crapo
>