Context parameters in Blazegraph Nano SPARQL

402 views Asked by At

I am doing some experiments with the Blazegraph Nano SPARQL Server. I started the server with the following command:

$ java -server -Xmx4g -jar bigdata-bundled.jar

However, I need to set a timeout for queries. There is a context parameter named queryTimeout for that, but I do not know how it has to be used. Can I add a command option to set this parameter? If this parameter can only be set in a web.xml file, where can I find a minimal web.xml file that I can use to set the queryTimeout parameter?

2

There are 2 answers

0
Daniel Hernández On BEST ANSWER

It is possible to compile Blazegraph again after updating the web.xml file. The steps are:

Clone the git repository.

git clone git://git.code.sf.net/p/bigdata/git Blazegraph

Checkout the release.

git checkout -b BLAZEGRAPH_RELEASE_1_5_1

Edit bigdata-war/src/WEB-INF/web.xml to set the queryTimeout property as:

<context-param>
   <description>When non-zero, the timeout for queries (milliseconds).</description>
   <param-name>queryTimeout</param-name>
   <param-value>60000</param-value>
</context-param>

Recompile Blazegraph.

 ant clean executable-jar
0
Brad Bebee On

If you're using the REST API, you don't need to recompile with the web.xml. You can use the timeout query parameter to set the value for an individual query in seconds or the X-BIGDATA-MAX-QUERY-MILLIS HTTP Header to set the query timeout in milliseconds. See REST Query API.

Example setting the timeout to 30 seconds.

curl -X POST http://localhost:8080/bigdata/sparql --data-urlencode \
'query=SELECT * { ?s ?p ?o } LIMIT 1' --data-urlencode 'timeout=30'

Example setting the timeout to 100 milliseconds.

curl -X POST http://localhost:8080/bigdata/sparql --data-urlencode \
'query=SELECT * { ?s ?p ?o } LIMIT 1' -H 'X-BIGDATA-MAX-QUERY-MILLIS:100'

If you have an embedded application, such as Blueprints. You can set the maxQueryTime property when you create the knowledge base. It sets the time out in seconds per the Query object on the OpenRDF (rdf4j) library. Here's an example with the Sesame embedded mode.

com.bigdata.blueprints.BigdataGraph.maxQueryTime=30