I'm querying a database in GraphDB using SPARQLWrapper. Insert is working fine but when the query is SELECT, I get HTTP 406 using GET method and HTTP 415 using POST. Similar Select query works on other databases like wikidata but not on GraphDB. Here is the query:
from SPARQLWrapper import SPARQLWrapper, JSON
sparql = SPARQLWrapper("http://localhost:7200/repositories/repo1/statements")
sparql.setQuery("""
PREFIX : <http://www.ontology.ca/ontology-1.0#>
SELECT ?s WHERE { ?s a :User;
:hasUserName "username1". }
""")
sparql.method = 'GET'
sparql.setReturnFormat(JSON)
results = sparql.query().convert()
PS: I tried other formats like xml, rdf, n3, etc. I don't get any error using RDF and N3 but the problem is the result is not filtered by the select query and contains all the triples existing in the ontology.
Can anyone please help me with this?