DBpedia rate limiting sparql requests?

194 views Asked by At

I am running the following sparql query to DBpedia as I build a tree of a company hierarchy:

def get_result(sparql, parent_company):
    sparql = SPARQLWrapper('https://dbpedia.org/sparql')
    sparql.setQuery(f'''
        SELECT ?name
        WHERE {{?name dbo:parentCompany dbr:{parent_company}}}
    ''')
    sparql.setReturnFormat(JSON)
    gdata = sparql.query().convert()
    ...

I run this for each company in the organizational structure to see if they have any child companies. For larger companies (e.g., parent_company = Microsoft), this can be about 30 queries. I timed each query and most are < 1 second, but about every 5th query, it runs in about 1 min 7 secs. DBPedia's website says that it should handle up to 100 requests per second per IP address. Any idea what is causing this?

1

There are 1 answers

2
TallTed On

The DBpedia SPARQL endpoint is a fully public service, so you may well be running into delays caused by other queries from other users. You might consider spinning up your own instance of DBpedia Snapshot, if you require predictably rapid responses.

This article may help you understand how DBpedia serves ad hoc queries on a worldwide basis.