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?