SmartDataAnalytics / RdfProcessingToolkit

Command line interface based RDF processing toolkit to run sequences of SPARQL statements ad-hoc on RDF datasets, streams of bindings and streams of named graphs with support for processing JSON, CSV and XML using function extensions
https://smartdataanalytics.github.io/RdfProcessingToolkit/
Other
40 stars 3 forks source link

SPARQL Endpoint throws exception for SPARQL Update (POST, x-www-form-urlencoded) #38

Closed splattater closed 1 year ago

splattater commented 1 year ago

Running a SPARQL endpoint with the following setting rpt integrate --server any_rdf.ttl

I get an exception after executing a POST request with a valid SPARQL Update using https://www.w3.org/TR/sparql11-protocol/#update-via-post-urlencoded

10:43:25 [WARN] [o.g.j.s.WebComponent:613] - A servlet request to the URI http://localhost:8642/sparql contains form parameters in the request body but the request body has been consumed by the servlet or a servlet filter accessing the request parameters. Only resource methods using @FormParam will work as expected. Resource methods consuming the request body by other means will not work as expected.
10:43:25 [WARN] [o.a.j.w.p.UncaughtExceptionProvider:25] - java.lang.RuntimeException: Both 'query' and 'update' statement strings provided in a single request; query=INSERT DATA {
Using POST request with content-type x-www-form-urlencoded ...

It seems, that a 'query' parameter was added somewhere after my request (using the 'update' parameter) came in.

splattater commented 1 year ago
curl --request POST \
  --url http://localhost:8642/sparql \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/x-www-form-urlencoded' \
  --data 'update=INSERT DATA {  <http://aksw.org/NormanRadtke> a <http://xmlns.com/foaf/0.1/Person> . }'

If you change 'update' to 'query' it will work, but it shouldn't according to SPARQL protocol.

Aklakan commented 1 year ago

Ah the virtuoso convenience compatibility causing issues. Good to know that it works with 'query='. Hopefully the needed fix is minor.

SimonBin commented 1 year ago

fixed in https://github.com/Scaseco/jenax/commit/6e8fd3366ea9dbfb2b26c0c625d1d3aafa00698f