ARQ - SPARQL/Update

SPARQL/Update is an update language for RDF based on SPARQL syntax.  It is described in "SPARQL/Update - A Language for Updating RDF Graphs".

A SPARQL/Update request is composed of a number of update operations, so in a single request graphs can be created, loaded with RDF data and modified.

Some examples of ARQ's SPARQL/Update support are to be found in the download in src-examples/arq/examples/update.

Many common operations can be done with operations in UpdateAction.

To execute a SPARQL/Update request as a script from a file:

Model model = ... ;
GraphStore graphStore = GraphStoreFactory.create(model) ;
UpdateAction.readExecute("update.ru", graphStore) ;

The application writer can create and execute operations:

UpdateLoad load = new UpdateLoad("etc/update-data.ttl") ;
UpdateAction.execute(load, graphStore) ;

or whole requests:

 UpdateRequest req = new UpdateRequest() ;
         // Create a named graph
 UpdateCreate c = new UpdateCreate(graphName) ;
         // Load a file into a named graph - NB order of arguments (both strings).
 UpdateLoad load = new UpdateLoad("etc/update-data.ttl", graphName) ;
         // Add the two operations and execute the request
 req.addUpdate(c) ;
 req.addUpdate(load) ;
         // Execute!
 UpdateAction.execute(req, graphStore) ;

The class UpdateAction is a set of convenience operations for calling UpdateFactory to create update requests by reading files or parsing strings, and also for creating UpdateProcessor's to perform the operations, thnen finally invoking the UpdateProcessor. An application can create these object itself (using UpdateFactory) if it requires more a complex processing model.

ARQ Documentation Page