问题
I am using two different HTTP POST
utilities (poster out of Firefox as well as Python
requests API) to post a simple SPARQL
insert to Virtuoso
.
My URL is: http://localhost:8890/sparql
My request parameters are:
default-graph-uri: <MY_GRAPH>
should-sponge: soft
debug: on
timeout:
format: application/xml
save: display
fname:
I put the actual SPARQL (INSERT DATA { GRAPH...
) in the content of the message.
I tried different content types, none of which worked. I do get 200 but the response is in HTML even though the above parameter set specifies application/xml
, however, no data is inserted. When I try content type of text/turtle
, I get 409 Invalid Path, which is also referenced in this post.
I can successfully do HTTP GET
, however, that has a payload length limitation which I would like to exceed for performance reasons. The only difference with the GET is that the SPARQL goes in the URL under query
parameter and the POST should enable a much larger payload in the message content, by including multiple triples in the same request, not just one (I have 100s of 1000s of inserts). I was trying to follow this documentation page.
回答1:
There are many aspects to this "question" making it difficult to provide a simple answer, suitable to this site. This is one of the reasons I suggested the mailing list, which is better suited to conversational and/or multi-facet assistance.
Have you tried using
curl
as most of our examples do?Looking at the Poster page on Mozilla Add-Ons, I see that you may need to manually add a
?
to the end of your target URI -- sohttp://localhost:8890/sparql?
rather thanhttp://localhost:8890/sparql
-- and it's not clear whether you've done that in your testing. On the project page, I also note its last commit was in 2012, and there are a great many open issues.I'm not at all familiar with Python, so I've not dug in there.
Have you tried setting an
Accept:
header? This can have significant impact on the content returned by the server.If I understand your described efforts correctly, your
format:
query parameter should beoutput-format:
, and its value should not beapplication/xml
but one of the supported formats listed in the documentation.Neither the virtuoso-users post you referenced nor this question have enough detail to analyze the cause of the
409 Invalid Path
error. Explicit details that allow us to reproduce this result would be helpful, optimally in a distinct thread.
来源:https://stackoverflow.com/questions/40920564/how-to-post-sparql-to-virtuoso