tags:

views:

11

answers:

1

I would like to send updates to a remote endpoint over http. I have found that joseki serves as such an endpoint.

However, how do i send update queries to this endpoint, if I only know the uri of the endpoint?

// To do a select-query you can use this:
QueryExecution qe = QueryExecutionFactory.sparqlService(serviceURI, query);

// (Sidenote:) does the next line have the desired effect of setting the binding?
// After all, sparqlService has no alternative with initialBindang as parameter
qe.setInitialBinding(initialBinding);

result = qe.execSelect();

// But updates do not support this kind of sparqlService method
// Illegal:
// UpdateAction.sparqlServiceExecute(serviceURI, query);
// I can use the following:
UpdateAction.parseExecute(updateQuery, dataset, initialBinding);
// But dataset is a Dataset object, not the uri.

// I don't believe this is the correct way to overcome this:
Dataset dataset = DatasetFactory.create(serviceURI);

From the API documents I dont understand what DatasetFactory.create(String uri) does. Can anyone elaborate, and tell me if this is the method I need?

Otherwise I would like to hear how to do remote update queries to endpoints for which only the URI is known.

+1  A: 

Otherwise I would like to hear how to do remote update queries to endpoints for which only the URI is known.

This is handled a little differently depending on the endpoint server. There is a draft sparql/update protocol. But as it is draft and fairly new support is a little variant.

Genrally you can write sparql update queries a little like you would write SQL insert or update statements.

The update commands are Modify, Insert, Delete, Load, Clear but not every imlpementation supports all of these.

As endpoints are often public there is usually some authentication needed before the action is allowed, this is not defined in the spec so is implementation specific.

It is advised that a different URL is used for update statements so that http authentication can be used. 4store, uses /sparql for queries and /update for update queries.

The W3C draft has some examples of how to construct sparql update queries.

Jeremy French