查询DBpedia时重复503的消息 [英] Repeating 503's messages when querying DBpedia
问题描述
我正在对DBpedia SPARQL端点进行一系列查询(从循环内部)。代码看起来或多或少是这样的:
I'm conducting a series of queries to DBpedia SPARQL endpoint (from inside a loop). The code looks more or less like this:
for (String citySplit : citiesSplit) {
RepositoryConnection conn = dbpediaEndpoint.getConnection();
String sparqlQueryLat = " SELECT ?lat ?lon WHERE { "
+ "<http://dbpedia.org/resource/" + citySplit.trim().replaceAll(" ", "_") + "> <http://www.w3.org/2003/01/geo/wgs84_pos#lat> ?lat . "
+ "<http://dbpedia.org/resource/" + citySplit.trim().replaceAll(" ", "_") + "> <http://www.w3.org/2003/01/geo/wgs84_pos#long> ?lon ."
+ "}";
TupleQuery queryLat = conn.prepareTupleQuery(QueryLanguage.SPARQL, sparqlQueryLat);
TupleQueryResult resultLat = queryLat.evaluate();
}
问题是,经过几次迭代,我得到了一条503消息:
The problem is that, after a few iterations, I get a 503 message:
httpclient.wire.header - << "HTTP/1.1 503 Service Temporarily Unavailable[\r][\n]"
(...)
org.openrdf.query.QueryInterruptedException
at org.openrdf.http.client.HTTPClient.getTupleQueryResult(HTTPClient.java:1041)
at org.openrdf.http.client.HTTPClient.sendTupleQuery(HTTPClient.java:438)
at org.openrdf.http.client.HTTPClient.sendTupleQuery(HTTPClient.java:413)
at org.openrdf.repository.http.HTTPTupleQuery.evaluate(HTTPTupleQuery.java:41)
如果我理解正确,则此503消息来自DBpedia。我对吗?
成功执行的连续查询数是可变的。有时,它会在获取消息之前运行13秒钟,有时需要15分钟。
无论如何,我认为这是不正常的。
可能会发生什么?
If I understand correctly, this 503 message is from DBpedia. Am I right? The number of consecutive queries that manage to succeed is variable. Sometimes it runs for 13 seconds before getting the message, sometimes 15 minutes. In any case, I don't think this is normal. What could be happening?
推荐答案
通过DBpedia Wiki的Web 页面访问DBpedia数据集,该页面在 1.1。公用SPARQL端点说:
The Accessing the DBpedia Data Set over the Web page of the DBpedia wiki says, in section 1.1. Public SPARQL Endpoint says:
Fair Use Policy: Please read this post for information about restrictions on the public DBpedia endpoint. These might also be usefull [sic]: 1, 2.
链接的帖子说,公共DBpedia SPARQL端点实现了速率限制。
The linked post says that the public DBpedia SPARQL endpoint implements rate limiting.
http://dbpedia.org/sparql 端点同时对您可以建立的连接数/秒进行速率限制,并对结果集和查询时间进行限制,因为根据以下设置:
The http://dbpedia.org/sparql endpoint has both rate limiting on the number of connections/sec you can make, as well as restrictions on resultset and query time, as per the following settings:
[SPARQL]
ResultSetMaxRows = 2000
MaxQueryExecutionTime = 120
MaxQueryCostEstimationTime = 1500
这些都是为了确保每个人都有平等的机会去引用数据来自dbpedia.org,以及防范写得不好的查询/机器人。
These are in place to make sure that everyone has a equal chance to de-reference data from dbpedia.org, as well as to guard against badly written queries/robots.
我认为您很可能达到了该限制。
I think that it is likely that you are hitting that limit.
这篇关于查询DBpedia时重复503的消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!