From: Carlos T. <car...@fu...> - 2012-10-01 10:13:31
|
Dear Jeff, I have done some test using some Sesame server repositories (2.4.0). After that, I think that the problem could be the SPARQL endpoint where you are asking. Instead of sparql = SPARQLWrapper("http://localhost:8080/openrdf-workbench/repositories/test") try sparql = SPARQLWrapper("http://localhost:8080/openrdf-sesame/repositories/test") (the difference is "openrdf-workbench" vs "openrdf-sesame"). I hope this could help. Best regards and thanks for using SPARQLWrapper, Carlos Tejo Alonso CTIC-Centro Tecnológico Parque Científico y Tecnológico de Gijón c/ Ada Byron, 39 Edificio Centros Tecnológicos 33203 Gijón - Asturias - Spain Tel.: +34 984 29 12 12 Fax: +34 984 39 06 12 E-mail: car...@fu... http://www.fundacionctic.org Privacy Policy: http://www.fundacionctic.org/privacidad On 27 September 2012 22:39, Jeff Hoekman <ma...@gm...> wrote: > > Greetings sparql-wrapper developers, > > I'm attempting the most basic sparql-wrapper (1.5.2) select query against > a Sesame server repository (2.6.9) and am > unable to get JSON back. I'm following the example code here: > http://sparql-wrapper.sourceforge.net/. > > The response content-type is always application/xml. Why isn't > application/json or sparql-results+json returned? Is > this a bug in SPARQLWrapper otherwise what am I doing wrong? Does > SPARQLWrapper.setReturnFormat(JSON) not work with Sesame? > > Incidentally I do get the proper JSON response using CURL from the cmd > line using the following: > curl -g -H "Accept: application/sparql-results+json;charset=UTF-8" > > http://localhost:8080/openrdf-sesame/repositories/test?query=select%20*%20where%20{%20?s%20?p%20?o%20}%20limit%205 > > Thanks, Jeff > > > from SPARQLWrapper import SPARQLWrapper, JSON > sparql = > SPARQLWrapper("http://localhost:8080/openrdf-workbench/repositories/test") > sparql.setReturnFormat(JSON) > q = 'select * where { ?s ?p ?o } limit 5' > sparql.setQuery(q) > results = sparql.query().convert() > > # returns: > > /Users/Jeff/.virtualenvs/proto/lib/python2.7/site-packages/SPARQLWrapper/Wrapper.py:550: > RuntimeWarning: unknown > response content type, returning raw response... > warnings.warn("unknown response content type, returning raw > response...", RuntimeWarning) > > print results.info() > > # returns: > Server: Apache-Coyote/1.1 > Last-Modified: Thu, 27 Sep 2012 20:04:22 GMT > Content-Type: application/xml;charset=UTF-8 > Content-Length: 925 > Date: Thu, 27 Sep 2012 20:15:30 GMT > Connection: close > > results = sparql.query() > print results.info() > > {'content-length': '925', 'server': 'Apache-Coyote/1.1', 'last-modified': > 'Thu, 27 Sep 2012 20:04:22 GMT', 'connection': > 'close', 'date': 'Thu, 27 Sep 2012 20:14:50 GMT', 'content-type': > 'application/xml;charset=UTF-8'} > > > > ------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://ad.doubleclick.net/clk;258768047;13503038;j? > http://info.appdynamics.com/FreeJavaPerformanceDownload.html > _______________________________________________ > sparql-wrapper-devel mailing list > spa...@li... > https://lists.sourceforge.net/lists/listinfo/sparql-wrapper-devel |