problem with a SPARQL QUERY

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

problem with a SPARQL QUERY

Henry Story-4
I think I have  a pretty simple SPARQL query here, and it looks fine. But running it on the head of
swap seems to cause trouble.

$ cat p1.sparql
SELECT ?r
WHERE {
   ?s ?r ?pk .
}


$ cwm --mode=rse proof1.n3 ont.n3  --think --sparql=p1.sparql
#Processed by Id: cwm.py,v 1.197 2007/12/13 15:38:39 syosi Exp
        #    using base file:///Users/hjs/Programming/FoafSSL/foafssl-java/papers/spot2009/n3/
        Traceback (most recent call last):
  File "/Users/hjs/Programming/w3.org/2000/10/swap/cwm.py", line 750, in <module>
    doCommand()
  File "/Users/hjs/Programming/w3.org/2000/10/swap/cwm.py", line 564, in doCommand
    referer="", contentType="x-application/sparql")
  File "/Users/hjs/Programming/w3.org/2000/10/swap/llyn.py", line 1616, in load
    referer=referer, why=why)  
  File "/Users/hjs/Programming/w3.org/2000/10/swap/webAccess.py", line 195, in load
    p = sparql_parser.N3Parser(StringIO.StringIO(buffer), sparql_parser.branches, convertor)
  File "/Users/hjs/Programming/w3.org/2000/10/swap/sparql/sparql_parser.py", line 47, in __init__
    lexer = sparql_tokens.Lexer()
  File "/Users/hjs/Programming/w3.org/2000/10/swap/sparql/sparql_tokens.py", line 272, in __init__
    self.fixTokens()
  File "/Users/hjs/Programming/w3.org/2000/10/swap/sparql/sparql_tokens.py", line 314, in fixTokens
    importTokens()
  File "/Users/hjs/Programming/w3.org/2000/10/swap/sparql/sparql_tokens.py", line 40, in importTokens
    F = myStore.load('http://www.w3.org/2000/10/swap/grammar/sparql')
  File "/Users/hjs/Programming/w3.org/2000/10/swap/myStore.py", line 166, in load
    remember=remember, flags=flags)
  File "/Users/hjs/Programming/w3.org/2000/10/swap/llyn.py", line 1616, in load
    referer=referer, why=why)  
  File "/Users/hjs/Programming/w3.org/2000/10/swap/webAccess.py", line 178, in load
    raise DocumentAccessError(addr, sys.exc_info() )
swap.webAccess.DocumentAccessError: Unable to access document <http://www.w3.org/2000/10/swap/grammar/sparql>, because:
    HTTP Error 406: Not Acceptable


It seems like it is trying to make a local request, and having problems with the mime type...

Henry

Social Web Architect
http://bblfish.net/


Reply | Threaded
Open this post in threaded view
|

Re: problem with a SPARQL QUERY

Sergio Fernandez-4
Looking to the python's tracebak, actually it's not a problem on your
query, but a problem accessing the grammar file at [1]. Try to make a
request with other console tool, such as curl, just in order to be sure
that you can access to that N3 document.

Best,

[1] http://www.w3.org/2000/10/swap/grammar/sparql

On Mon, 2010-04-26 at 17:32 +0100, Story Henry wrote:

> I think I have  a pretty simple SPARQL query here, and it looks fine. But running it on the head of
> swap seems to cause trouble.
>
> $ cat p1.sparql
> SELECT ?r
> WHERE {
>    ?s ?r ?pk .
> }
>
>
> $ cwm --mode=rse proof1.n3 ont.n3  --think --sparql=p1.sparql
> #Processed by Id: cwm.py,v 1.197 2007/12/13 15:38:39 syosi Exp
>         #    using base file:///Users/hjs/Programming/FoafSSL/foafssl-java/papers/spot2009/n3/
>         Traceback (most recent call last):
>   File "/Users/hjs/Programming/w3.org/2000/10/swap/cwm.py", line 750, in <module>
>     doCommand()
>   File "/Users/hjs/Programming/w3.org/2000/10/swap/cwm.py", line 564, in doCommand
>     referer="", contentType="x-application/sparql")
>   File "/Users/hjs/Programming/w3.org/2000/10/swap/llyn.py", line 1616, in load
>     referer=referer, why=why)  
>   File "/Users/hjs/Programming/w3.org/2000/10/swap/webAccess.py", line 195, in load
>     p = sparql_parser.N3Parser(StringIO.StringIO(buffer), sparql_parser.branches, convertor)
>   File "/Users/hjs/Programming/w3.org/2000/10/swap/sparql/sparql_parser.py", line 47, in __init__
>     lexer = sparql_tokens.Lexer()
>   File "/Users/hjs/Programming/w3.org/2000/10/swap/sparql/sparql_tokens.py", line 272, in __init__
>     self.fixTokens()
>   File "/Users/hjs/Programming/w3.org/2000/10/swap/sparql/sparql_tokens.py", line 314, in fixTokens
>     importTokens()
>   File "/Users/hjs/Programming/w3.org/2000/10/swap/sparql/sparql_tokens.py", line 40, in importTokens
>     F = myStore.load('http://www.w3.org/2000/10/swap/grammar/sparql')
>   File "/Users/hjs/Programming/w3.org/2000/10/swap/myStore.py", line 166, in load
>     remember=remember, flags=flags)
>   File "/Users/hjs/Programming/w3.org/2000/10/swap/llyn.py", line 1616, in load
>     referer=referer, why=why)  
>   File "/Users/hjs/Programming/w3.org/2000/10/swap/webAccess.py", line 178, in load
>     raise DocumentAccessError(addr, sys.exc_info() )
> swap.webAccess.DocumentAccessError: Unable to access document <http://www.w3.org/2000/10/swap/grammar/sparql>, because:
>     HTTP Error 406: Not Acceptable
>
>
> It seems like it is trying to make a local request, and having problems with the mime type...
>
> Henry
>
> Social Web Architect
> http://bblfish.net/
>
>

--
Sergio Fernández
CTIC - Technological Center
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: [hidden email]
http://www.fundacionctic.org
Privacy Policy: http://www.fundacionctic.org/privacidad


Reply | Threaded
Open this post in threaded view
|

Re: problem with a SPARQL QUERY

Henry Story-4
Yes, I can

$ curl -I http://www.w3.org/2000/10/swap/grammar/sparql
HTTP/1.1 200 OK
Date: Mon, 26 Apr 2010 17:06:14 GMT
Server: Apache/2
Content-Location: sparql.n3
Vary: negotiate
TCN: choice
Last-Modified: Thu, 04 Aug 2005 16:35:09 GMT
ETag: "82e5-3fd852a1aa940;475d1b91ad240"
Accept-Ranges: bytes
Content-Length: 33509
Cache-Control: max-age=21600
Expires: Mon, 26 Apr 2010 23:06:14 GMT
P3P: policyref="http://www.w3.org/2001/05/P3P/p3p.xml"
Connection: close
Content-Type: text/n3; qs=0.89

On the other hand

$ curl -I -H "Accept: x-application/sparql" http://www.w3.org/2000/10/swap/grammar/sparql
HTTP/1.1 406 Not Acceptable
Date: Mon, 26 Apr 2010 17:07:21 GMT
Server: Apache/2
Alternates: {"sparql.n3" 0.89 {type text/n3} {length 33509}}
Vary: negotiate
TCN: list
Connection: close
Content-Type: text/html; charset=iso-8859-1


But then it should not be making that connection anyway, as I have that file available locally in the cwm
repository. Doing this request for the remote document, will just slow down sparql queries. Looks like there
is a canonical URL in the code where it should be relative.

Henry



On 26 Apr 2010, at 17:57, Sergio Fernández wrote:

> Looking to the python's tracebak, actually it's not a problem on your
> query, but a problem accessing the grammar file at [1]. Try to make a
> request with other console tool, such as curl, just in order to be sure
> that you can access to that N3 document.
>
> Best,
>
> [1] http://www.w3.org/2000/10/swap/grammar/sparql
>
> On Mon, 2010-04-26 at 17:32 +0100, Story Henry wrote:
>> I think I have  a pretty simple SPARQL query here, and it looks fine. But running it on the head of
>> swap seems to cause trouble.
>>
>> $ cat p1.sparql
>> SELECT ?r
>> WHERE {
>>   ?s ?r ?pk .
>> }
>>
>>
>> $ cwm --mode=rse proof1.n3 ont.n3  --think --sparql=p1.sparql
>> #Processed by Id: cwm.py,v 1.197 2007/12/13 15:38:39 syosi Exp
>>        #    using base file:///Users/hjs/Programming/FoafSSL/foafssl-java/papers/spot2009/n3/
>>        Traceback (most recent call last):
>>  File "/Users/hjs/Programming/w3.org/2000/10/swap/cwm.py", line 750, in <module>
>>    doCommand()
>>  File "/Users/hjs/Programming/w3.org/2000/10/swap/cwm.py", line 564, in doCommand
>>    referer="", contentType="x-application/sparql")
>>  File "/Users/hjs/Programming/w3.org/2000/10/swap/llyn.py", line 1616, in load
>>    referer=referer, why=why)  
>>  File "/Users/hjs/Programming/w3.org/2000/10/swap/webAccess.py", line 195, in load
>>    p = sparql_parser.N3Parser(StringIO.StringIO(buffer), sparql_parser.branches, convertor)
>>  File "/Users/hjs/Programming/w3.org/2000/10/swap/sparql/sparql_parser.py", line 47, in __init__
>>    lexer = sparql_tokens.Lexer()
>>  File "/Users/hjs/Programming/w3.org/2000/10/swap/sparql/sparql_tokens.py", line 272, in __init__
>>    self.fixTokens()
>>  File "/Users/hjs/Programming/w3.org/2000/10/swap/sparql/sparql_tokens.py", line 314, in fixTokens
>>    importTokens()
>>  File "/Users/hjs/Programming/w3.org/2000/10/swap/sparql/sparql_tokens.py", line 40, in importTokens
>>    F = myStore.load('http://www.w3.org/2000/10/swap/grammar/sparql')
>>  File "/Users/hjs/Programming/w3.org/2000/10/swap/myStore.py", line 166, in load
>>    remember=remember, flags=flags)
>>  File "/Users/hjs/Programming/w3.org/2000/10/swap/llyn.py", line 1616, in load
>>    referer=referer, why=why)  
>>  File "/Users/hjs/Programming/w3.org/2000/10/swap/webAccess.py", line 178, in load
>>    raise DocumentAccessError(addr, sys.exc_info() )
>> swap.webAccess.DocumentAccessError: Unable to access document <http://www.w3.org/2000/10/swap/grammar/sparql>, because:
>>    HTTP Error 406: Not Acceptable
>>
>>
>> It seems like it is trying to make a local request, and having problems with the mime type...
>>
>> Henry
>>
>> Social Web Architect
>> http://bblfish.net/
>>
>>
>
> --
> Sergio Fernández
> CTIC - Technological Center
> 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: [hidden email]
> http://www.fundacionctic.org
> Privacy Policy: http://www.fundacionctic.org/privacidad
>