开发者

Problem with SPARQLWrapper (Python)

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

  s开发者_运维百科parql = 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!


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜