# Getting started with SPARQL Update

Using Fuseki.

I’ve described in earlier postings ([1],[2]) how I mostly use Jena ARQ to play with SPARQL 1.1 queries. To try out the new SPARQL Update commands, I wanted to use a simple triplestore where I could add, replace, and delete triples, and Jena Fuseki has turned out to be a very simple way to do this.

Unzipping the file that I downloaded from the Fuseki release 0.2 development snapshot created a directory with a jar file, some shell scripts, and a few other files. The shell scripts included with this zip file are all Linux-oriented, but looking at them I figured out how to start up the Fuseki server in Windows easily enough. Everything shown below worked in both Windows XP and Ubuntu.

Running this command in the Fuseki directory lists your options:

java -jar fuseki-sys.jar --help


The following command line worked great for me to start up the Fuseki server with a 1200 meg Java heap space, a figure I saw in the fuseki-server shell script included with the zip file. It allows users of the server to update data, stores data in a TDB database in the dataDir subdirectory that I created in the Fuseki directory before running this command, and selects the myDataset dataset:

java -Xmx1200M -jar fuseki-sys.jar --update --loc=dataDir /myDataset


After starting the server up, you can send your browser to the main Fuseki screen at http://localhost:3030. Click its Control Panel link, then click the Select button to pick the /myDataset dataset, and you’ll be on the Fuseki Query screen:

To insert a bit of data into the triplestore, paste the following into the box in the SPARQL Update part of the form and click the Perform update button under the box:

PREFIX d:    <http://example.com/ns/data#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

INSERT DATA
{
d:i1 rdfs:label "one" .
d:i2 rdfs:label "two" .
}


Next, enter the following classic query in the SPARQL Query part of the Fuseki Query form and click the Get Results button there:

SELECT *
WHERE { ?s ?p ?o }


Fuseki will show you all the triples in your triplestore’s default graph—both of them. Click your Back button again, and Fuseki’s query form will still have the two queries you entered. You can edit them, comment out certain lines, and do whatever you like as you experiment with inserting, changing, and deleting data in the triplestore.

Because of the command line options that I used when starting up Fuseki above, the data persists. If go to the command line window where you started up the Fuseki server and press Ctrl+C to shut it down, then start it up again and try the same SELECT query above, you’d see that the data is still there.

There’s a lot more you can do with Fuseki, but the steps above were all I needed to create an environment where I could try out the commands described in the SPARQL Update spec. As far as I can tell, all the important parts of the spec work in Fuseki, so it’s a fine way to get to know this great new addition to SPARQL.