import rdflib
g = rdflib.Graph()
g.load("http://169.36.179.223:10035/repositories/cso_core_collector-20190124")
qres = g.query(
"""SELECT ?class
WHERE {
?s rdf:type ?class
} GROUP BY ?class"""
)
for row in qres:
print(row)
sparql = SPARQLWrapper("http://dbpedia.org/sparql")
sparql.setQuery("""
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?label
WHERE { <http://dbpedia.org/resource/Asturias> rdfs:label ?label }
""")
sparql.setReturnFormat(JSON)
results = sparql.query().convert()
for result in results["results"]["bindings"]:
print(result["label"]["value"])