My query in Virtuoso SPARQL Query Editor is as follows which resuted it 74
SELECT (COUNT (*) AS ?count) WHERE {?s ?p <http://dbpedia.org/resource/Machine_learning> .}
I used the same query in SPARQLWrapper as follows which gave me the count as 1195
.
from SPARQLWrapper import SPARQLWrapper, JSON
sparqlw = SPARQLWrapper("http://dbpedia.org/sparql")
dbpedia_uri = "http://dbpedia.org/resource/Machine_learning"
sparqlw.setQuery(f"SELECT (COUNT (*) AS ?count) WHERE {{?s ?p <{dbpedia_uri}> .}}")
sparqlw.setReturnFormat(JSON)
results = sparqlw.query().convert()
results_df = pd.io.json.json_normalize(results['results']['bindings'])
print(results_df)
I re-checked the following details.
- both are using
http://dbpedia.org/
version - my f-string is equivalent to the query
Therefore, I am very confused why this big change of the results happen.
I am happy to provide more details if needed.