Sesame Server Commands
I have encountered several problems whilst trying to use AllegroGrpah's Sesame Server. This is mainly down to the HTTP client that I am using not being fully functional and having to hack the code as I go along. Below is a listing of all the commands I have got working using the infrastucture I build up in Running a Sesame Server on AllegroGraph with useful examples of actually commands that I have submitted that have actually worked.
GET /sesame/protocol
This is a simple command that returns the protocol it is not especially useful except for a test to tell you server is working properly.
GET /sesame/respositories
This will list all the repositories available. These will have to be opened at some point (see POST /sesame/repositories) so if you look initially the list will be empty.
POST /sesame/repositories
This allows you to create new repositories or to open current ones, using the following parameters as a template:
Parameter | Create New | Open Existing |
---|---|---|
id | myexp | myexp |
if-exists | supersede | open |
name | myexperiment | myexperiment |
directory | temp/myexp | temp/myexp |
title | myexperiment | myexperiment |
In all future commands this values will be used. E.g. myexp is the id of the repository so will be used in commands such as GET /sesame/repositories/<id>/namespaces.
GET /sesame/repositories/myexp/namespaces
This allows you to see the namespaces defined for the repository, in this case the repository with the id myexp.
PUT /sesame/repositories/myexp/namespaces/myexpont
This command allows you to add a namespace to the myexperiment repository. In this case we want to add the myexperiment ontology as a namespace. To do tthis the prefix needs to be defined in the command, in this case myexpont and the URL needs to be specified in the body, i.e. http://users.ecs.soton.ac.uk/drn05r/myexperiment/myExperiment.owl#. If you make a mistake in the URL you can just repeat the command and to overwrite the namespace for that prefix.
DELETE /sesame/repositories/myexp/namespaces/myexpont
This command allows you to remove a namespace, which might be useful if you gave it the wrong prefix or just simply don't need it.
GET /sesame/repositories/myexp
This allows you to query the triplestore, in particular SPARQL queries. To do this you need to set the Accept value to application/sparql-results+xml, assuming you are performing a SELECT or ASK request, (CONSTRUCT and DESCRIBE require application/rdf+xml. The following parameters also need to be set, below is an example that will return all the triples in the repository:
Parameter | Value |
---|---|
query | SELECT ?x ?y ?z WHERE {?x ?y ?z} |
queryLn | SPARQL |
GET /sesame/repositories/myexp/contexts
This returns the contexts of the selected reposistory. I have quite determined the usefulness of this at the moment as I haven'y started to build up my repository yet.
GET /sesame/respositories/myexp/size
This returns the number of triples in the chosen repository. If this is 0 at some point my php script loses this before it is printed out.