Hi There,

I am running a fuseki server and running update requests over http. I have no problem running queries using the endpoint (as specified on http://jena.apache.org/documentation/serving_data/index.html) - end_point_query= "http://host/fuseki/ds/query";

This works fine. When I attempt to do a update using end_point_update = "http://host/fuseki/ds/update";

I get the following error "Sparql query error: 400 Error 400: SPARQL Update: Multiple 'update=' parameters"

Here is the update - INSERT DATA{ http://www.semanticweb.org/ontologies/2012/9/knoholem.owl#OfficeActivity2012-01-04T09:00:00Z http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://www.semanticweb.org/ontologies/2012/9/knoholem.owl#OfficeWork; http://www.semanticweb.org/ontologies/2012/9/knoholem.owl#hasUserID "001"; http://www.semanticweb.org/ontologies/2012/9/knoholem.owl#hasStartDate "2012-01-04"; http://www.semanticweb.org/ontologies/2012/9/knoholem.owl#hasStartTime "09:00:00"; http://www.semanticweb.org/ontologies/2012/9/knoholem.owl#hasDuration "28800000"; http://www.semanticweb.org/ontologies/2012/9/knoholem.owl#hasPathTo http://www.semanticweb.org/ontologies/2012/9/knoholem.owl#pathStartP1P2P3Room02; http://www.semanticweb.org/ontologies/2012/9/knoholem.owl#hasPathFrom http://www.semanticweb.org/ontologies/2012/9/knoholem.owl#pathStartRoom02P3P2P1; }

It works fine using the "sparql.tpl" web client provided with fuseki. So, I am wondering if it is a permissions issue?

Any help is much appreciated!

Kind Regards,

Kris.

asked 23 Jan '13, 07:06

Bob%20Boonah's gravatar image

Bob Boonah
214
accept rate: 0%


The problem is how you are sending the request; the SPARQL Update is fine.

There must be exactly one request= or exactly one update=. More than one, or one of each causes that error.

e.g.

 curl --data 'request=INSERT DATA {}' \
      --data 'update=INSERT DATA {}' \
      http://localhost:3030/ds/update

provokes that message.

update= is standard, request= is a synonym.

permanent link

answered 23 Jan '13, 08:43

AndyS's gravatar image

AndyS ♦
13.7k37
accept rate: 32%

Hi Andy,

Many thanks for the response!

Yes, but I am quite sure I am only sending one update. As I say, I have been able to query without any problem. It is only when I attempt to update that I run into this problem.

Perhaps there is an issue with my sparql_update function?

var end_point_update = "http://host/fuseki/ds/update";

function sparql_update (query_str) {

g_query_result_string = undefined;

var querypart = "query=" + escape (query_str); // escape makes the string ASCII-portable

var xmlhttp = new XMLHttpRequest (); // ajax

xmlhttp.open ('POST', end_point_update, false); // GET can have caching probs, so POST. NOT ASYNCHRONOUS - WAIT

// probably need these headers
xmlhttp.setRequestHeader ('Content-type', 'application/x-www-form-urlencoded');
xmlhttp.setRequestHeader ("Accept", "application/sparql-results+json");

// Set up callback to get the response asynchronously.
xmlhttp.onreadystatechange = function () {
    if (xmlhttp.readyState == 4) {
        if (xmlhttp.status == 200) {
            // results are in a string in xmlhttp.responseText but we can't return it from this sub-function
            console.log (xmlhttp.responseText);
        } else {
            // Some kind of error occurred.
            alert("Sparql query error: " + xmlhttp.status + " " + xmlhttp.responseText);
        }
    }
}
// Send the query to the endpoint.
xmlhttp.send (querypart);
// here we have the query result in a string, let's convert it to json, then return a JS object
return result_json = eval("(" + xmlhttp.responseText + ")");

}

Kind Regards,

Kris.

permanent link

answered 23 Jan '13, 08:54

Bob%20Boonah's gravatar image

Bob Boonah
214
accept rate: 0%

1

var querypart = "query=" + escape (query_str); .... xmlhttp.send (querypart);

Your example has 'query=' which gives a different error " No 'update=' parameter" (at least, in the latest version).

It's update= (and it's not a query!)

(23 Jan '13, 09:05) AndyS ♦ AndyS's gravatar image

Thanks Andy,

I thought that might be the error but I when tried to use update= I was no longer getting any response. I looked into it a bit further and it was where I was printing the response. In retrospect now that you spell it out, I should have realised that that it needed to be like that.

Thanks a lot for the help...I needed someone with a clear eye to see it!

Best Regards,

Kris.

(23 Jan '13, 09:15) Bob Boonah Bob%20Boonah's gravatar image
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×60

question asked: 23 Jan '13, 07:06

question was seen: 1,794 times

last updated: 23 Jan '13, 09:15