Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4store doesn't seem to be getting the required http headers for update #36

Open
dgmcguire opened this issue Aug 5, 2014 · 5 comments
Open

Comments

@dgmcguire
Copy link

cli showing error

the error -

Tripod::Errors::BadSparqlRequest: 400 4store only implements application/x-www-form-urlencoded
This is a 4store SPARQL server v1.1.5

I'm assuming this is because the correct headers are not being used to query 4stores endpoint. Is this supported? If so how can I set the correct headers?

@dgmcguire
Copy link
Author

this is a tcpdump showing the headers are content-type: text/plain. How can I change this?



Server: 4s-httpd/v1.1.5
Content-Type: text/plain; charset=UTF-8
400 4store only implements application/x-www-form-urlencoded
This is a 4store SPARQL server v1.1.5
12:29:05.012000 IP api.localhost.53577 > api.localhost.ddi-tcp-3: Flags [.], ack 10, win 342, options [nop,nop,TS val 17450788 ecr 17450788], length 0
E..4..@.@.WA.........I".Z....&.....V.(.....
.
G$.
G$
12:29:05.012088 IP api.localhost.53577 > api.localhost.ddi-tcp-3: Flags [P.], seq 198:639, ack 240, win 350, options [nop,nop,TS val 17450789 ecr 17450788], length 441
E.....@.@.U..........I".Z....&.....^.......
.
G%.
G$
          DELETE {GRAPH  { ?p ?o}} WHERE {GRAPH  { ?p ?o}};
          INSERT DATA {
            GRAPH  {
                 .
            }
          };

@dgmcguire
Copy link
Author

###update

okay so I've managed to change the content-type header and I'm still getting a 500 error, but I can't figure out why - here is a tcpdump of a successful curl


. ... ..POST /update/ HTTP/1.1
User-Agent: curl/7.37.1
Host: localhost:8890
Accept: */*
Content-Length: 105
Content-Type: application/x-www-form-urlencoded
update=INSERT+DATA+{+GRAPH++{+++"o"+}+}

and here is an unsuccessful save using same code as above with a modified gem to set the content-type correctly


. ... ..POST /update/ HTTP/1.1
Accept: */*; q=0.5, application/xml
Accept-Encoding: gzip, deflate
Content-Type: application/x-www-form-urlencoded
Content-Length: 441
User-Agent: Ruby
Host: localhost:8890
13:57:11.542214 IP api.localhost.ddi-tcp-3 > api.localhost.54532: Flags [.], ack 206, win 350, options [nop,nop,TS val 18876042 ecr 18876042], length 0
E..4i1@.@...........".....o...*....^.(.....
. ... ..
13:57:11.542232 IP api.localhost.54532 > api.localhost.ddi-tcp-3: Flags [P.], seq 206:647, ack 1, win 342, options [nop,nop,TS val 18876042 ecr 18876042], length 441
E.../.@.@..?.........."...*...o....V.......
. ... ..
          DELETE {GRAPH  { ?p ?o}} WHERE {GRAPH  { ?p ?o}};
          INSERT DATA {
            GRAPH  {
                 .
            }
          };

this gives me a 500 error from 4store as shown below


4store[29661]: httpd.c:303 HTTP error, returning status 500 SPARQL protocol error

@dgmcguire
Copy link
Author

I got some updates working. Had to prefix the saves with 'update=' however I was still getting errors because subqueries aren't supported by 4store which leads me to believe this gem doesn't support 4store.

@BillSwirrl
Copy link
Member

Hi - at Swirrl, we haven't tried it with 4store. I'll leave it to some of my more knowledgeable colleagues to reply in more detail, but Tripod relies on the database having a reasonably full and accurate implementation of the SPARQL 1.1 spec. If 4store doesn't do subqueries that is likely to be a problem.

@dgmcguire
Copy link
Author

Thanks for the reply, it may just be a matter of getting the headers and encoding + form prefixes right, even though the error on 4store side said something about not supporting subqueries, 4store claims to be sparql 1.1 compliant which means they do have subqueries, I think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants