You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@marmotta.apache.org by "Rob Vesse (JIRA)" <ji...@apache.org> on 2014/01/21 19:59:25 UTC

[jira] [Commented] (MARMOTTA-426) Sparql Update POST urlencoded expects wrong parameter

    [ https://issues.apache.org/jira/browse/MARMOTTA-426?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13877736#comment-13877736 ] 

Rob Vesse commented on MARMOTTA-426:
------------------------------------

SPARQL Queries and Updates are separate in the SPARQL specification - the part of the specification you quote states the following:

{quote}
The query operation is used to send a SPARQL query to a service and receive the results of the query
{quote}

So Marmotta should not accept updates with the {{query}} parameter and is quite correct in its response even if the error message is a little misleading.

SPARQL Updates are accepted via the Update operation (http://www.w3.org/TR/sparql11-protocol/#update-operation) which is explicitly stated to require the {{update}} parameter instead of the {{query}} parameter:

{quote}
The update operation is used to send a SPARQL update request to a service. The update operation must be invoked using the HTTP POST method. Client requests for this operation must include exactly one SPARQL update request string (parameter name: update)
{quote}

> Sparql Update POST urlencoded expects wrong parameter
> -----------------------------------------------------
>
>                 Key: MARMOTTA-426
>                 URL: https://issues.apache.org/jira/browse/MARMOTTA-426
>             Project: Marmotta
>          Issue Type: Bug
>          Components: Platform, Web Services
>    Affects Versions: 3.1-incubating
>            Reporter: Francis De Brabandere
>            Assignee: Sebastian Schaffert
>              Labels: sparql, update
>
> According to the 1.1 Sparql protocol spec table at:
> http://www.w3.org/TR/sparql11-protocol/#query-operation
> A urlencoded post should use the "query" parameter for the query, currently marmotta seems to be using the "update" parameter which is wrong.
> This causes the user to get a 400 reponse saying with the (currently confusing) message "no SPARQL query specified"
> Test that reproduces this below:
> {code:java}
>     @Test
>     public void testUpdate() throws IOException, InterruptedException {
>         String insert =
>                 "PREFIX dc: <http://purl.org/dc/elements/1.1/>\n" +
>                 "INSERT DATA { <http://example/egbook3> dc:title \"This is an example title\" }";
>         expect().
>             log().ifError().
>                 statusCode(200).
>                 given().
>                 contentType("application/x-www-form-urlencoded").
>                 header("Accept", "application/xml").
>                 formParameter("query", insert).
>                 when().
>                 post("/sparql/update");
>     }
> {code}



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)