问题
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.
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
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
How to overcome this problem.
回答1:
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)
来源:https://stackoverflow.com/questions/26134637/getting-list-of-persons-using-sparql-dbpedia