tags:

views:

98

answers:

3

Howdy,

I'm making a SPARQL query against the Sesame store in localhost, using SPARQLWrapper:

  sparql = SPARQLWrapper('http://localhost:8080/openrdf-sesame/repositories/rep/statements')
  sparql.setQuery(query)
  sparql.setReturnFormat(JSON)
  results = sparql.query().convert()

However, I'm getting:

File "build/bdist.linux-i686/egg/SPARQLWrapper/Wrapper.py", line 339, in query
  File "build/bdist.linux-i686/egg/SPARQLWrapper/Wrapper.py", line 318, in _query
urllib2.HTTPError: HTTP Error 406: Not Acceptable

The strange thing is, however, that querying against the DBPedia SPARQL endpoint everything works fine...

Any thoughts?

Thanks!

+1  A: 

I've solved the problem by doing the SPARQL wrapping myself...

pns
Why don't you say how and/or point to the code so the next person can see the answer.
dajobe
Or, better yet, fix SPARQLWrapper, it's pretty readable and easy to hack. SPARQLWrapper has a mailing list, and its developers are open to fixes and suggestions: https://lists.sourceforge.net/lists/listinfo/sparql-wrapper-devel
Pēteris Caune
+2  A: 

For SPARQLWrapper you don't normally have to add the statements bit in the URI. I.e., this should work:

sparql = SPARQLWrapper('http://localhost:8080/openrdf-sesame/repositories/rep')

And then just continue with the rest of your code.

RafG
A: 

Could you send how did you solve the problem? I am curious about it :-)

dayures