Comparison of GraphDB-SE and GraphDB-Lite
The major differences between GraphDB-SE and GraphDB-Lite are their performance and scalability. Both GraphDB editions deliver identical functionality for RDF storage, inference and query answering and they both implement Sesame's SAIL APIs. This guarantees that all essential functions of a semantic repository are supported by GraphDB in a standard, consistent, and interoperable manner.
In the 'do more' category, GraphDB-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.
GraphDB-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 GraphDB-SE are chosen and optimised to allow for efficient:
GraphDB-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.
There are two transaction mechanisms in GraphDB. The default (safe) mode causes all updates to be flushed to disk as part of the commit operation. The ordering of updated pages in the index files and the sequence used to write them to the file-system mean that they are consistent with the state of the database prior to the update in the event of an abnormal termination. In other words, rollback is natively supported should the application crash and recovery after such an event is instant. Also, the method for updating data structures (copy of page index and copy-on-write of pages) mean that a high level of concurrency is supported between updates queries.
In bulk-loading (fast) mode, updated pages are not automatically flushed to disk and remain in memory until the cache is exhausted and further pages are required. Only then are the least recently used dirty pages swapped to disk. This can be significantly faster than safe mode when updating using a single-thread, but no guarantees for data security are made in this mode. If a crash occurs, then data will be lost. The intention of this mode is to speed up regular bulk-loading in situations where query loads are negligible or non-existent. Query and update concurrency in this mode is not as sophisticated as safe mode.
The transaction mode is set using the transaction-mode configuration parameter - see the configuration section. Changing modes requires GraphDB to be restarted.
In fast transaction mode, the isolation constraint can be relaxed in order to improve concurrency behaviour when strict read isolation is not a requirement - this is controlled by a new parameter transaction-isolation that only has an effect in fast mode - see the configuration section.
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:
GraphDB-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:
One should note that GraphDB performs materialisation, making sure that all the statements that 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.
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 the configuration section), because it is not always necessary. Indeed, for most datasets and query loads the performance of GraphDB-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 (greater than around 1000) different predicates.
There are two more optional indices that can be used to speed up query evaluation when searching statements via their context identifier. These indices are the PCSO and the PCOS indices and are switched on together. See the enable-context-index parameter in the configuration section.
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. Pages that can not be compressed below the requested size 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, i.e. around 70% less disk space used for each index. The total disk space requirements are typically reduced by around half when using index compression at 30%.
A literal 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)
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) )
The decision by the query-optimiser whether to make use of this index is statistics-based. If the estimated number of matches for a filter constraint is large relative to the rest of the query, e.g. a constraint with large or one-sided range, then the index might not be used at all.
Handling of Explicit and Implicit Statements
As already described, GraphDB-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'.
The above example uses wildcards for subject, predicate and object and will therefore return all implicit statements in the repository.
SPARQL Query Evaluation
GraphDB-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.
GraphDB-SE Indexing Specifics
Skip to end of metadata Go to start of metadata