0

我正在用 Blazegraph Nano SPARQL Server 做一些实验。我使用以下命令启动服务器:

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

但是,我需要为查询设置超时。有一个名为queryTimeout的上下文参数,但我不知道如何使用它。我可以添加一个命令选项来设置这个参数吗?如果这个参数只能在一个web.xml文件中设置,我在哪里可以找到一个web.xml可以用来设置queryTimeout参数的最小文件?

4

2 回答 2

1

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
于 2015-08-02T14:04:13.013 回答
0

web.xml更新文件后可以再次编译 Blazegraph 。步骤是:

克隆 git 存储库。

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

签出版本。

git checkout -b BLAZEGRAPH_RELEASE_1_5_1

编辑bigdata-war/src/WEB-INF/web.xml以将queryTimeout属性设置为:

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

重新编译 Blazegraph。

 ant clean executable-jar
于 2015-07-02T18:36:44.823 回答