[ https://issues.apache.org/jira/browse/JENA-1589?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16573034#comment-16573034 ]
Andy Seaborne edited comment on JENA-1589 at 8/8/18 11:15 AM: -------------------------------------------------------------- man curl says under --data: bq. Posting data from a file named from a file like that, carriage returns and newlines will be stripped out. The Fuseki log shows : {{[2] Query = # test queryselect *}} -- no newlines received. Adding a space after "test query" does not help - {{[3] Query = # test query select *}} the comment runs to end of (now long) line. Use --data-binary which says: bq. Data is posted in a similar manner as -d, --data does, except that newlines and carriage returns are preserved and conversions are never done. was (Author: andy.seaborne): man curl says under --data: bq. Posting data from a file named from a file like that, carriage returns and newlines will be stripped out. The Fuseki log shows : {{[2] Query = # testquery select *}} -- no newlines received. Adding a space after "test" does not help - the comment runs to end of (now long) line. Use --data-binary which says: bq. Data is posted in a similar manner as -d, --data does, except that newlines and carriage returns are preserved and conversions are never done. > POST query with comments fails > ------------------------------ > > Key: JENA-1589 > URL: https://issues.apache.org/jira/browse/JENA-1589 > Project: Apache Jena > Issue Type: Bug > Components: Fuseki > Affects Versions: Jena 3.8.0 > Reporter: Joachim Neubert > Priority: Major > > With a query file /tmp/test.rq > --------------- > select * > where { > ?s ?p ?o > } limit 10 > --------------- > curl -X POST -H "Content-type: application/sparql-query" --data @/tmp/test.rq > http://localhost:3030/stw/query > works nicely, whereas > --------------- > # test query > select * > where { > ?s ?p ?o > } limit 10 > --------------- > fails with the message: > Error 400: Parse error: > # test queryselect *where {?s ?p ?o} limit 10 > Encountered "<EOF>" at line 1, column 45. > Was expecting one of: > "\ufeff" ... > "base" ... > "prefix" ... > "select" ... > "json" ... > "describe" ... > "construct" ... > "ask" ... > Fuseki - version 3.8.0 (Build date: 2018-06-25T11:00:34+0000) > The spec (https://www.w3.org/TR/sparql11-protocol/#query-via-post-direct) > says “When using this approach, clients must include the SPARQL query string, > unencoded, and nothing else as the message body of the request”. I’d hope > “nothing else” does not preclude comment lines. Rather I'd suspect that the > concatination "# test queryselect " causes the error. > Cheers, Joachim -- This message was sent by Atlassian JIRA (v7.6.3#76005)