Managing repositories

Changing repository parameters

Once a repository is created, it is possible to change some parameters, either by editing the repository in the Workbench, by changing the configuration directly in the SYSTEM repository or by setting a global override for a given property.

Note

When you change a repository parameter you have to restart GraphDB for the changes to take effect. See Running GraphDB for more information on how GraphDB can be started and stopped.

Using the Workbench

To edit a repository parameter in the GraphDB Workbench, go to Admin -> Locations and Repositories and click the edit icon for the repository whose parameters you want to edit. A form opens where you can edit the properties. Click the Save button to save your changes.

In the SYSTEM repository

Changing the configuration in the SYSTEM repository is generally not recommended as a simple error might corrupt your repository configuration.

The configurations are usually structured using blank node identifiers, which are always unique, so attempting to modify a statement with a blank node by using the same blank node identifier will fail. However, this can be achieved with SPARQL UPDATE using a DELETE-INSERT-WHERE command.

PREFIX sys:  <http://www.openrdf.org/config/repository#>
PREFIX sail: <http://www.openrdf.org/config/repository/sail#>
PREFIX onto: <http://www.ontotext.com/trree/owlim#>
DELETE { GRAPH ?g {?sail ?param ?old_value } }
INSERT { GRAPH ?g {?sail ?param ?new_value } }
WHERE {
  GRAPH ?g { ?rep sys:repositoryID ?id . }
  GRAPH ?g { ?rep sys:repositoryImpl ?impl . }
  GRAPH ?g { ?impl sys:repositoryType ?type . }
  GRAPH ?g { ?impl sail:sailImpl ?sail . }
  GRAPH ?g { ?sail ?param ?old_value . }
  FILTER( ?id = "repo_id" ) .
  FILTER( ?param = onto:enable-context-index ) .
  BIND( "true" AS ?new_value ) .
}

Warning

Some parameters can not be changed after a repository has been created. These either have no effect (once the relevant data structures are built, their structure can not be changed) or changing them will cause inconsistencies (these parameters affect the reasoner).

Global overrides

It is also possible to override a repository parameter for all repositories by setting a configuration or system property. Please, see Engine properties for more information.

Renaming a repository

This procedures involves editing of the SYSTEM repository. Changing the SYSTEM repository is generally not recommended as a simple error might corrupt your repository configuration.

For an existing repository that has already been used:

  1. Restart GraphDB to ensure that the repository is not loaded into memory (with locked/open files).

  2. Select the SYSTEM repository.

  3. Execute the following SPARQL update with the appropriate old and new names substituted in the last two lines.

    PREFIX sys:<http://www.openrdf.org/config/repository#>
    DELETE { GRAPH ?g { ?repository sys:repositoryID ?old_name } }
    INSERT { GRAPH ?g { ?repository sys:repositoryID ?new_name } }
    WHERE {
      GRAPH ?g { ?repository a sys:Repository . }
      GRAPH ?g { ?repository sys:repositoryID ?old_name . }
      FILTER( ?old_name = "old_repository_name" ) .
      BIND( "new_repository_name" AS ?new_name ) . }
    
  4. Rename the folder for this repository in the file system.

    Please refer to Configuring the GraphDB data directory for more information on how to find the location of your repositories on the disk.

    Note

    There is another consideration regarding the storage folder http://www.ontotext.com/trree/owlim#storage-folder
    If it is set to an absolute pathname and moving the repository requires an update of this parameter as well, you will need the value of this parameter (with the new name).