tripod
tripod copied to clipboard
4store doesn't seem to be getting the required http headers for update
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?
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..@[email protected]".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.....@[email protected]".Z....&.....^.......
.
G%.
G$
DELETE {GRAPH { ?p ?o}} WHERE {GRAPH { ?p ?o}};
INSERT DATA {
GRAPH {
.
}
};
###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
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.
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.
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?