|
From: Carlos T. <car...@fu...> - 2013-09-08 20:39:22
|
Hi,
just for the records, "setQuery" method reset some parameters as
"returnFormat", "method" and "queryType" (see excerpt from Wrapper.py
below). Maybe this is a reason that your code does not work.
<code from Wrapper.py>
if self._defaultGraph :
self.customParameters["default-graph-uri"] = self._defaultGraph
self.returnFormat = self._defaultReturnFormat
self.method = GET
self.queryType = SELECT
</code from Wrapper.py>
Please, find attached a test file about this issue
Best regards,
Carlos Tejo
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 1 October 2012 11:41, Carlos Tejo <car...@fu...> wrote:
> 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
|