Question

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);

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

Update: Resorted to a local jena in the end. This kind of RDF-endpoint accepts insert and delete statements. I did not succeed in finding a remote RDF-endpoint that would accept modifying queries.

Was it helpful?

Solution

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.

OTHER TIPS

Joseki doesn't support remote updates. You probably should have a look at its successor, Fuseki, which supports SPARQL Update.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top