The Bigdata and openrdf APIs allow you to set a timeout on a query. The query will be interrupted (cancelled) when the timeout is exceeded. However, it is not currently possible to impose this timeout through the REST API from languages other than Java.
From com.bigdata.rdf.sail.remote.BigdataSailRemoteRepositoryConnection you can do the following. However, note that the internal resolution for bigdata is milliseconds while the openrdf API specifies the timeout in seconds.
There are at least two ways to accomplish this.
1. HTTP request header specifying the timeout. The advantage of this technique is that an http proxy could automatically impose a timeout on an endpoint.
2. Query hint embedded into the SPARQL QUERY specifying the timeout. This technique is most useful for applications that generate queries dynamically.
It is possible to implement both approaches.
If a new query hint is defined, then changes should include:
- QueryHints on wiki.bigdata.com
Finally, note that a timeout for all queries can be specified already using web.xml: