Configuring a Repository

Before you start adding or changing the parameter values, we recommend planning your repository configuration and familiarizing yourself with what each of the parameters does, what the configuration template is and how it works, what data structures GraphDB supports, what configuration values are optimal for your setup, etc.

Configure a repository through the GraphDB Workbench

To configure a new repository, complete its properties form.

_images/create-repo.png

Note

If you need a repository with enabled SHACL validation, you must enable this option at configuration time. SHACL validation cannot be enabled after the repository has been created.

Edit a repository

Some of the parameters you specify at repository creation time can be changed at any point.

  1. Click the Edit icon next to a repository to edit it.

  2. Restart the repository for the changes to take effect.

Configure a repository programmatically

Tip

GraphDB uses an RDF4J configuration template for configuring its repositories. RDF4J keeps the repository configurations with their parameters, modeled in RDF. Therefore, in order to create a new repository, the RDF4J needs such an RDF file. For more information on how the configuration template works, see Repository configuration template - how it works.

To configure a new repository programmatically:

  1. Fill in the .ttl configuration template that can be found in the /configs/templates folder of the GraphDB distribution. The parameters are described in the Configuration parameters section.

    # RDF4J configuration template for a GraphDB repository
    
    @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
    @prefix rep: <http://www.openrdf.org/config/repository#>.
    @prefix sr: <http://www.openrdf.org/config/repository/sail#>.
    @prefix sail: <http://www.openrdf.org/config/sail#>.
    @prefix graphdb: <http://www.ontotext.com/config/graphdb#>.
    
    [] a rep:Repository ;
        rep:repositoryID "{%Repository ID|repo-test%}" ;
        rdfs:label "{%Repository description%}" ;
        rep:repositoryImpl [
            rep:repositoryType "graphdb:SailRepository" ;
            sr:sailImpl [
                sail:sailType "graphdb:Sail" ;
    
                graphdb:read-only "{%Read-only|false%}" ;
    
                # Inference and Validation
                graphdb:ruleset "{%Ruleset|rdfsplus-optimized%}" ;
                graphdb:disable-sameAs "{%Disable owl:sameAs|true%}" ;
                graphdb:check-for-inconsistencies "{%Enable consistency checks|false%}" ;
    
                # Indexing
                graphdb:entity-id-size "{%Entity ID size|32%}" ;
                graphdb:enable-context-index "{%Enable context index|false%}" ;
                graphdb:enablePredicateList "{%Enable predicate list index|true%}" ;
                graphdb:enable-fts-index "{%Enable full-text search (FTS) index|false%}" ;
                graphdb:fts-indexes {%FTS indexes to build (comma delimited)|default, iri%} ;
                graphdb:fts-string-literals-index "{%FTS index for xsd:string literals|default%}" ;
                graphdb:fts-iris-index "{%FTS index for full-text indexing of IRIs|none%}" ;
    
                # Queries and Updates
                graphdb:query-timeout "{%Query timeout (seconds)|0%}" ;
                graphdb:throw-QueryEvaluationException-on-timeout "{%Throw exception on query timeout|false%}" ;
                graphdb:query-limit-results "{%Limit query results|0%}" ;
    
                # Settable in the file but otherwise hidden in the UI and in the RDF4J console
                graphdb:base-URL "{%Base URL|http://example.org/owlim#%}" ;
                graphdb:defaultNS "{%Default namespaces for imports(';' delimited)%}" ;
                graphdb:imports "{%Imported RDF files(';' delimited)%}" ;
                graphdb:repository-type "{%Repository type|file-repository%}" ;
                graphdb:storage-folder "{%Storage folder|storage%}" ;
                graphdb:entity-index-size "{%Entity index size|10000000%}" ;
                graphdb:in-memory-literal-properties "{%Cache literal language tags|true%}" ;
                graphdb:enable-literal-index "{%Enable literal index|true%}" ;
            ]
        ].
    

    To configure a SHACL validation enabled repository programmatically, do the same as above, but with the added SHACL parameters:

    # RDF4J configuration template for a GraphDB repository with SHACL
    
    @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
    @prefix rep: <http://www.openrdf.org/config/repository#>.
    @prefix sr: <http://www.openrdf.org/config/repository/sail#>.
    @prefix sail: <http://www.openrdf.org/config/sail#>.
    @prefix graphdb: <http://www.ontotext.com/config/graphdb#>.
    @prefix shacl: <http://rdf4j.org/config/sail/shacl#>.
    
    
    [] a rep:Repository ;
        rep:repositoryID "{%Repository ID|repo-test%}" ;
        rdfs:label "{%Repository description%}" ;
        rep:repositoryImpl [
            rep:repositoryType "graphdb:SailRepository" ;
            sr:sailImpl [
                sail:sailType "rdf4j:ShaclSail";
    
                sail:delegate [
                    sail:sailType "graphdb:Sail" ;
    
                    graphdb:read-only "{%Read-only|false%}" ;
    
                    # Inference and Validation
                    graphdb:ruleset "{%Ruleset|rdfsplus-optimized%}" ;
                    graphdb:disable-sameAs "{%Disable owl:sameAs|true%}" ;
                    graphdb:check-for-inconsistencies "{%Enable consistency checks|false%}" ;
    
                    # Indexing
                    graphdb:entity-id-size "{%Entity ID size|32%}" ;
                    graphdb:enable-context-index "{%Enable context index|false%}" ;
                    graphdb:enablePredicateList "{%Enable predicate list index|true%}" ;
                    graphdb:enable-fts-index "{%Enable full-text search (FTS) index|false%}" ;
                    graphdb:fts-indexes {%FTS indexes to build (comma delimited)|default, iri%} ;
                    graphdb:fts-string-literals-index "{%FTS index for xsd:string literals|default%}" ;
                    graphdb:fts-iris-index "{%FTS index for full-text indexing of IRIs|none%}" ;
    
                    # Queries and Updates
                    graphdb:query-timeout "{%Query timeout (seconds)|0%}" ;
                    graphdb:throw-QueryEvaluationException-on-timeout "{%Throw exception on query timeout|false%}" ;
                    graphdb:query-limit-results "{%Limit query results|0%}" ;
    
                    # Settable in the file but otherwise hidden in the UI and in the RDF4J console
                    graphdb:base-URL "{%Base URL|http://example.org/owlim#%}" ;
                    graphdb:defaultNS "{%Default namespaces for imports(';' delimited)%}" ;
                    graphdb:imports "{%Imported RDF files(';' delimited)%}" ;
                    graphdb:repository-type "{%Repository type|file-repository%}" ;
                    graphdb:storage-folder "{%Storage folder|storage%}" ;
                    graphdb:entity-index-size "{%Entity index size|10000000%}" ;
                    graphdb:in-memory-literal-properties "{%Cache literal language tags|true%}" ;
                    graphdb:enable-literal-index "{%Enable literal index|true%}" ;
                ] ;
    
    
            # Settable in the UI and in the RDF4J console
            shacl:cacheSelectNodes "{%Cache select nodes|true%}" ;
            shacl:dashDataShapes "{%DASH data shapes extensions|true%}" ;
            shacl:logValidationPlans "{%Log the executed validation plans|false%}" ;
            shacl:logValidationViolations "{%Log validation violations|false%}" ;
            shacl:parallelValidation "{%Run parallel validation|true%}" ;
            shacl:globalLogValidationExecution "{%Log every execution step of the SHACL validation|false%}" ;
            shacl:performanceLogging "{%Log the execution time per shape|false%}" ;
            shacl:eclipseRdf4jShaclExtensions "{%RDF4J SHACL extensions|true%}" ;
            shacl:validationResultsLimitTotal "{%Validation results limit total|1000000%}" ;
            shacl:validationResultsLimitPerConstraint "{%Validation results limit per constraint|1000%}" ;
            shacl:shapesGraph {%Named graphs for SHACL shapes|http://rdf4j.org/schema/rdf4j#SHACLShapeGraph%} ;
    
            # Settable in the file but otherwise hidden in the UI and in the RDF4J console
            shacl:validationEnabled "{%Enable the SHACL validation|true%}" ;
            shacl:rdfsSubClassReasoning "{%RDFS subClass reasoning|true%}" ;
            shacl:transactionalValidationLimit "{%Transactional validation limit|500000%}" ;
        ]
    ].
    
  2. Use this command to create a repo from the config.ttl:

    curl -X POST --header "Content-Type:multipart/form-data" -F "config=@./config.ttl"
      "http://localhost:7200/rest/repositories"
    

Configuration parameters

This is a list of all repository configuration parameters. Some of the parameters can be changed (effective after a restart), some cannot be changed (the change has no effect) and others need special attention once a repository has been created, as changing them will likely lead to inconsistent data (e.g., unsupported inferred statements, missing inferred statements, or inferred statements that cannot be deleted).

Parameter name

Description

Default value

base-URL

Specifies the default namespace for the main persistence file. Non-empty namespaces are recommended, because their use guarantees the uniqueness of the anonymous nodes that may appear within the repository.

none
Can be changed.
check-for-inconsistencies

Enables or disables the mechanism for consistency checking. If this parameter is true, consistency checks are defined in the rule file and applied at the end of every transaction. If an inconsistency is while committing a transaction, the whole transaction will be rolled back.

false
Can be changed.

defaultNS

Default namespaces corresponding to each imported schema file, separated by semicolon. The number of namespaces must be equal to the number of schema files from the imports parameter. Example: graphdb:defaultNS "http://www.w3.org/2002/07/owl#;http://example.org/"

Warning: This parameter cannot be set via a command line argument.
<empty>
Cannot be changed.
disable-sameAs

Enables or disables the owl:sameAs optimization.

Warning: This parameter needs special attention.
true
Can change in the UI depending on the ruleset.
enable-context-index

Possible value: true, where GraphDB will build and use the context index.

false
Can be changed.
enable-literal-index

Enables or disables the storage. The literal index is always built as data is loaded/modified. This parameter only affects whether the index is used during query answering.

true
Can be changed.
enablePredicateList

Enables or disables mappings from an entity (subject or object) to its predicates; enabling it can significantly speed up queries that use wildcard predicate patterns.

true
Can be changed.
enable-fts-index

Enables or disables the full-text search index. In general, searching is performed via SPARQL queries using a pattern like this:

?value onto:fts (query index limit)

false
Can be changed.
fts-indexes

Comma-delimited list of languages that should have a specific index with an appropriate analyzer for full-text search.

Possible values: default, iri, ar, bg, bn, br, ca, ja, ko, zh, ku, cz, da, de, el, en, es, et, eu, fa, fi, fr, ga, gl, hi, hu, hy, id, it, lt, lv, ne, nl, no, pt, ro, ru, sr, sv, ta, te, th, tr
default, iri
Can be changed.
fts-string-literals-index

The index in which the string literals (xsd:string) are indexed.

Possible values: none, default, or a 2-letter language code.

default
Can be changed.
fts-iris-index

The index in which the IRIs are indexed for full-text search.

Possible values: none, default, or a 2-letter language code.

none
Can be changed.

entity-id-size

Defines the bit size of internal IDs used to index entities this parameter can be left at its default value. However, if using very large datasets containing over 2 31 entities, set this parameter to 40. Be aware that this can only be set when instantiating a new repository, and that converting an existing repository from 32 to 40-bit entity widths is not possible.

Possible values: 32 and 40.
32
Cannot be changed.
entity-index-size

Defines the initial size of the entity hash table index entries. The bigger the size, the fewer the collisions in the hash table, and the faster the entity retrieval. The entity hash table will adapt to the number of stored entities once the number of collisions passes a critical threshold.

Warning: Once initially set, this parameter cannot be changed by the user.

10,000,000

imports
Tip: Schema files can be either a local path name, e.g., ./ontology/myfile.rdf or a URL, e.g., http://www.w3.org/2002/07/owl.rdf. If this parameter is used, the default namespace for each imported schema file must be provided using the defaultNS parameter.

A list of schema files that will be imported at startup. All statements found in these files will be loaded in the repository and will be treated as read-only. The serialization format is determined by the file extension:

  • .brf => BinaryRDF

  • .n3 => N3

  • .nq => N-Quads

  • .nq => N-Quads

  • .nt => N-Triples

  • .owl => RDF/XML

  • .rdf => RDF/XML

  • .rdfs => RDF/XML

  • .trig => TriG

  • .trix => TriX

  • .ttl => Turtle

  • .xml => TriX

Example: graphdb:imports "./ont/owl.rdfs;./ont/ex.rdfs"
none
Cannot be changed.
in-memory-literal-properties

Enables or disables caching of the literal languages and data types. If the caching is on and the entity pool is restored from persistence, but there is no such cache available on disk, it is created after the entity pool initialization.

true
Can be changed.

nonInterpretablePredicates

Colon-separated list of predicates (full URLs) that GraphDB will not try to process with the registered GraphDB plugins. (Predicates processed by registered plugins are often called “Magic” predicates). This optimization will speed up the data loading by providing a hint that these predicates are not magic.

http://www.w3.org/2000/01/rdf-
schema#label;http://www.w3.org/
1999/02/22-rdf-syntax-ns#type;
http://www.ontotext.com/owlim/
ces#gazetteerConfig;http:
//www.ontotext.com/owlim/ces
#metadataConfig

query-limit-results

Sets the maximum number of results returned from a query after which he evaluation of a query will be terminated; values less than or equal to zero mean no limit.

0; (no limit)
Can be changed.
query-timeout

Sets the number of seconds after which the evaluation of a query will be terminated; values less than or equal to zero mean no limit.

0; (no limit)
Can be changed.

read-only

In this mode, no modifications to the data or namespaces are allowed.

Possible value: true, puts the repository in read-only mode.
false
Can be changed.

repository-type

In this mode, no modifications to the data or namespaces are allowed.

Possible values: file-repository, weighted-file-repository.
file-repository
Cannot be changed.
ruleset

Sets of axiomatic triples, consistency checks and entailment rules, which determine the applied semantics.

Possible values: empty, rdfs, owl-horst, owl-max, and owl2-rl, and their optimized counterparts rdfs-optimized, owl-horst-optimized, owl-max-optimized, and owl2-rl-optimized. A custom ruleset is chosen by setting the path to its rule file .pie.
Warning: This parameter needs special attention.

rdfsplus-optimized

storage-folder

Specifies the folder where the index files will be stored.

none
Can be changed.

throw-QueryEvaluationException-on-timeout

Possible value: true; if set, a QueryEvaluationException is thrown when the duration of a query execution exceeds the timeout parameter.

false
Can be changed.

Reconfigure a repository

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

Note

When you change a repository parameter, you need to restart GraphDB for the changes to take effect.

Using the Workbench

To edit a repository parameter in the GraphDB Workbench, go to Setup ‣ Repositories and click the Edit icon for the repository whose parameters you want to edit.

Global overrides

It is also possible to override a repository parameter for all repositories by setting a configuration or system property. See Engine properties for more details on how to do it.

Rename a repository

Using the Workbench

Use the Workbench to change the repository ID. This will update all locations in the Workbench where the repository name is used.