Hello everyone,
I'm trying to run a sequence of queries with TDB, using a
locally loaded dataset. I don't want to wait more than a few
seconds for each query to finish. My attempt to do this looks like
the following:
>
> try {
> RDFConnection rdfConnection = RDFConnectionFactory.connect(dataset);
> QueryExecution queryExecution = rdfConnection.query(query);
> queryExecution.setTimeout(timeoutMilliseconds);
> ResultSet resultSet = queryExecution.execSelect();
> while (resultSet.hasNext()) {
> QuerySolution querySolution = resultSet.next();
> ...
> }
> } catch (QueryCancelledException e) {
> ...
> }
The problem is that this is not working. With htop I see that
the process gets stuck in disk operations. One of the queries
took about 2 hours with the code above. An idea would
be trying to run this in a new thread and stopping the thread outside once
the timeout is reached, but I'm almost sure this wouldn't be a safe
way to stop the processing, even if it worked.
Is there a better way to do this?
Cristobal