From: Sergio F. <se...@wi...> - 2013-03-11 09:54:50
|
Olivier, how is going this issue at virtuoso-users? Because checking this issue in MARMOTTA-132, I realized some details - I forgot to remark that the wrapper only implements sparql update via URL-encoded POST, and maybe virtuoso only supports sparql update via POST directly (details at [2]).. - We were using the old content type application/x-www-form-urlencoded, but actually I think it should be application/x-www-url-form-urlencoded, which may be an issue if Virtuoso strictly implements the specification. I've working on solving this, so please try again using the latest revision at the svn (r174 [3]). Cheers, [1] https://issues.apache.org/jira/browse/MARMOTTA-132 [2] http://www.w3.org/TR/2012/CR-sparql11-protocol-20121108/#update-operation [3] http://sourceforge.net/p/sparql-wrapper/code/174/ On 8 March 2013 16:51, Sergio Fernández <se...@wi...> wrote: > Please. And come back with the conclusions why the SPARQLWrapper is > failing... > > BTW, I see some errors in our query: > > - date literals should be encoded into "..." (<...> denotes resources) > - afaik "INSERT IN GRAPH" is not valid, must be "INSERT DATA { GRAPH <g> > { ... } }": http://www.w3.org/TR/sparql11-update/#insertData > > Cheers, > > > On 8 March 2013 15:12, Olivier Berger <oli...@te...>wrote: > >> Hi. >> >> Sergio Fernández <se...@wi...> writes: >> >> > Hi, >> > >> > On 7 March 2013 14:00, Olivier Berger < >> oli...@te...>wrote: >> >> >> >> Investigating the cause, I concluded that the wrong params were set for >> >> the query, using a ?=update parameter instead of a ?=select. >> >> >> > >> > Right, because 'update'is the right query parameter according sparql >> 1.1: >> > >> > >> http://www.w3.org/TR/2012/CR-sparql11-protocol-20121108/#update-operation >> > >> > Which version of virtuoso are you using? Because the guys at OpenLink >> > usually are pretty updated to latest stuff, so I'd be surprise they >> didn't >> > implement that.... >> > >> >> Thanks for your help and pinging Kingsley on twitter. >> >> FYI, I'm using Version: 06.01.3127 from the Debian Wheezy package. >> >> FYI, the following code exhibits the problem : >> >> ------ >> import urllib2 >> from SPARQLWrapper import SPARQLWrapper, RDF, JSON, POST, SELECT >> >> SPARQL_ENDPOINT = "http://localhost:8890/sparql/" >> >> handler=urllib2.HTTPHandler(debuglevel=1) >> opener = urllib2.build_opener(handler) >> urllib2.install_opener(opener) >> >> sparql = SPARQLWrapper(SPARQL_ENDPOINT) >> >> query = """INSERT IN GRAPH <http://BookStore.com> >> { <http://www.dajobe.org/foaf.rdf#i> < >> http://purl.org/dc/elements/1.1/date> <1999-04-01T00:00:00> . >> <http://www.w3.org/People/Berners-Lee/card#i> < >> http://purl.org/dc/elements/1.1/date> <1998-05-03T00:00:00> . >> <http://www.w3.org/People/Connolly/#me> < >> http://purl.org/dc/elements/1.1/date> <2001-02-08T00:00:00> } >> """ >> >> sparql.setQuery(query) >> sparql.setMethod(POST) >> >> result = sparql.query() >> print result >> >> data = result.convert() >> print data >> ----- >> >> with the following error : >> >> $ python example-insert.py >> send: 'GET >> /sparql/?query=SELECT+COUNT%28%2A%29+FROM+%3Chttp%3A%2F%2FBookStore.com%3E+WHERE+%7B%3Fs+%3Fp+%3Fo%7D&results=json&output=json >> HTTP/1.1\r\nAccept-Encoding: identity\r\nHost: >> localhost:8890\r\nConnection: close\r\nAccept: >> application/sparql-results+json,text/javascript,application/json\r\nUser-Agent: >> sparqlwrapper 1.5.2 (http://sparql-wrapper.sourceforge.net/)\r\n\r\n' >> reply: 'HTTP/1.1 200 OK\r\n' >> header: Server: Virtuoso/06.01.3127 (Linux) i486-pc-linux-gnu >> header: Connection: close >> header: Date: Fri, 08 Mar 2013 14:10:16 GMT >> header: Accept-Ranges: bytes >> header: Content-Type: application/sparql-results+json; charset=UTF-8 >> header: Content-Length: 238 >> 3 >> send: 'POST /sparql/ HTTP/1.1\r\nAccept-Encoding: >> identity\r\nContent-Length: 513\r\nHost: localhost:8890\r\nAccept: >> application/sparql-results+xml\r\nUser-Agent: sparqlwrapper 1.5.2 ( >> http://sparql-wrapper.sourceforge.net/)\r\nConnection: >> close\r\nContent-Type: >> application/x-www-form-urlencoded\r\n\r\nupdate=INSERT+IN+GRAPH+%3Chttp%3A%2F%2FBookStore.com%3E+%0A%7B+%3Chttp%3A%2F% >> 2Fwww.dajobe.org >> %2Ffoaf.rdf%23i%3E+%3Chttp%3A%2F%2Fpurl.org%2Fdc%2Felements%2F1.1%2Fdate%3E+%3C1999-04-01T00%3A00%3A00%3E+.%0A++%3Chttp%3A%2F% >> 2Fwww.w3.org >> %2FPeople%2FBerners-Lee%2Fcard%23i%3E+%3Chttp%3A%2F%2Fpurl.org%2Fdc%2Felements%2F1.1%2Fdate%3E+%3C1998-05-03T00%3A00%3A00%3E+.%0A++%3Chttp%3A%2F% >> 2Fwww.w3.org >> %2FPeople%2FConnolly%2F%23me%3E+%3Chttp%3A%2F%2Fpurl.org%2Fdc%2Felements%2F1.1%2Fdate%3E+%3C2001-02-08T00%3A00%3A00%3E+%7D%0A' >> reply: 'HTTP/1.1 400 Bad Request\r\n' >> header: Server: Virtuoso/06.01.3127 (Linux) i486-pc-linux-gnu >> header: Connection: close >> header: Date: Fri, 08 Mar 2013 14:10:16 GMT >> header: Accept-Ranges: bytes >> header: Content-Type: text/plain >> header: Content-Length: 70 >> Virtuoso 22023 Error The request does not contain text of SPARQL >> queryTraceback (most recent call last): >> >> >> I'll probably take this to the Openlink mailing-list, as suggested by >> Kingsley, to get their diagnostics. >> >> Best regards, >> >> -- >> Olivier BERGER >> http://www-public.telecom-sudparis.eu/~berger_o/ - OpenPGP-Id: >> 2048R/5819D7E8 >> Ingenieur Recherche - Dept INF >> Institut Mines-Telecom, Telecom SudParis, Evry (France) >> > > > > -- > > Sergio Fernández <se...@wi...> > -- Sergio Fernández <se...@wi...> |