问题描述
我正在使用来检索人员列表。我正在上执行 sparql查询,以获得结果。我已固定查询中的偏移量和极限值,并在每次尝试10000次后获得记录 。但是当我尝试以 580000偏移量值执行时,发生了 504网关超时错误。
I am using live-dbpedia to retrieve the list of persons. I am executing a sparql query on live-dbpedia endpoints to get the result.I have fixed the offset and limit value in the query and getting the records after each 10000 attempt. But when I was trying to execute at 580000 offset value, 504 Gateway Time-out error happens.
不起作用 SPARQL查询:
Not Working SPARQL Query:
SELECT DISTINCT ?dbpedia_link str(?name) as ?label str(?label1) as ?label1 ?freebase_link WHERE {
?dbpedia_link rdfs:label ?label1 .
?dbpedia_link foaf:name ?name .
{
{ ?dbpedia_link rdf:type dbpedia-owl:Person }
}
OPTIONAL {?dbpedia_link owl:sameAs ?freebase_link .
FILTER regex(?freebase_link, "^http://rdf.freebase.com") .}
FILTER (lang(?label1) = 'en').
?dbpedia_link dcterms:subject ?sub
}Limit 1000
OFFSET 580000
工作中 SPARQL查询:
Working SPARQL Query :
SELECT DISTINCT ?dbpedia_link str(?name) as ?label str(?label1) as ?label1 ?freebase_link WHERE {
?dbpedia_link rdfs:label ?label1 .
?dbpedia_link foaf:name ?name .
{
{ ?dbpedia_link rdf:type dbpedia-owl:Person }
}
OPTIONAL {?dbpedia_link owl:sameAs ?freebase_link .
FILTER regex(?freebase_link, "^http://rdf.freebase.com") .}
FILTER (lang(?label1) = 'en').
?dbpedia_link dcterms:subject ?sub
}Limit 1000
OFFSET 50000
如何解决此问题。
推荐答案
在请求之间添加延迟。实时端点中有一个速率限制,这是您超出该限制时得到的错误。还有一个短暂的超时时间,以使该服务更可用。
Put a delay between your requests. There is a rate limit in the live endpoint and this is the error you get when you exceed it. There is also a short timeout to make the service more available.
(免责声明:我负责该服务)
(Disclaimer: I am responsible for the service)
这篇关于获取使用SPARQL dbpedia的人员列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!