1

I know that by default fuseki provides different urls for both query and update, allowing some elegant management.

Now, i want to get a single URL for both update and query. The rationale behind this need is to avoid the propagation of two urls in the codebase. I know that update and query codes should be separated, but my requests are not mixed. It's just to avoid the propagation of two objects instead of one.

My current config looks like:

<#service1> rdf:type fuseki:Service ;
    fuseki:name          "dataset"  ;   # http://host:port/dataset
    fuseki:serviceQuery  "endpoint" ;   # SPARQL query service
    fuseki:serviceUpdate "endpoint" ;   # SPARQL update service
    fuseki:dataset       <#dataset> ;
    .

In theory, an interface exists at /endpoint, but only accept update. When query with:

prefix sfm: <sfm/>
SELECT DISTINCT ?value
WHERE {
    sfm:config sfm:component ?value.
}

the server reports many lines like the following:

INFO  [4] POST http://localhost:9876/sfm/endpoint
INFO  [4] POST /sfm :: 'endpoint' :: [application/x-www-form-urlencoded] ? 
INFO  [4] 400 SPARQL Update: No 'update=' parameter (0 ms)

I can't find anything in the doc that specify that query and update service can't be at same place, so i'm assume it's possible and i've just missed something. However the last line of log is explicit: fuseki waits for an update.


One other solution could be to define the url as localhost/dataset/, and depending if i query or update, add the relevant part at the end, giving respectively localhost/dataset/query and localhost/dataset/update.

But (1) this lead the database to need to have a particular url naming, and (2) it looks like a strong requirement about the triplestore: when i will use another one, it will have to provide the same interface, which could be not possible. (don't know if this feature is implemented in other triplestores)

EDIT: fix the POST/GET error

Community
  • 1
  • 1
aluriak
  • 5,559
  • 2
  • 26
  • 39
  • 1
    On (2) - the right way to be triplestore neutral is to have two settings - the query end point and the update endpoint. These can then be the same or different as needed. Given that the services may have different security setups, you'll need to handle them differently anyway for real portability. – AndyS Sep 10 '16 at 10:23
  • The configuration file (fuseki:name ) does not agree with the HTTP request. – AndyS Sep 13 '16 at 12:01

2 Answers2

4
405 HTTP method not allowed: SPARQL Update : use POST

It looks like you are using GET for an SPARQL Update.

It has correctly routed the operation to the update processor (you can use the same endpoint - including dropping the service part and just using the dataset URL).

However, in HTTP, GET are cacheable operations and should not be used when they can cause changes. a GET may not actually reach the end server but some intermediate respond to it from a web cache.

Use POST.

The same is true if you separate services for query and update.

Original Context

The original question has been edited. The original report was asking about this:

INFO  [1] 405 HTTP method not allowed: SPARQL Update : use POST (2 ms)
AndyS
  • 16,345
  • 17
  • 21
  • Thanks, that's fix one part of the problem. I've updated my question in order to show the interesting part. Fuseki now detect the query, but ask specifically for an update. – aluriak Sep 09 '16 at 17:14
  • Please do not remove the original question. My answer, which you haven't accepted, referred to the original report and now what it is referring to description that isn't there anymore. The edited question is about a difference matter. – AndyS Sep 10 '16 at 09:29
  • Please start a new question, and include the Fuseki version you are using and the sparqlwarpper call you are making (including version). Then the original issue can be restored here. – AndyS Sep 10 '16 at 10:24
2

Answer to the revised and different question:

The endpoint for shared services is the dataset URL:

http://localhost:9876/sfm

Whether update, query or services are available is controlled by the configuration file.

Setting fuseki:serviceQuery and fuseki:serviceUpdate the same is not necessary and is discouraged.

AndyS
  • 16,345
  • 17
  • 21