Getting a list of persons using SPARQL dbpedia

I am using live-dbpedia to fetch a list of people. I am running sparql query on the live-dbpedia endpoints to get the result. I fixed the offset and limit in the query and getting records after every 10000 try . But when I tried to execute at offset value 580000 , 504 Gateway timeout error .

SPARQL Query does not work :

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 solve this problem.

+3


source to share


1 answer


Put a delay between requests. There is a speed limit at the current endpoint and this is the error you get when you exceed it. There is also a short time-out to make the service more affordable.



(Disclaimer: I am responsible for this service)

+4


source







All Articles