Limits of DBPedia service
- Connection limit of 50 parallel connections per IP address.
- Rate limit of 100 requests per second per IP address, with an initial burst of 120 requests.
Ideally, applications should be written to check the HTTP status code of each request, and in case of a 503 status code, perform a 1–2 second sleep before retrying the request.
Online Access
We could use sparqlwrapper to make requests:
from SPARQLWrapper import SPARQLWrapper, JSON
sparql = SPARQLWrapper("http://dbpedia.org/sparql")
sparql.setQuery("""
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX : <http://dbpedia.org/resource/>
PREFIX dbpedia2: <http://dbpedia.org/property/>
PREFIX dbpedia: <http://dbpedia.org/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
SELECT ?abstract
WHERE { <http://dbpedia.org/resource/Asturias> dbo:abstract ?abstract }
""")
sparql.setReturnFormat(JSON)
results = sparql.query().convert()
print results['results']['bindings'][3]['abstract']['value']