You can subscribe to this list here.
2008 |
Jan
|
Feb
|
Mar
(2) |
Apr
(7) |
May
|
Jun
(4) |
Jul
(2) |
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2009 |
Jan
|
Feb
|
Mar
(10) |
Apr
(4) |
May
(10) |
Jun
|
Jul
|
Aug
(4) |
Sep
(5) |
Oct
|
Nov
|
Dec
(2) |
2010 |
Jan
(5) |
Feb
(1) |
Mar
|
Apr
(1) |
May
|
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
(4) |
Feb
(5) |
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(6) |
Sep
(6) |
Oct
|
Nov
|
Dec
|
2012 |
Jan
(4) |
Feb
(5) |
Mar
|
Apr
|
May
(3) |
Jun
(1) |
Jul
(1) |
Aug
(11) |
Sep
(4) |
Oct
(6) |
Nov
|
Dec
(3) |
2013 |
Jan
|
Feb
(1) |
Mar
(11) |
Apr
(5) |
May
|
Jun
|
Jul
|
Aug
(8) |
Sep
(3) |
Oct
(9) |
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
(2) |
Nov
|
Dec
|
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...> |
From: Sergio F. <se...@wi...> - 2013-03-08 16:14:09
|
Olivier, I found your patch relevant, so I applied it into trunk (r171). Thanks! On 8 March 2013 16:03, Olivier Berger <oli...@te...>wrote: > Hi. > > The testing of the http://localhost:8890/sparql-graph-crud/ endpoint > allowed me to spot an area for improvement anyway, when the endpoint > returns HTML. > > I thinks the following patch would probably improve the debugging, in > such a case, as one may expect the "raw response" to be the content of > the document, not the Response object to read() from... > > Maybe in such case, the response.info() may be interesting to add to the > warning message (406 code, etc.) > > Hope this helps. > > Best regards, > > Olivier Berger <oli...@te...> writes: > > > > > I'm using Virtuoso Version: 06.01.3127 (the Debian wheezy version), and > > that http://localhost:8890/sparql-graph-crud/ doesn't seem to behave as > > an endpoint SPARQLWrapper can query : it always responds with HTML. > > > > diff --git a/src/SPARQLWrapper/Wrapper.py b/src/SPARQLWrapper/Wrapper.py > index 4e7b708..427f6e2 100644 > --- a/src/SPARQLWrapper/Wrapper.py > +++ b/src/SPARQLWrapper/Wrapper.py > @@ -548,7 +548,7 @@ class QueryResult : > else : > # this should cover, well, the rest of the cases... > warnings.warn("unknown response content type, returning raw > response...", RuntimeWarning) > - return self.response > + return self.response.read() > > def print_results(self, minWidth=None): > results = self._convertJSON() > > -- > 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) > > > ------------------------------------------------------------------------------ > Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester > Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the > endpoint security space. For insight on selecting the right partner to > tackle endpoint security challenges, access the full report. > http://p.sf.net/sfu/symantec-dev2dev > _______________________________________________ > sparql-wrapper-devel mailing list > spa...@li... > https://lists.sourceforge.net/lists/listinfo/sparql-wrapper-devel > -- Sergio Fernández <se...@wi...> |
From: Sergio F. <se...@wi...> - 2013-03-08 15:51:56
|
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...> |
From: Olivier B. <oli...@te...> - 2013-03-08 15:03:25
|
Hi. The testing of the http://localhost:8890/sparql-graph-crud/ endpoint allowed me to spot an area for improvement anyway, when the endpoint returns HTML. I thinks the following patch would probably improve the debugging, in such a case, as one may expect the "raw response" to be the content of the document, not the Response object to read() from... Maybe in such case, the response.info() may be interesting to add to the warning message (406 code, etc.) Hope this helps. Best regards, Olivier Berger <oli...@te...> writes: > > I'm using Virtuoso Version: 06.01.3127 (the Debian wheezy version), and > that http://localhost:8890/sparql-graph-crud/ doesn't seem to behave as > an endpoint SPARQLWrapper can query : it always responds with HTML. > diff --git a/src/SPARQLWrapper/Wrapper.py b/src/SPARQLWrapper/Wrapper.py index 4e7b708..427f6e2 100644 --- a/src/SPARQLWrapper/Wrapper.py +++ b/src/SPARQLWrapper/Wrapper.py @@ -548,7 +548,7 @@ class QueryResult : else : # this should cover, well, the rest of the cases... warnings.warn("unknown response content type, returning raw response...", RuntimeWarning) - return self.response + return self.response.read() def print_results(self, minWidth=None): results = self._convertJSON() -- 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) |
From: Olivier B. <oli...@te...> - 2013-03-08 14:13:14
|
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) |
From: Olivier B. <oli...@te...> - 2013-03-08 14:06:18
|
Hi. "Visser, Dale" <dv...@id...> writes: > I'm not a user of Virtuoso, but I had an issue in the past with > SPARQLWrapper and Sesame that turned out to be that there were > different paths for SPARQL versus SPARQL Update. I went looking in > online documentation for Virtuoso and found this: > > http://docs.openlinksw.com/virtuoso/rdfsparql.html#rdfsparqlprotocolendpointintro > > Assuming you haven't set up user authentication, it looks like you > need to use a REST URL like http://localhost:8890/sparql-graph-crud/ > instead. I believe the latest SPARQLWrapper allows you to set a > separate URL for SPARQL Update operations. If not, an easy workaround > is probably just to use two separate SPARQLWrapper instances. > I'm using Virtuoso Version: 06.01.3127 (the Debian wheezy version), and that http://localhost:8890/sparql-graph-crud/ doesn't seem to behave as an endpoint SPARQLWrapper can query : it always responds with HTML. Thanks anyway ;) Will provide more details later in the thread. 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) |
From: Sergio F. <se...@wi...> - 2013-03-07 18:52:35
|
Hi, On 7 March 2013 16:02, Visser, Dale <dv...@id...> wrote: > I'm not a user of Virtuoso, but I had an issue in the past with > SPARQLWrapper and Sesame that turned out to be that there were different > paths for SPARQL versus SPARQL Update. True. But that's an optional behavior in case the wrapper is initialized with two different endpoint. By default it uses the single endpoint provided to perform all operations, which is the case of virtuoso, at least with the versions I tried one year ago.. Cheers, |
From: Sergio F. <se...@wi...> - 2013-03-07 18:51:29
|
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.... -- Sergio Fernández <se...@wi...> |
From: Sergio F. <se...@wi...> - 2013-03-07 18:40:17
|
thread in twitter: https://twitter.com/wikier/status/309731064119701504 let's await for the conclusions... |
From: Visser, D. <dv...@id...> - 2013-03-07 15:02:54
|
I'm not a user of Virtuoso, but I had an issue in the past with SPARQLWrapper and Sesame that turned out to be that there were different paths for SPARQL versus SPARQL Update. I went looking in online documentation for Virtuoso and found this: http://docs.openlinksw.com/virtuoso/rdfsparql.html#rdfsparqlprotocolendpointintro Assuming you haven't set up user authentication, it looks like you need to use a REST URL like http://localhost:8890/sparql-graph-crud/ instead. I believe the latest SPARQLWrapper allows you to set a separate URL for SPARQL Update operations. If not, an easy workaround is probably just to use two separate SPARQLWrapper instances. -----Original Message----- From: Olivier Berger [mailto:oli...@te...] Sent: Thursday, March 07, 2013 8:00 AM To: spa...@li... Subject: [sparql-wrapper-devel] SPARQL INSERT and Virtuoso Hi. I'm using SPARQLWrapper to query a Virtuoso triple store over the default REST endpoint : http://localhost:8890/sparql/ I noticed that although SELECTs or CONSTRUCTs would work perfectly, the INSERT wouldn't. Investigating the cause, I concluded that the wrong params were set for the query, using a ?=update parameter instead of a ?=select. I don't know if this is a Virtuoso problem, or a SPARQLWrapper one, but a workaround is to do something like : sparql = SPARQLWrapper(SPARQL_ENDPOINT) sparql.setQuery(query) sparql.setMethod(POST) sparql.setReturnFormat(JSON) # Hack for Virtuoso sparql.queryType= SELECT result = sparql.query() data = result.convert() There seem to have been reports on similar issues in http://sourceforge.net/p/sparql-wrapper/bugs/ for other bakend specificities Any comments, suggestions ? 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) ------------------------------------------------------------------------------ Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the endpoint security space. For insight on selecting the right partner to tackle endpoint security challenges, access the full report. http://p.sf.net/sfu/symantec-dev2dev _______________________________________________ sparql-wrapper-devel mailing list spa...@li... https://lists.sourceforge.net/lists/listinfo/sparql-wrapper-devel |
From: Olivier B. <oli...@te...> - 2013-03-07 13:19:23
|
Hi. I'm using SPARQLWrapper to query a Virtuoso triple store over the default REST endpoint : http://localhost:8890/sparql/ I noticed that although SELECTs or CONSTRUCTs would work perfectly, the INSERT wouldn't. Investigating the cause, I concluded that the wrong params were set for the query, using a ?=update parameter instead of a ?=select. I don't know if this is a Virtuoso problem, or a SPARQLWrapper one, but a workaround is to do something like : sparql = SPARQLWrapper(SPARQL_ENDPOINT) sparql.setQuery(query) sparql.setMethod(POST) sparql.setReturnFormat(JSON) # Hack for Virtuoso sparql.queryType= SELECT result = sparql.query() data = result.convert() There seem to have been reports on similar issues in http://sourceforge.net/p/sparql-wrapper/bugs/ for other bakend specificities Any comments, suggestions ? 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) |
From: Sergio F. <se...@wi...> - 2013-02-06 15:25:05
|
Hi, a user have report an issue at StackOverflow reusing the same instance of SPARQLWrapper for performing different queries: http://stackoverflow.com/questions/13571401/sparql-initialization/14731758 I've been checking the code, and query() method looks to be stateless, so I have no idea what's happening there... Cheers, -- Sergio Fernández <se...@wi...> |
From: Rodrigo D. A. S. <rod...@co...> - 2012-12-27 19:14:51
|
Hola Carlos! Sorry for taking so long to thank you about this issue. I ended up locally patching the project, my solution is similar to what Willian Waites produced. One difference is that I changed setCredentials() as shown below: <code> def setCredentials(self, user, passwd, mode='basic', realm='') : """ Set the credentials for querying the current endpoint. Mode by default is set to basic, but could also be set to 'digest'. If mode is set to 'digest' you should also specify realm. @param user: username @type user: string @param passwd: password @type passwd: string @param mode: mode @type mode: string @param realm: realm @type realm: string """ self.user = user self.passwd = passwd self.realm = realm self.auth_mode = mode </code> The attributes self.user, self.password, etc are used in _createRequest() as follows: <code> def _createRequest(self) : """Internal method to create request according a HTTP method. Returns a C{urllib2.Request} object of the urllib2 Python library @return: request """ # CAREFUL CODE OMITTED HERE! # Figure out URI if self.method == POST : uri = self.baseURI else: uri = self._getURI() if (self.auth_mode=='digest') and self.user and self.passwd: passwdmngr = urllib2.HTTPPasswordMgrWithDefaultRealm() passwdmngr.add_password(self.realm, uri, self.user, self.passwd) authhandler = urllib2.HTTPDigestAuthHandler(passwdmngr) opener = urllib2.build_opener(authhandler) urllib2.install_opener(opener) # .... </code> Anyways, thank you all for the work in SPARQLWrapper and for the help in this issue in particular. bets regards, Rod Senra http://rodrigo.senra.nom.br ---------- Forwarded message ---------- From: Carlos Tejo <car...@fu...> Date: Mon, Dec 10, 2012 at 6:19 AM Subject: Re: [sparql-wrapper-devel] Digest Auth Support To: spa...@li... Dear Rodrigo, Thanks to arise this issue. I have uploaded the patch provided by Willian Waites. It is available at [1] Cheers, [1] https://sourceforge.net/p/sparql-wrapper/feature-requests/2/#2b6f |
From: Carlos T. <car...@fu...> - 2012-12-10 08:47:56
|
Dear Rodrigo, Thanks to arise this issue. I have uploaded the patch provided by Willian Waites. It is available at [1] Cheers, [1] https://sourceforge.net/p/sparql-wrapper/feature-requests/2/#2b6f 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 3 December 2012 16:22, Rodrigo Dias Arruda Senra <rod...@co...> wrote: > Hello, > I am trying to find a patch mentioned in > https://sourceforge.net/p/sparql-wrapper/feature-requests/2/ > that should add support for DIGEST authentication in SPARQLWrapper. > > Using SF interface I cannot find a link to download the patch. > Any pointers ? > > best regards, > Rod Senra > > -- > > Rodrigo D. A. Senra > > rod...@co... > +55(21)2483-6863 > http://rodrigo.senra.nom.br > > > > > ------------------------------------------------------------------------------ > Keep yourself connected to Go Parallel: > BUILD Helping you discover the best ways to construct your parallel > projects. > http://goparallel.sourceforge.net > _______________________________________________ > sparql-wrapper-devel mailing list > spa...@li... > https://lists.sourceforge.net/lists/listinfo/sparql-wrapper-devel > |
From: Rodrigo D. A. S. <rod...@co...> - 2012-12-03 15:45:59
|
Hello, I am trying to find a patch mentioned in https://sourceforge.net/p/sparql-wrapper/feature-requests/2/ that should add support for DIGEST authentication in SPARQLWrapper. Using SF interface I cannot find a link to download the patch. Any pointers ? best regards, Rod Senra -- Rodrigo D. A. Senra rod...@co... +55(21)2483-6863 http://rodrigo.senra.nom.br |
From: Sergio F. <se...@wi...> - 2012-10-10 05:39:59
|
perfect! On 9 October 2012 14:40, Laurens De Vocht <lau...@gm...> wrote: > This is the current version of the plugin code: > > http://code.google.com/p/surfrdf/source/browse/trunk/plugins/surf.sparql_protocol/sparql_protocol/reader.py?r=362 > > def _to_table(self, result): > if not isinstance(result, dict): > return result > > if not "results" in result: > return result > > converted = [] > for binding in result["results"]["bindings"]: > rdf_item = {} > for key, obj in binding.items(): > try: > rdf_item[key] = json_to_rdflib(obj) > except ValueError: > continue > > converted.append(rdf_item) > > return converted > > ------------------------------------------------------------------------------ > Don't let slow site performance ruin your business. Deploy New Relic APM > Deploy New Relic app performance management and know exactly > what is happening inside your Ruby, Python, PHP, Java, and .NET app > Try New Relic at no cost today and get our sweet Data Nerd shirt too! > http://p.sf.net/sfu/newrelic-dev2dev > _______________________________________________ > sparql-wrapper-devel mailing list > spa...@li... > https://lists.sourceforge.net/lists/listinfo/sparql-wrapper-devel > -- Sergio Fernández <se...@wi...> |
From: Laurens De V. <lau...@gm...> - 2012-10-09 12:40:30
|
This is the current version of the plugin code: http://code.google.com/p/surfrdf/source/browse/trunk/plugins/surf.sparql_protocol/sparql_protocol/reader.py?r=362 def _to_table(self, result): if not isinstance(result, dict): return result if not "results" in result: return result converted = [] for binding in result["results"]["bindings"]: rdf_item = {} for key, obj in binding.items(): try: rdf_item[key] = json_to_rdflib(obj) except ValueError: continue converted.append(rdf_item) return converted |
From: Sergio F. <se...@wi...> - 2012-10-09 10:31:00
|
Hi, yes, I assume your plugin should be aware of such difference, and use a code like https://gist.github.com/3705219 Thanks so much. Greetings, On 9 October 2012 12:12, Laurens De Vocht <lau...@gm...> wrote: > I assume in that case that the implementation of the Sparqlwrapper results > is different from the allegrograph results version (the allegrograph version > works in my case). > > This is the allegrograph implementation: > http://code.google.com/p/surfrdf/source/browse/trunk/plugins/surf.allegro_franz/allegro_franz/reader.py?r=362 > > I assume more specifically it is this part of the code: > > def _to_table(self, result): > table = [] > bindings = result.getBindingNames() > for bindingSet in result: > row = {} > for key in bindings: > try: v = toRdfLib(bindingSet[key]) > except: v = None > row[key] = v > table.append(row) > return table > > This is probably slightly different from the SPARQLWrapper Implementation. > >> >> Date: Wed, 12 Sep 2012 10:31:01 +0200 >> From: Sergio Fern?ndez <se...@wi...> >> Subject: Re: [sparql-wrapper-devel] Empty result items from >> SPARQLWrapper return empty list instead of object with attribute >> items >> that conains empty list >> To: spa...@li... >> Message-ID: >> >> <CAKZ-WGf-qraey7YKV6Ajm0WkDaK-Umeb=HMyeQWVPJruW=Qo...@ma...> >> Content-Type: text/plain; charset=UTF-8 >> >> >> Hi again, >> >> today I'm quite busy, so I can't go deeper into SuRF's source code. >> Could you please provide me details about the trace how resource_d is >> build at [1]? Because you're directly using >> results["results"]["bindings"], that's a list, so it's wrong (this >> code will not work [2], for instance) and will produce the reported >> exception even with results. It should access a concrete binding of >> the results (as this code does [3]). >> >> Awaiting for your support on that. >> >> Cheers, >> >> >> [1] >> http://code.google.com/p/surfrdf/source/browse/trunk/surf/resource/__init__.py#548 >> [2] http://gist.github.com/3705188 >> [3] http://gist.github.com/3705219 >> >> On 12 September 2012 09:53, Sergio Fern?ndez <se...@wi...> wrote: >> > Hi Laurens, >> > >> > when SuRF performs: >> > >> >> >> >> "c:\python27-32\lib\site-packages\surf-1.1.6r0_r374-py2.7.egg\surf\resource\__init__.py" >> >> in __set_predicate_values >> >> 571. for p, v in results.items(): >> > >> > it's because to get a dictionary there, but a list was returned. I'll >> > investigate why such container is returned when the result set comes >> > empty, because that's something that should be handle by the library. >> > >> > I'll keep you informed. >> > >> > Kind regards, >> > >> > >> > On 11 September 2012 11:15, Laurens De Vocht <lau...@gm...> >> > wrote: >> >> >> >> Hi, >> >> >> >> >> >> When I switched from the Allegrograph SurfRDF to SPARQLWrapper SurfRDF, >> >> I >> >> suddenly get this error (both with Virtuoso and Fuseki SPARQL >> >> Endpoints): >> >> >> >> Environment: >> >> >> >> >> >> Request Method: GET >> >> Request URL: http://localhost:8000/leden/done/ >> >> >> >> Django Version: 1.4.1 >> >> Python Version: 2.7.3 >> >> Installed Applications: >> >> ('django.contrib.auth', >> >> 'django.contrib.contenttypes', >> >> 'django.contrib.sessions', >> >> 'django.contrib.sites', >> >> 'django.contrib.messages', >> >> 'django.contrib.staticfiles', >> >> 'social_auth', >> >> 'twitter', >> >> 'surf', >> >> 'hamlpy', >> >> 'djaml', >> >> 'django.contrib.admin', >> >> 'leden') >> >> Installed Middleware: >> >> ('django.middleware.common.CommonMiddleware', >> >> 'django.contrib.sessions.middleware.SessionMiddleware', >> >> 'django.middleware.csrf.CsrfViewMiddleware', >> >> 'django.contrib.auth.middleware.AuthenticationMiddleware', >> >> 'django.contrib.messages.middleware.MessageMiddleware') >> >> >> >> >> >> Traceback: >> >> File "C:\Python27-32\lib\site-packages\django\core\handlers\base.py" in >> >> get_response >> >> 111. response = callback(request, >> >> *callback_args, **callback_kwargs) >> >> File >> >> "C:\Python27-32\lib\site-packages\django\contrib\auth\decorators.py" >> >> in _wrapped_view >> >> 20. return view_func(request, *args, **kwargs) >> >> File >> >> >> >> "C:\Users\ldevocht\git\DynResAlignRepo\dynresalign\leden\profiler\persistence.py" >> >> in addUserAccountToPerson >> >> 189. person.load() >> >> File >> >> >> >> "c:\python27-32\lib\site-packages\surf-1.1.6r0_r374-py2.7.egg\surf\resource\__init__.py" >> >> in load >> >> 548. self.__set_predicate_values(results_d, True) >> >> File >> >> >> >> "c:\python27-32\lib\site-packages\surf-1.1.6r0_r374-py2.7.egg\surf\resource\__init__.py" >> >> in __set_predicate_values >> >> 571. for p, v in results.items(): >> >> >> >> Exception Type: AttributeError at /leden/done/ >> >> Exception Value: 'list' object has no attribute 'items' >> >> >> >> I assume that results.items() is something that comes from the >> >> SPARQLWrapper en then handled by SurfRDF. However it is impossible for >> >> me to >> >> tell what exactly happens when an empty result is being returned in >> >> SPARQLWrapper. >> >> >> >> The code that handles this is: >> >> >> >> def __set_predicate_values(self, results, direct): >> >> """ set the prediate - value(s) to the resource using lazy >> >> loading, >> >> `results` is a dict under the form: >> >> {'predicate':{'value':[concept,concept],...},...}. >> >> >> >> """ >> >> >> >> for p, v in results.items(): >> >> attr = rdf2attr(p, direct) >> >> value = self._lazy(v) >> >> if value: >> >> self.__setattr__(attr, value) So I assume that if >> >> SPARQLWrapper makes sure that the results or the results.items() object >> >> is >> >> never simply empty or that the results have always at least an >> >> attribute >> >> items this issue can be resolved even when the results are empty (which >> >> is >> >> obviously the case here).v >> >> Any comments on this issue or at least a workaround or something? >> >> >> >> >> >> >> >> ------------------------------------------------------------------------------ >> >> Live Security Virtual Conference >> >> Exclusive live event will cover all the ways today's security and >> >> threat landscape has changed and how IT managers can respond. >> >> Discussions >> >> will include endpoint security, mobile security and the latest in >> >> malware >> >> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >> >> _______________________________________________ >> >> sparql-wrapper-devel mailing list >> >> spa...@li... >> >> https://lists.sourceforge.net/lists/listinfo/sparql-wrapper-devel >> >> >> > >> > >> > >> > -- >> > >> > Sergio Fern?ndez <se...@wi...> >> >> >> >> -- >> >> Sergio Fern?ndez <se...@wi...> >> >> >> >> ------------------------------ >> >> >> >> ------------------------------------------------------------------------------ >> Live Security Virtual Conference >> Exclusive live event will cover all the ways today's security and >> threat landscape has changed and how IT managers can respond. Discussions >> will include endpoint security, mobile security and the latest in malware >> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >> >> ------------------------------ >> >> >> _______________________________________________ >> sparql-wrapper-devel mailing list >> spa...@li... >> https://lists.sourceforge.net/lists/listinfo/sparql-wrapper-devel >> >> >> End of sparql-wrapper-devel Digest, Vol 18, Issue 1 >> *************************************************** > > > > > ------------------------------------------------------------------------------ > Don't let slow site performance ruin your business. Deploy New Relic APM > Deploy New Relic app performance management and know exactly > what is happening inside your Ruby, Python, PHP, Java, and .NET app > Try New Relic at no cost today and get our sweet Data Nerd shirt too! > http://p.sf.net/sfu/newrelic-dev2dev > _______________________________________________ > sparql-wrapper-devel mailing list > spa...@li... > https://lists.sourceforge.net/lists/listinfo/sparql-wrapper-devel > -- Sergio Fernández <se...@wi...> |
From: Laurens De V. <lau...@gm...> - 2012-10-09 10:12:55
|
I assume in that case that the implementation of the Sparqlwrapper results is different from the allegrograph results version (the allegrograph version works in my case). This is the allegrograph implementation: http://code.google.com/p/surfrdf/source/browse/trunk/plugins/surf.allegro_franz/allegro_franz/reader.py?r=362 * *I assume more specifically it is this part of the code: *def _to_table(self, result): table = [] bindings = result.getBindingNames() for bindingSet in result: row = {} for key in bindings: try: v = toRdfLib(bindingSet[key]) except: v = None row[key] = v table.append(row) return table* This is probably slightly different from the SPARQLWrapper Implementation. > Date: Wed, 12 Sep 2012 10:31:01 +0200 > From: Sergio Fern?ndez <se...@wi...> > Subject: Re: [sparql-wrapper-devel] Empty result items from > SPARQLWrapper return empty list instead of object with attribute > items > that conains empty list > To: spa...@li... > Message-ID: > <CAKZ-WGf-qraey7YKV6Ajm0WkDaK-Umeb=HMyeQWVPJruW= > Qo...@ma...> > Content-Type: text/plain; charset=UTF-8 > > Hi again, > > today I'm quite busy, so I can't go deeper into SuRF's source code. > Could you please provide me details about the trace how resource_d is > build at [1]? Because you're directly using > results["results"]["bindings"], that's a list, so it's wrong (this > code will not work [2], for instance) and will produce the reported > exception even with results. It should access a concrete binding of > the results (as this code does [3]). > > Awaiting for your support on that. > > Cheers, > > > [1] > http://code.google.com/p/surfrdf/source/browse/trunk/surf/resource/__init__.py#548 > [2] http://gist.github.com/3705188 > [3] http://gist.github.com/3705219 > > On 12 September 2012 09:53, Sergio Fern?ndez <se...@wi...> wrote: > > Hi Laurens, > > > > when SuRF performs: > > > >> > "c:\python27-32\lib\site-packages\surf-1.1.6r0_r374-py2.7.egg\surf\resource\__init__.py" > >> in __set_predicate_values > >> 571. for p, v in results.items(): > > > > it's because to get a dictionary there, but a list was returned. I'll > > investigate why such container is returned when the result set comes > > empty, because that's something that should be handle by the library. > > > > I'll keep you informed. > > > > Kind regards, > > > > > > On 11 September 2012 11:15, Laurens De Vocht <lau...@gm...> > wrote: > >> > >> Hi, > >> > >> > >> When I switched from the Allegrograph SurfRDF to SPARQLWrapper SurfRDF, > I > >> suddenly get this error (both with Virtuoso and Fuseki SPARQL > Endpoints): > >> > >> Environment: > >> > >> > >> Request Method: GET > >> Request URL: http://localhost:8000/leden/done/ > >> > >> Django Version: 1.4.1 > >> Python Version: 2.7.3 > >> Installed Applications: > >> ('django.contrib.auth', > >> 'django.contrib.contenttypes', > >> 'django.contrib.sessions', > >> 'django.contrib.sites', > >> 'django.contrib.messages', > >> 'django.contrib.staticfiles', > >> 'social_auth', > >> 'twitter', > >> 'surf', > >> 'hamlpy', > >> 'djaml', > >> 'django.contrib.admin', > >> 'leden') > >> Installed Middleware: > >> ('django.middleware.common.CommonMiddleware', > >> 'django.contrib.sessions.middleware.SessionMiddleware', > >> 'django.middleware.csrf.CsrfViewMiddleware', > >> 'django.contrib.auth.middleware.AuthenticationMiddleware', > >> 'django.contrib.messages.middleware.MessageMiddleware') > >> > >> > >> Traceback: > >> File "C:\Python27-32\lib\site-packages\django\core\handlers\base.py" in > >> get_response > >> 111. response = callback(request, > >> *callback_args, **callback_kwargs) > >> File > "C:\Python27-32\lib\site-packages\django\contrib\auth\decorators.py" > >> in _wrapped_view > >> 20. return view_func(request, *args, **kwargs) > >> File > >> > "C:\Users\ldevocht\git\DynResAlignRepo\dynresalign\leden\profiler\persistence.py" > >> in addUserAccountToPerson > >> 189. person.load() > >> File > >> > "c:\python27-32\lib\site-packages\surf-1.1.6r0_r374-py2.7.egg\surf\resource\__init__.py" > >> in load > >> 548. self.__set_predicate_values(results_d, True) > >> File > >> > "c:\python27-32\lib\site-packages\surf-1.1.6r0_r374-py2.7.egg\surf\resource\__init__.py" > >> in __set_predicate_values > >> 571. for p, v in results.items(): > >> > >> Exception Type: AttributeError at /leden/done/ > >> Exception Value: 'list' object has no attribute 'items' > >> > >> I assume that results.items() is something that comes from the > >> SPARQLWrapper en then handled by SurfRDF. However it is impossible for > me to > >> tell what exactly happens when an empty result is being returned in > >> SPARQLWrapper. > >> > >> The code that handles this is: > >> > >> def __set_predicate_values(self, results, direct): > >> """ set the prediate - value(s) to the resource using lazy > >> loading, > >> `results` is a dict under the form: > >> {'predicate':{'value':[concept,concept],...},...}. > >> > >> """ > >> > >> for p, v in results.items(): > >> attr = rdf2attr(p, direct) > >> value = self._lazy(v) > >> if value: > >> self.__setattr__(attr, value) So I assume that if > >> SPARQLWrapper makes sure that the results or the results.items() object > is > >> never simply empty or that the results have always at least an attribute > >> items this issue can be resolved even when the results are empty (which > is > >> obviously the case here).v > >> Any comments on this issue or at least a workaround or something? > >> > >> > >> > ------------------------------------------------------------------------------ > >> Live Security Virtual Conference > >> Exclusive live event will cover all the ways today's security and > >> threat landscape has changed and how IT managers can respond. > Discussions > >> will include endpoint security, mobile security and the latest in > malware > >> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > >> _______________________________________________ > >> sparql-wrapper-devel mailing list > >> spa...@li... > >> https://lists.sourceforge.net/lists/listinfo/sparql-wrapper-devel > >> > > > > > > > > -- > > > > Sergio Fern?ndez <se...@wi...> > > > > -- > > Sergio Fern?ndez <se...@wi...> > > > > ------------------------------ > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > > ------------------------------ > > _______________________________________________ > sparql-wrapper-devel mailing list > spa...@li... > https://lists.sourceforge.net/lists/listinfo/sparql-wrapper-devel > > > End of sparql-wrapper-devel Digest, Vol 18, Issue 1 > *************************************************** > |
From: Sergio F. <se...@wi...> - 2012-10-08 15:52:00
|
Hi Laurens, what happened with this issue? Cheers, On 12 September 2012 10:31, Sergio Fernández <se...@wi...> wrote: > Hi again, > > today I'm quite busy, so I can't go deeper into SuRF's source code. > Could you please provide me details about the trace how resource_d is > build at [1]? Because you're directly using > results["results"]["bindings"], that's a list, so it's wrong (this > code will not work [2], for instance) and will produce the reported > exception even with results. It should access a concrete binding of > the results (as this code does [3]). > > Awaiting for your support on that. > > Cheers, > > > [1] http://code.google.com/p/surfrdf/source/browse/trunk/surf/resource/__init__.py#548 > [2] http://gist.github.com/3705188 > [3] http://gist.github.com/3705219 > > On 12 September 2012 09:53, Sergio Fernández <se...@wi...> wrote: >> Hi Laurens, >> >> when SuRF performs: >> >>> "c:\python27-32\lib\site-packages\surf-1.1.6r0_r374-py2.7.egg\surf\resource\__init__.py" >>> in __set_predicate_values >>> 571. for p, v in results.items(): >> >> it's because to get a dictionary there, but a list was returned. I'll >> investigate why such container is returned when the result set comes >> empty, because that's something that should be handle by the library. >> >> I'll keep you informed. >> >> Kind regards, >> >> >> On 11 September 2012 11:15, Laurens De Vocht <lau...@gm...> wrote: >>> >>> Hi, >>> >>> >>> When I switched from the Allegrograph SurfRDF to SPARQLWrapper SurfRDF, I >>> suddenly get this error (both with Virtuoso and Fuseki SPARQL Endpoints): >>> >>> Environment: >>> >>> >>> Request Method: GET >>> Request URL: http://localhost:8000/leden/done/ >>> >>> Django Version: 1.4.1 >>> Python Version: 2.7.3 >>> Installed Applications: >>> ('django.contrib.auth', >>> 'django.contrib.contenttypes', >>> 'django.contrib.sessions', >>> 'django.contrib.sites', >>> 'django.contrib.messages', >>> 'django.contrib.staticfiles', >>> 'social_auth', >>> 'twitter', >>> 'surf', >>> 'hamlpy', >>> 'djaml', >>> 'django.contrib.admin', >>> 'leden') >>> Installed Middleware: >>> ('django.middleware.common.CommonMiddleware', >>> 'django.contrib.sessions.middleware.SessionMiddleware', >>> 'django.middleware.csrf.CsrfViewMiddleware', >>> 'django.contrib.auth.middleware.AuthenticationMiddleware', >>> 'django.contrib.messages.middleware.MessageMiddleware') >>> >>> >>> Traceback: >>> File "C:\Python27-32\lib\site-packages\django\core\handlers\base.py" in >>> get_response >>> 111. response = callback(request, >>> *callback_args, **callback_kwargs) >>> File "C:\Python27-32\lib\site-packages\django\contrib\auth\decorators.py" >>> in _wrapped_view >>> 20. return view_func(request, *args, **kwargs) >>> File >>> "C:\Users\ldevocht\git\DynResAlignRepo\dynresalign\leden\profiler\persistence.py" >>> in addUserAccountToPerson >>> 189. person.load() >>> File >>> "c:\python27-32\lib\site-packages\surf-1.1.6r0_r374-py2.7.egg\surf\resource\__init__.py" >>> in load >>> 548. self.__set_predicate_values(results_d, True) >>> File >>> "c:\python27-32\lib\site-packages\surf-1.1.6r0_r374-py2.7.egg\surf\resource\__init__.py" >>> in __set_predicate_values >>> 571. for p, v in results.items(): >>> >>> Exception Type: AttributeError at /leden/done/ >>> Exception Value: 'list' object has no attribute 'items' >>> >>> I assume that results.items() is something that comes from the >>> SPARQLWrapper en then handled by SurfRDF. However it is impossible for me to >>> tell what exactly happens when an empty result is being returned in >>> SPARQLWrapper. >>> >>> The code that handles this is: >>> >>> def __set_predicate_values(self, results, direct): >>> """ set the prediate - value(s) to the resource using lazy >>> loading, >>> `results` is a dict under the form: >>> {'predicate':{'value':[concept,concept],...},...}. >>> >>> """ >>> >>> for p, v in results.items(): >>> attr = rdf2attr(p, direct) >>> value = self._lazy(v) >>> if value: >>> self.__setattr__(attr, value) So I assume that if >>> SPARQLWrapper makes sure that the results or the results.items() object is >>> never simply empty or that the results have always at least an attribute >>> items this issue can be resolved even when the results are empty (which is >>> obviously the case here).v >>> Any comments on this issue or at least a workaround or something? >>> >>> >>> ------------------------------------------------------------------------------ >>> Live Security Virtual Conference >>> Exclusive live event will cover all the ways today's security and >>> threat landscape has changed and how IT managers can respond. Discussions >>> will include endpoint security, mobile security and the latest in malware >>> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >>> _______________________________________________ >>> sparql-wrapper-devel mailing list >>> spa...@li... >>> https://lists.sourceforge.net/lists/listinfo/sparql-wrapper-devel >>> >> >> >> >> -- >> >> Sergio Fernández <se...@wi...> > > > > -- > > Sergio Fernández <se...@wi...> -- Sergio Fernández <se...@wi...> |
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 |
From: Jeff H. <ma...@gm...> - 2012-09-27 20:40:07
|
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'} |
From: Sergio F. <se...@wi...> - 2012-09-12 08:38:18
|
Hi again, today I'm quite busy, so I can't go deeper into SuRF's source code. Could you please provide me details about the trace how resource_d is build at [1]? Because you're directly using results["results"]["bindings"], that's a list, so it's wrong (this code will not work [2], for instance) and will produce the reported exception even with results. It should access a concrete binding of the results (as this code does [3]). Awaiting for your support on that. Cheers, [1] http://code.google.com/p/surfrdf/source/browse/trunk/surf/resource/__init__.py#548 [2] http://gist.github.com/3705188 [3] http://gist.github.com/3705219 On 12 September 2012 09:53, Sergio Fernández <se...@wi...> wrote: > Hi Laurens, > > when SuRF performs: > >> "c:\python27-32\lib\site-packages\surf-1.1.6r0_r374-py2.7.egg\surf\resource\__init__.py" >> in __set_predicate_values >> 571. for p, v in results.items(): > > it's because to get a dictionary there, but a list was returned. I'll > investigate why such container is returned when the result set comes > empty, because that's something that should be handle by the library. > > I'll keep you informed. > > Kind regards, > > > On 11 September 2012 11:15, Laurens De Vocht <lau...@gm...> wrote: >> >> Hi, >> >> >> When I switched from the Allegrograph SurfRDF to SPARQLWrapper SurfRDF, I >> suddenly get this error (both with Virtuoso and Fuseki SPARQL Endpoints): >> >> Environment: >> >> >> Request Method: GET >> Request URL: http://localhost:8000/leden/done/ >> >> Django Version: 1.4.1 >> Python Version: 2.7.3 >> Installed Applications: >> ('django.contrib.auth', >> 'django.contrib.contenttypes', >> 'django.contrib.sessions', >> 'django.contrib.sites', >> 'django.contrib.messages', >> 'django.contrib.staticfiles', >> 'social_auth', >> 'twitter', >> 'surf', >> 'hamlpy', >> 'djaml', >> 'django.contrib.admin', >> 'leden') >> Installed Middleware: >> ('django.middleware.common.CommonMiddleware', >> 'django.contrib.sessions.middleware.SessionMiddleware', >> 'django.middleware.csrf.CsrfViewMiddleware', >> 'django.contrib.auth.middleware.AuthenticationMiddleware', >> 'django.contrib.messages.middleware.MessageMiddleware') >> >> >> Traceback: >> File "C:\Python27-32\lib\site-packages\django\core\handlers\base.py" in >> get_response >> 111. response = callback(request, >> *callback_args, **callback_kwargs) >> File "C:\Python27-32\lib\site-packages\django\contrib\auth\decorators.py" >> in _wrapped_view >> 20. return view_func(request, *args, **kwargs) >> File >> "C:\Users\ldevocht\git\DynResAlignRepo\dynresalign\leden\profiler\persistence.py" >> in addUserAccountToPerson >> 189. person.load() >> File >> "c:\python27-32\lib\site-packages\surf-1.1.6r0_r374-py2.7.egg\surf\resource\__init__.py" >> in load >> 548. self.__set_predicate_values(results_d, True) >> File >> "c:\python27-32\lib\site-packages\surf-1.1.6r0_r374-py2.7.egg\surf\resource\__init__.py" >> in __set_predicate_values >> 571. for p, v in results.items(): >> >> Exception Type: AttributeError at /leden/done/ >> Exception Value: 'list' object has no attribute 'items' >> >> I assume that results.items() is something that comes from the >> SPARQLWrapper en then handled by SurfRDF. However it is impossible for me to >> tell what exactly happens when an empty result is being returned in >> SPARQLWrapper. >> >> The code that handles this is: >> >> def __set_predicate_values(self, results, direct): >> """ set the prediate - value(s) to the resource using lazy >> loading, >> `results` is a dict under the form: >> {'predicate':{'value':[concept,concept],...},...}. >> >> """ >> >> for p, v in results.items(): >> attr = rdf2attr(p, direct) >> value = self._lazy(v) >> if value: >> self.__setattr__(attr, value) So I assume that if >> SPARQLWrapper makes sure that the results or the results.items() object is >> never simply empty or that the results have always at least an attribute >> items this issue can be resolved even when the results are empty (which is >> obviously the case here).v >> Any comments on this issue or at least a workaround or something? >> >> >> ------------------------------------------------------------------------------ >> Live Security Virtual Conference >> Exclusive live event will cover all the ways today's security and >> threat landscape has changed and how IT managers can respond. Discussions >> will include endpoint security, mobile security and the latest in malware >> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ >> _______________________________________________ >> sparql-wrapper-devel mailing list >> spa...@li... >> https://lists.sourceforge.net/lists/listinfo/sparql-wrapper-devel >> > > > > -- > > Sergio Fernández <se...@wi...> -- Sergio Fernández <se...@wi...> |
From: Sergio F. <se...@wi...> - 2012-09-12 07:54:03
|
Hi Laurens, when SuRF performs: > "c:\python27-32\lib\site-packages\surf-1.1.6r0_r374-py2.7.egg\surf\resource\__init__.py" > in __set_predicate_values > 571. for p, v in results.items(): it's because to get a dictionary there, but a list was returned. I'll investigate why such container is returned when the result set comes empty, because that's something that should be handle by the library. I'll keep you informed. Kind regards, On 11 September 2012 11:15, Laurens De Vocht <lau...@gm...> wrote: > > Hi, > > > When I switched from the Allegrograph SurfRDF to SPARQLWrapper SurfRDF, I > suddenly get this error (both with Virtuoso and Fuseki SPARQL Endpoints): > > Environment: > > > Request Method: GET > Request URL: http://localhost:8000/leden/done/ > > Django Version: 1.4.1 > Python Version: 2.7.3 > Installed Applications: > ('django.contrib.auth', > 'django.contrib.contenttypes', > 'django.contrib.sessions', > 'django.contrib.sites', > 'django.contrib.messages', > 'django.contrib.staticfiles', > 'social_auth', > 'twitter', > 'surf', > 'hamlpy', > 'djaml', > 'django.contrib.admin', > 'leden') > Installed Middleware: > ('django.middleware.common.CommonMiddleware', > 'django.contrib.sessions.middleware.SessionMiddleware', > 'django.middleware.csrf.CsrfViewMiddleware', > 'django.contrib.auth.middleware.AuthenticationMiddleware', > 'django.contrib.messages.middleware.MessageMiddleware') > > > Traceback: > File "C:\Python27-32\lib\site-packages\django\core\handlers\base.py" in > get_response > 111. response = callback(request, > *callback_args, **callback_kwargs) > File "C:\Python27-32\lib\site-packages\django\contrib\auth\decorators.py" > in _wrapped_view > 20. return view_func(request, *args, **kwargs) > File > "C:\Users\ldevocht\git\DynResAlignRepo\dynresalign\leden\profiler\persistence.py" > in addUserAccountToPerson > 189. person.load() > File > "c:\python27-32\lib\site-packages\surf-1.1.6r0_r374-py2.7.egg\surf\resource\__init__.py" > in load > 548. self.__set_predicate_values(results_d, True) > File > "c:\python27-32\lib\site-packages\surf-1.1.6r0_r374-py2.7.egg\surf\resource\__init__.py" > in __set_predicate_values > 571. for p, v in results.items(): > > Exception Type: AttributeError at /leden/done/ > Exception Value: 'list' object has no attribute 'items' > > I assume that results.items() is something that comes from the > SPARQLWrapper en then handled by SurfRDF. However it is impossible for me to > tell what exactly happens when an empty result is being returned in > SPARQLWrapper. > > The code that handles this is: > > def __set_predicate_values(self, results, direct): > """ set the prediate - value(s) to the resource using lazy > loading, > `results` is a dict under the form: > {'predicate':{'value':[concept,concept],...},...}. > > """ > > for p, v in results.items(): > attr = rdf2attr(p, direct) > value = self._lazy(v) > if value: > self.__setattr__(attr, value) So I assume that if > SPARQLWrapper makes sure that the results or the results.items() object is > never simply empty or that the results have always at least an attribute > items this issue can be resolved even when the results are empty (which is > obviously the case here).v > Any comments on this issue or at least a workaround or something? > > > ------------------------------------------------------------------------------ > Live Security Virtual Conference > Exclusive live event will cover all the ways today's security and > threat landscape has changed and how IT managers can respond. Discussions > will include endpoint security, mobile security and the latest in malware > threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ > _______________________________________________ > sparql-wrapper-devel mailing list > spa...@li... > https://lists.sourceforge.net/lists/listinfo/sparql-wrapper-devel > -- Sergio Fernández <se...@wi...> |
From: Laurens De V. <lau...@gm...> - 2012-09-11 09:15:41
|
Hi, When I switched from the Allegrograph SurfRDF to SPARQLWrapper SurfRDF, I suddenly get this error (both with Virtuoso and Fuseki SPARQL Endpoints): Environment: Request Method: GET Request URL: http://localhost:8000/leden/done/ Django Version: 1.4.1 Python Version: 2.7.3 Installed Applications: ('django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', 'social_auth', 'twitter', 'surf', 'hamlpy', 'djaml', 'django.contrib.admin', 'leden') Installed Middleware: ('django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware') Traceback: File "C:\Python27-32\lib\site-packages\django\core\handlers\base.py" in get_response 111. response = callback(request, *callback_args, **callback_kwargs) File "C:\Python27-32\lib\site-packages\django\contrib\auth\decorators.py" in _wrapped_view 20. return view_func(request, *args, **kwargs) File "C:\Users\ldevocht\git\DynResAlignRepo\dynresalign\leden\profiler\persistence.py" in addUserAccountToPerson 189. person.load() File "c:\python27-32\lib\site-packages\surf-1.1.6r0_r374-py2.7.egg\surf\resource\__init__.py" in load 548. self.__set_predicate_values(results_d, True) File "c:\python27-32\lib\site-packages\surf-1.1.6r0_r374-py2.7.egg\surf\resource\__init__.py" in __set_predicate_values 571. for p, v in *results.items()*: Exception Type: AttributeError at /leden/done/ Exception Value: 'list' object has no attribute 'items' I assume that results.items() is something that comes from the SPARQLWrapper en then handled by SurfRDF. However it is impossible for me to tell what exactly happens when an empty result is being returned in SPARQLWrapper. The code that handles this is: def __set_predicate_values(self, results, direct): """ set the prediate - value(s) to the resource using lazy loading, `results` is a dict under the form: {'predicate':{'value':[concept,concept],...},...}. """ for p, v in results.items(): attr = rdf2attr(p, direct) value = self._lazy(v) if value: self.__setattr__(attr, value) So I assume that if SPARQLWrapper makes sure that the results or the results.items() object is never simply empty or that the results have always at least an attribute items this issue can be resolved even when the results are empty (which is obviously the case here).v Any comments on this issue or at least a workaround or something? |