OWLIM-SE Indexing Specifics

Skip to end of metadata
Go to start of metadata
Search
This documentation is NOT for the latest version of GraphDB.

Latest version - GraphDB 7.1

OWLIM Documentation

Next versions

OWLIM 5.0
OWLIM 5.1
OWLIM 5.2
OWLIM 5.3
OWLIM 5.4

GraphDB 6.0 & 6.1
GraphDB 6.2
GraphDB 6.3
GraphDB 6.4
GraphDB 6.5
GraphDB 6.6
GraphDB 7.0
GraphDB 7.1

Previous versions

OWLIM 4.3
OWLIM 4.2
OWLIM 4.1
OWLIM 4.0

Comparison of OWLIM-SE and OWLIM-Lite

The major differences between OWLIM-SE and OWLIM-Lite are their performance and scalability. Both OWLIM editions deliver identical functionality for RDF storage, inference and query answering and they both implement Sesame's SAIL APIs, as discussed in section 4. This guarantees that all essential functions of a semantic repository are supported by OWLIM in a standard, consistent, and interoperable manner.
Compared to OWLIM-Lite, OWLIM-SE adds additional features and augments many aspects related to performance, which in most cases is a matter of special indexing strategies that allow more efficient retrieval. Functionally, the differences can be classified in to two groups:

  • Do the same better: the corresponding feature does not allow the user to do more things with OWLIM-SE – it rather makes it work better in specific circumstances. This is the case with predicate lists (section 6.2) and the owl:sameAs optimisation (section 7.5);
  • Do more: deliver a new type of functionality, which is not available in OWLIM-Lite. Such examples are RDF ranking and RDF priming (sections 10.1 and 10.4). Full-text search features (section 10.1) are also available in OWLIM-SE, although this could be seen as an enhancement since similar, but less powerful, behaviour is available by using regular expression constraints (which disregard tokenization and deliver different results).

In the 'do more' category, OWLIM-SE delivers functionality that is not exposed by the Sesame API. Typically, this is achieved with the use of special-purpose system predicates. One should be aware that using the 'do more' features will affect compatibility with other semantic repositories.

Persistence Strategy

OWLIM-SE stores all of its data (statements, indexes, entity pool, etc) in files in the configured storage directory, usually called 'storage'. The content and names of these files is not defined and is subject to change between versions. In general, the index structures used in OWLIM-SE are chosen and optimised to allow for efficient:

  • handling of billions of facts under reasonable RAM constraints;
  • query optimisation;
  • transaction management;
  • multi-threaded inference.

OWLIM-SE maintains two main indices on statements for use in inference and query evaluation, these are the predicate-object-subject (POS) index and the predicate-subject-object (PSO) index. There are many other additional data structures that are used to enable the efficient manipulation of RDF data, but these are not listed since these internal mechanisms cannot be configured.
The following subsections describe several indexing options, which deliver considerable advantages for specific datasets, retrieval patterns and query loads. Most of these are switched off by default, thus the user should take the initiative to switch them on if necessary. Unless otherwise stated, OWLIM-SE allows one to switch indices on and off against an already populated repository; the repository should be shut down before the change of the configuration is specified. The next time the repository is started, OWLIM-SE will create or remove the corresponding index. In the case that the repository is already loaded with a large volume of data, switching on a new index can lead to considerable delays during initialisation – this is the time required for building the new index.

It is vitally important to shutdown repository connections properly to ensure that unwritten data is flushed to the file-system. OWLIM-SE includes mechanisms to prevent data loss in the case of unexpected termination of the process, however, recovery after unexpected termination may require additional time and data can be lost for reasons beyond OWLIM-SE's control, e.g. operating system caching.

Predicate Lists

Certain data-sets and certain kinds of query activities, for example queries that use wild-card patterns for predicates, benefit from another type of index called a 'predicate list'. This index maps from entities (subject or object) to their predicates. This index is not switched on by default (see enablePredicateList in section 8.5), because it is not always necessary. Indeed, for most datasets and query loads the performance of OWLIM-SE without such an index is good enough even with wild-card-predicate queries, and the overhead of maintaining this index are not justified. One should consider using this index for datasets that contain a very large number (~1000) different predicates.

Context and Tripleset Indices

There are two more optional indices that can be used to speed up query evaluation when searching statements via their context or tripleset identifier. These indices are the PCSOT and the PTSOC indices and can be switch on independently. See the build-pcsot and build-ptsoc parameters in section 8.5.

Index compression

The pages containing index data structures can optionally be written to disk with ZIP compression. This adds a small overhead to the performance of read/write operations, but can save a significant amount of disk-storage space. This is particularly significant for large databases that use expensive SSD storage devices.

Index compression is controlled using a single configuration parameter called index-compression-ratio, whose default value is -1 indicating no compression. To create a repository that uses ZIP compression, set this parameter to a value between 10 and 50 percent (inclusive). Once created, this compression ratio can not be changed.

The value for this parameter indicates the attempted compression ratio for pages - the smaller the value the more compression is attempted. When page can not be compressed below the requested size, they are stored uncompressed. Therefore setting this value too low will not save any disk space and will simply add to the processing overhead. Typically, a value of 30% gives good performance with significant disk-space reduction (of 70%).

Resource compression

As of OWLIM-SE version 4.4, the mapping table between resources and their internal identifiers (32 or 40 bit integers) also compresses resources to a certain extent. The method used is straightforward - it simply stores literals and URLs using 8-bit characters instead of 16-bit characters whenever possible. Nevertheless, this can significantly reduce disk storage requirements.

Literal index

As of OWLIM-SE version 4.4, an additional index is automatically built that allows faster look-ups of numeric and date/time object values. The index is used during query evaluation only if a query or a subquery (e.g. union) has a filter that is comprised of a conjunction of literal constraints using comparisons and equality (but no negation or inequality), e.g. FILTER(?x = 100 && ?y <= 5 && ?start > "2001-01-01"^^xsd:date)
Other patterns will not use the index in this version of OWLIM, i.e. no attempt is made to re-write filters into usable patterns.

For example, these FILTER patterns will all make use of the literal index:

FILTER( ?x = 7 )
FILTER( 3 < ?x )
FILTER( ?x >= 3 && ?y <= 5 )
FILTER( ?x > "2001-01-01"^^xsd:date )

Whereas these FILTER patterns will not:

FILTER( ?x > (1 + 2) )
FILTER( ?x < 3 || ?x > 5 )
FILTER( (?x + 1) < 7 )
FILTER( ! (?x < 3) )

NOTE: Due to the way that literals are stored, dates far in the future and far into the past (approximately 200,000,000 years forward or backward) will behave unexpectedly. Also, numbers beyond the range of 64-bit floating-point representation, i.e. above approximately 1e309 and below -1e309 will behave unexpectedly.

In case of some unexpected behaviour or problem with the new literal index implementation, the use of this index during query evaluation can be disabled with a configuration parameter called enable-literal-index. The default value is true.

Transaction Support

Transaction support is exposed via Sesame's RepositoryConnection interface. The three methods of this interface that give the client control over when updates are committed to the repository are shown below:

Method Effect
void commit() Commits all updates that have been performed through this connection since the last commit or rollback operation.
void rollback() Rolls back all updates that have been performed through this connection object since the last commit or rollback operation.
void setAutoCommit(boolean autoCommit) Enables or disables auto-commit mode for the connection.

OWLIM-SE supports the so called 'read committed' transaction isolation level, well known to relational database management systems. It guarantees that changes will not impact query evaluation, before the entire transaction they are part of is successfully committed. It does not guarantee that execution of a single transaction is performed against a single state of the data in the repository. Regarding concurrency:

  • multiple update/modification/write transactions can be initiated and stay open simultaneously, i.e. one transaction does not need to be committed in order to allow another transaction to complete;
  • update transactions are processed internally in sequence, i.e. OWLIM processes the commits one after another;
  • update transactions do not block read requests in any way, i.e. hundreds of SPARQL queries can be evaluated in parallel (the processing is properly multi-threaded) while update transactions are being handled on separate threads.

One should note that OWLIM performs materialization, making sure that all the statements which can be inferred from the current state of the repository are indexed and persisted (except for those compressed due to the owl:sameAs optimisation, described in section 7.5). When the commit method completes, all reasoning related activities related to the changes in the data introduced by the corresponding transaction will have already been performed.

An uncommitted transaction will not affect the 'view' of the repository through any connection, including the connection used to do the modification. This is perhaps not in keeping with most relational database implementations. However, committing a modification to a semantic repository involves considerably more work, specifically the computation of the changes to the inferred closure resulting from the addition or removal of explicit statements. This computation is only carried out at the point where the transaction is committed and so to consistent, neither the inferred statements nor the modified statements related to the transaction are 'visible'.

Handling of Explicit and Implicit Statements

As already described, OWLIM-SE applies the inference rules at load time in order to compute the full closure. Therefore a repository will contain some statements that are explicitly asserted and other statements that exist through implication. In most cases clients will not be concerned with the difference, however there are some scenarios when it is useful to work with only explicit or only implicit statements. The following sections describe how these two groups of statements can be isolated during programmatic statement retrieval using the Sesame API and during (SPARQL) query evaluation.

Retrieving Statements with the Sesame API

The usual technique for retrieving statements is to use the RepositoryConnection method:

The method retrieves statements by 'triple pattern', where any or all of the subject, predicate and object parameters can be null to indicate 'wild cards'.
To retrieve explicit and implicit statements, the includeInferred parameter must be set to true. To retrieve only explicit statements, the includeInferred parameter must be set to false.
However, the Sesame API does not provide the means to enable the retrieval of implicit statements only. In order to allow clients to do this, OWLIM-SE allows the use of the special 'implicit' pseudo-graph (section 10.7.1) with this API, which can be passed as the context parameter. The following example shows how only implicit statements can be retrieved:

The above example uses wildcards for subject, predicate and object and will therefore return all implicit statements in the repository.

SPARQL Query Evaluation

OWLIM-SE also provides mechanisms to differentiate between explicit and implicit statements during query evaluation. This is achieved by associating statements with two pseudo-graphs (explicit and implicit) and using special system URIs to identify these graphs. Full details can be found in the query behaviour section.

Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.