OWLIM-SE Configuration

Skip to end of metadata
Go to start of metadata
Search

OWLIM Documentation

All versions

OWLIM 5.4 (latest)
OWLIM 5.3
OWLIM 5.2
OWLIM 5.1
OWLIM 5.0 (this version)
OWLIM 4.3
OWLIM 4.2
OWLIM 4.1
OWLIM 4.0

This section gives an overview of configuring an OWLIM-SE repository. Also covered are the contents of the OWLIM-SE distribution and a description of the 'getting-started' application that is included. This sample application serves as an example for integrating OWLIM-SE in to other systems. For a detailed step-by-step guide for installing and setting-up OWLIM-SE, see the installation section.

Contents of the Distribution Package

The OWLIM-SE distribution zip file includes the following folders:

Folder Contents
doc User guide, quick start guide and the OWLIM primer
ext All required third party libraries. The Sesame 2 installation can be downloaded separately from http://www.openrdf.org/. The folder also contains a copy of Lehigh University Benchmark library (lubm.jar), JUnit library (junit.jar) necessary for executing inference tests, the simple logging framework for Java jar files and the lucene full text search jar
getting-started An example application that uses OWLIM, with all the necessary auxiliary files and folders, see section 8.2
lib Contains the binary executable version of OWLIM-SE as a JAR (Java library) file
lubm Scripts and configuration files to run the LUBM [16] benchmarks documented in section 11.
templates Contains an OWLIM-SE repository template file (.ttl) used by the Sesame 2 framework for creating new repositories.

The distribution contains the following files in the root directory of the zip file:

File Description
*.pie Rule files containing definitions of the built-in rule-sets, see section 7.1.2.
OWLIM-SE_license_agreement_xx.pdf The license under which OWLIM-SE is published.
owlim-se-configurator.xls A useful memory requirement calculator and configuration tool that can be used to calculate the correct Java heap size, memory allocation and various other configuration parameters. Command line and turtle configurations are generated. Instructions for using this spreadsheet are given on the first page.
setvars.cmd
setvars.sh
Scripts (Windows and Linux) that define several environment variables used by the scripts that run the test cases and getting-started application. It should be edited for each installation, as it determines the Java virtual machine to be started, the path to all the relevant JAR files, including those of OWLIM-SE and Sesame

Getting-Started Application

The OWLIM-SE distribution comes with a sample application that can be used as a template for building applications that interact with an OWLIM-SE repository. The source code of this application performs a sequence of typical operations: initialisation of the repository, uploading statements, executing queries and obtaining results, deleting statements, etc. This application template comes with:

  • Source code and compiled class files
  • Sample ontology and data files
  • Sesame repository template file
  • Scripts which invoke the application

An easy way to set up an application to use OWLIM-SE is to copy the getting-started folder and modify the contents as necessary.
There follows a short description on how the getting started application is organised and what the sample code does. The easiest way of getting a good understanding of it is to read the source code of the GettingStarted class, located in the src folder - the code is extensively commented.
The program accepts the following command line parameters:

Parameter Description Default
context If not specified, statements loaded are given the context of the file URL from which the statements were loaded. If specified (context=URI), then all statements loaded are given this URI for the context. If an empty context is used (context=) then all statements loaded have no context (default graph)  
config Specifies the repository description file to use to create a repository. Configuration options specified in this file are explained in following sections. This parameter is ignored if the url parameter is used. ./owlim.ttl
exportfile dump the repository contents to the given filename  
exporttype export all/explicit/implicit statements, default is explicit  
exportformat the RDF format: N-Triples, N3, Turtle, RDF/XML, TriG, TriX  
preload Specifies the folder or file containing RDF data that is loaded automatically when the program starts. If the parameter value specifies a folder then it is searched recursively for all files that contain RDF data. ./preload
queryfile Specifies the file containing queries that are to be executed. The files can contain queries in any format supported by Sesame. ./queries/sample.sparql
repository The repository ID, used in conjunction with the url parameter, identifies the repository on the remote Sesame server.  
showresults Specifies whether the results from queries will be displayed or not. true
showstats Indicates whether to show initialisation statistics after loading the selected data files false
updates Specifies whether the statement insertion and deletion step is performed. false
url Used in conjunction with the repository parameter, this URL specifies the remote Sesame server and will have the form http://<hostname>:<port>/openrdf-sesame/. This parameter overrides the config parameter.  

To run the program, use the example.cmd / example.sh script. This script requires that the JAVA_HOME environment variable has been set. Alternatively, it can be set directly by editing the setvars.cmd / setvars.sh script in the root folder of the OWLIM-SE software distribution. If the program is modified to use a custom rule set, then JAVA_HOME must point to the Java Runtime Environment (JRE) of a Java Development Kit (JDK) version 1.6 or later. This is so that the new mechanism for locating the Java compiler can be used.
With the example set up, OWLIM-SE loads the example ontology at start up as specified by the imports parameter in the repository configuration file, i.e. owlim.ttl. This ontology is ./ontology/example.rdfs. The sample program then loads any other ontologies that it finds in the preload folder. When start up is complete, the program outputs some statistics and lists the namespaces found.
The next step is to load the specified query file and to execute the queries that they contain. Some example query files are included in the queries folder. The files can contain several queries where each query starts with an identifier, enclosed in square brackets ^[ and ] on a single line; everything between two subsequent query identifiers is treated as a SeRQL or SPARQL query and is evaluated against the contents of the prepared repository. You may use also the # sign as a single line comment, so each line starting with # will be ignored. Syntax overview:

#some comment
^[queryid1]
<query line1>
<query line2>
...
<query lineN>
#some other comment
^[nextqueryid]
<query line1>
...
<EOF>

The queries are always evaluated, but the results are output only if the showresults parameter is set to true.
Furthermore, the sample application updates the contents of the repository by inserting a statement using RepositoryConnection.addStatement() and the transaction is committed. The program then fetches some statements from the repository using a direct call to the RepositoryConnection.getStatements(). The set of retrieved statements should contain the newly added statement since it matches the given pattern. The statement is then removed in a separate transaction.

The application can also be run against a remote repository exposed using the Sesame HTTP server. In this case, the url parameter is used to specify the sesame endpoint and the repository parameter is used to specify the repository to use on this server. The use of url and repository overrides the config parameter. To allow for this case, the following extra Apache and Sesame jar files are included in the classpath (provided with the OWLIM distribution in the ext2 folder):

commons-logging-1.1.1.jar
commons-codec-1.3.jar
commons-httpclient-3.1.jar
sesame-http-client-2.6.4.jar

Wordnet example

Wordnet, is the most popular lexical knowledge base, developed at the University of Princeton. It encodes the meanings of about 150,000 English words. The meanings of the words are defined by word-senses, which relate a word to a lexical concept. Lexical concepts are called synsets, i.e. synonym sets – about 115,000 of those appear in Wordnet v.2.0. Numerous lexical semantic relations are formally modelled, e.g.

  • Hyponymy (subsumption from a more-general term)
  • Antonymy (negation, a term with the opposite meaning)
  • Causation and entailment (for verbs)

A standard RDF/OWL representation of Wordnet is available at http://www.w3.org/TR/wordnet-rdf/. It contains about 1.9 million explicit statements (the Full variant), expressed in a fragment of OWL-Lite that further entails 6.3 million implicit statements.
To configure the getting started example program to use the Wordnet data sets and run the included Wordnet queries, one should download the archive of the full version from http://www.w3.org/2006/03/wn/wn20/download/wn20full.zip, extract it into a folder, e.g. ./preload/wordnet and provide a path to this folder using the preload command line parameter when starting the program. Some sample Wordnet queries are provided in the wordnet.serql and wordnet.sparql query files. These can be specified on the command line using the queryfile command line parameter.

Configuration

Sesame 2.0 keeps repository configurations in a SYSTEM repository – in RDF. A new repository can be configured simply by inserting an appropriate graph in to the SYSTEM repository. The getting started application uses the Turtle format for convenience and also because the Sesame console application uses the Turtle format for template files when creating repositories.
The diagram below gives a graphical illustration of an RDF graph that describes a repository configuration:

Often it is desirable to ensure that a repository starts with a predefined set of RDF statements, usually one or more schema graphs. This is possible by using the owlim:imports property. After start up, these files are parsed and their contents are permanently added to the repository. The complete set of configuration parameters, their descriptions and their default and allowed values are listed below. What follows is a short description of those properties specific to OWLIM-SE that are used to setup the repository. For more information about Sesame 2 configuration schema refer to the Sesame documentation [9]. In short, the configuration is an RDF graph, the root node is of rdf:type rep:Repository, it must be connected through rep:RepositoryID property to a Literal that contains the human readable name of the repository. The root node must be connected via the rep:repositoryImpl property to a node that describes the configuration. The type of the repository is defined via rep:repositoryType property and its value must be openrdf:SailRepository to allow for custom sail implementations (such as OWLIM-SE) to be used in Sesame 2.0. Then a node that specifies the Sail implementation to be instantiated must be connected with sr:sailImpl property. To instantiate OWLIM-SE, this last node must have a property sail:sailType with the value owlim:Sail – the Sesame framework will locate the correct SailFactory within the application classpath that will be used to instantiate the Java implementation class.
Namespaces corresponding to the prefixes used in the above paragraph are:

rep:   <http://www.openrdf.org/config/repository#>
sr:    <http://www.openrdf.org/config/repository/sail#>
sail:  <http://www.openrdf.org/config/sail#>
owlim: <http://www.ontotext.com/trree/owlim#>

All properties used to specify OWLIM-SE's configuration parameters use the owlim: prefix and the local names match up with the parameters listed below, e.g. the value of the ruleset parameter can be specified using the http://www.ontotext.com/trree/owlim#ruleset property.
Many of the OWLIM specific configuration parameters can be set via the Java Virtual Machine (JVM) system properties passed as command line parameters when starting the JVM. Values for configuration parameters that are given on the command line take precedence over those present in the repository configuration. For instance, the ruleset parameter can be set from the command line by using:

-Druleset=owl-max

Sample Configuration

There follows an example configuration (in Turtle RDF format) of a Sesame 2 repository that uses an OWLIM-SE sail implementation:

@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 owlim: <http://www.ontotext.com/trree/owlim#>.

[] a rep:Repository ;
  rep:repositoryID "owlim" ;
  rdfs:label "OWLIM Getting Started" ;
  rep:repositoryImpl [
  rep:repositoryType "openrdf:SailRepository" ;
  sr:sailImpl [
    sail:sailType "owlim:Sail" ;
    owlim:ruleset "owl-horst-optimized" ;
    owlim:base-URL "http://example.org/owlim#" ;
    owlim:imports "./ontology/my_ontology.rdf" ;
    owlim:defaultNS "http://www.my-organisation.org/ontology#" ;
    owlim:entity-index-size "5000000" ;
    owlim:cache-memory "4G" ;
    owlim:storage-folder "storage" ;
    owlim:repository-type "file-repository" ;
    ]
  ].

Memory Requirements

Apart from the I/O buffers used for caching, OWLIM-SE keeps in memory the indexes from the nodes in the RDF graph. This is a design decision in order to improve the overall performance of the repository. Each I/O buffer (page) is exactly 64kb and the indexing information per node in the graph is 12 bytes. So, depending on the dataset, memory requirements per repository may vary. To ease the calculation for the amount of Java heap memory required for an OWLIM-SE repository an excel spreadsheet is included in the distribution – owlim-se-configurator.xls.
The page cache is organized in two sets of buffers, read-only and dirty. Each page is first loaded in to the read-only cache. When this gets full, a page (if dirty) is moved to the dirty cache, where it can be later written to storage.

Cache Memory Configuration

There are several components in OWLIM that make use of caching (e.g. FTS indices, predicate list, tuple indices). In different situations certain caches will need more memory than others. OWLIM allows for the configuration of both the total cache memory to be used by a repository and all the separate per-module caches.

Parameters

The following parameters control the amount of memory assigned to each of the different caches:

Parameter Unit Default Description
cache-memory bytes   The amount of memory to be distributed among different caches
tuple-index-memory bytes 80M Memory used for PSO and POS caches
predicate-memory bytes 80M Memory used for predicate list cache
fts-memory bytes 20M Memory used for full-text index cache (node search)

All parameters can be specified in bytes, kilobytes, megabytes or gigabytes by using a unit specifier at the end of the integer number. When no unit specifier is given, this is interpreted as bytes, otherwise use k or K - kilobytes, m or M - megabytes and g or G - gigabytes (everything base 2).

Memory Distribution

The general rule of thumb is:

cache-memory = tuple-index-memory + predicate-memory + fts-memory

However, if some of the modules using the cache (e.g. full text search) are turned off it is excluded from the above equation.
Furthermore, if cache-memory is explicitly configured and some of the other memory parameters are omitted, the missing values are resolved by uniformly distributing the remaining memory after all the explicitly configured memory parameters are subtracted. For example if cache-memory = 100M, fts-memory = 10M and the other memory parameters are missing, then they are implicitly assigned (100M - 10M) / 2 = 45M each.
If cache-memory wasn't specified then all the missing memory parameters are assigned their default values.

Configuration Parameters

Almost all OWLIM parameters can be set both in the TTL configuration file and from the command line using the Java -D<param.name>=<value> command line option to set system properties. When a parameter is set simultaneously using both methods, the system property overrides the value in the configuration file. Some OWLIM parameters can only be set using system properties.
These list of all OWLIM parameters is here:

Parameter TTL Java -D Description
base-URL X X default <none>, 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.
cache-memory X X default <none>, specifies the total amount of memory to be given to all types of cache.
check-for-inconsistencies X X default false, turns on or off the mechanism for consistency checking; consistency checks are defined in the rule file and are applied at the end of every transaction if this parameter is true.
debug.level   X default 0, defines the level of detail of OWLIM output used in QueryModelConverter, SailConnectionImpl and HashEntityPool as follows:
  • QueryModelConverter:
    • debug.level > 2 : Outputs the query optimization time.
    • debug.level > 3 : Outputs the query plan.
  • SailConnectionImpl:
    • debug.level > 0 : Outputs "Owlim evaluation strategy" or "Sesame evaluation strategy" when evaluating a query.
    • debug.level > 2 : ThreadPool outputs when a worker thread starts and stops.
  • HashEntityPool:
    • debug.level > 1 : If version number is less than the current one, outputs "Older Entity storage version found: X, recent one is: Y".
defaultNS X X default <empty>, default namespaces corresponding to each imported schema file separated by semicolon
and the number of namespaces must be equal to the number of schema files from the imports parameter.
Example:

*owlim:defaultNS "http://www.w3.org/2002/07/owl#;http://example.org/owlim#";*
Note: This parameter cannot be set via a command line argument
disable-sameAs X X default false, enables or disables the owl:sameAs optimisation
enable-context-index X X default false, if set to 'true' then OWLIM will build the context index/indices.
enable-literal-index X X default true, enables or disables the literal index. The literal index is always built as data is loaded/modified. This parameter only affects whether the index is used during query-answering.
enable-optimization X X default true, enables or disables query optimization.
enablePredicateList X X default false: enables or disables mappings from an entity (subject or object) to its predicates; switching this on can drastically speed up queries that use wildcard predicate patterns.
entity-id-size X X default 32, possible values are 32 and 40; defines the bit size of internal IDs used to index entities (URIs, blank nodes and literals). For most cases, this parameter can be left to its default value. However, if very large datasets are used that contain more than 232 entities, then this parameter should be set to 40. Be aware, that this can only be set when instantiating a new repository and converting an existing repository between 32 and 40-bit entity widths is not possible.
entity-index-size X X default 1000000, defines the number of entity hash table index entries; the bigger the size, the less the collisions in the hash table and the faster the entity retrieval; the entity hash table does not rehash so its index size is constant throughout the life of the repository.
ftsIndexPolicy X X default never, possible values are onCommit, onStartup, onShutdown, never; turns on and off the default mechanism for full text search used via the built-in predicates described in section 10.1; if FTS is turned on then, depending on the value, it determines when the indexing will take place: onCommit - at the end of each transaction, onStartup – at initialisation, onShutdown - on repository shutdown.
ftsLiteralsOnly X X default false, if the Node search (full-text search) mechanism is enabled, this parameter specifies whether only literals will be indexed (value of true, enough in 90% of the cases) or everything (value of false).
fts-memory X X default 20m, specifies the amount of memory to be used for the FTS index cache.
imports X X Default none, a list of schema files that will be imported at start up. All the statements, found in these files, will be loaded into the repository and will be treated as read-only. The serialization format is assumed to be RDF/XML, unless the file has a .NT extension. Example:

owlim:imports
"./ont/owl.rdfs;./ont/ex.rdfs"

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 then the default namespace for each imported schema file must be provided using the defaultNS parameter.
Note: This parameter cannot be set via a command line argument.
index-compression-ratio X X default -1, the compression ratio of paged index files as a percentage of their uncompressed size. Valid values are '-1' (off) and the range [10-50]. The value indicates how much smaller the compressed page should be, so a value of 25 (percent) will attempt to make the index files one quarter of their uncompressed size. Any page that can not be compressed to this size will be stored uncompressed in a separate overlay file. The recommended value is '30'.
in-memory-literal-properties X X default false, turns on and off 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 a cache available on disk, it is created after the entity pool initialization.
owlim-license X X default <none>, specifies the license file for both OWLIM-SE and OWLIM-Enterprise worker nodes.
partialRDFS (DEPRECATED) X X default false, if true then trivial RDFS inferences are switched off, such as 'every URI is type ' or 'every class is a sub-class of rdfs:Resource', etc. Deprecated in favour of explicit choice of rule-set, see ruleset below. However, if this flag is set to true then the chosen ruleset will effectively have -optimized appended to it if not present, e.g. ruleset=owl-horst and partialRDFS=true is the same as selecting ruleset=owl-horst-optimized
predicate-memory X X default 80m, specifies the amount of memory to be used for predicate lists cache.
query-timeout X X default -1 (infinity), sets the number of seconds after which the evaluation of a query will be terminated; negative values stand for infinity.
read-only X X default false, where true puts the repository in to read-only mode. In this mode, no modifications are allowed to the data or namespaces.
repository-type X X default file-repository, available values are:
file-repository
weighted-file-repository
ruleset X X default owl-horst, built-in rule sets are 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 rule set is chosen by setting the path to its rule file (.pie).
storage-folder X X default none, specifies the folder where the index files will be stored.
throw-QueryEvaluationException-on-timeout X X default false, if set to true, then a QueryEvaluationException is thrown when the duration of a query execution exceeds the time-out parameter.
tokenization-regex X X default [\p{L}\d_]+, defines the rule for splitting strings into tokens; the tokens themselves, not the strings, are stored in the FTS index, so it is important to define a suitable tokenization for the given application (e.g. in some cases intensive number parsing is used, in other cases - personal names, i.e. ones starting with capital letter and may contain hyphens and apostrophes, etc.)
transaction-mode X X default safe, specifies the transaction mode. In fast mode, dirty pages are written to disk in the most lazy fashion possible, i.e. pages are only swapped when a new page is requested and there is no more memory available. No guarantees about data security are given when operating in this mode, so that in the event of an abnormal termination, the database must be considered corrupted and will need to be recreated from scratch.
When set to safe, all updates are flushed to disk at the end of each transaction. Commit operations will normally take a little longer, but recovery after an abnormal termination is instant. This mode also has much better concurrency characteristics.
transaction-isolation X X default true, this parameter only has an effect when transaction-mode=fast. In fast mode, updates will lock the repository preventing concurrent query answering. However, if this parameter is set to false, concurrent queries are permitted with the loss of isolation.
tuple-index-memory X X default 80m, specifies the amount of memory to be used for statement storage cache.
useShutdownHooks   X default true, if true then the method OwlimSchemaRepository.shutdown() is called when the Java Virtual Machine (JVM) exits (running OWLIM under Tomcat requires this parameter to be true, otherwise it cannot be guaranteed that the shutdown() method will be called at all).

Performance analytics

OWLIM-SE can provide information about its internal state and behaviour, including trend information. Such information can be useful for 'debugging' certain situations, such as understanding why load performance changes over time or with particular data sets.

Cache/index statistics

Statistics are kept for the main index data structures and includes information such as: cache hits/misses, file reads/writes, etc. This information can be used to fine tune OWLIM-SE's memory configuration.

The analytical information is published via a Java management extensions JMX management bean (MBean). A JMX endpoint is configured by using special system properties when starting the Java virtual machine (JVM) in which OWLIM-SE is running. For example, the following command line parameters will set the JMX server endpoint to listen on port 8089, not require authentication and will not use a secure socket layer:

-Dcom.sun.management.jmxremote.port=8089
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false

If using OWLIM-SE with Tomcat, then these parameters must be passed to Tomcat's JVM by setting either the JAVA_OPTS or CATALINA_OPTS environment variable, e.g.

set JAVA_OPTS="-Dcom.sun.management.jmxremote.port=8089
    -Dcom.sun.management.jmxremote.authenticate=false
    -Dcom.sun.management.jmxremote.ssl=false"

For some Linux distributions, you can also edit the file /etc/default/tomcat6 and set JAVA_OPTS there.

Once OWLIM-SE is loaded, use any compliant JMX client, e.g. jconsole that is part of the Java development kit, to access the JMX interface on the configured port. The entry point for accessing analytical information will be advertised via the com.ontotext.AVLRepositoryManager MBean, which has a single attribute called 'CollectionsStatisticsFlag'. By default, this flag is set to false. After setting this value to true, statistics will be maintained for all the major indices. For each index, there will be a SortedCollectionStatistics MBean published that shows the cache and file I/O values updated in real-time.

The following information is displayed for each index:

CacheHits The number of operations that completed without accessing the storage system.
CacheMisses The number of operations that completed that needed to access the storage system.
PageDiscards The number of times a non-dirty page's memory was reused to read in another page.
PageSwaps The number of times a page was written do disk, so its memory could be used to load another page.
Reads The total number of times an index was searched for a statement or range of statements
Writes The total number of times a statement was added to a collection

Ideally, the system should be configured to keep the number of cache misses to a minimum. If the ratio of hits to misses is low then consider increasing the memory available to the index (if other factors permit this).

Page swaps will tend to occur much more often during large scale data loading. Page discards will occur more frequently during query evaluation.

Query monitoring and termination

Information is also available via the JMX interface that provides details about executing queries (or more accurately query result iterators). These statistics are provided through a SailIterationMonitor MBean, with one for each repository instance. Each bean instance is named using the storage directory of the repository it relates to.

For every executing query the SailIterationMonitor maintains a TrackRecord object that provides the following information:

isRequestedToStop indicates if the query has been requested to terminate early (see below)
msLifeTime lifetime of the iterator (in ms) between being created and reaching the CLOSED state
msSinceCreated time (in ms) since the iterator was created
nNext total number of invocations of next() for this iterator
nsAverageForOneNext average time spent for one (has)Next calculation (in nanoseconds), i.e. nsTotalSpentInNext / nNext
nsTotalSpentInNext cumulative time spent in (has)Next calculations (in nanoseconds)
state current state of the iterator, values are: ACTIVE, IN_NEXT, IN_HAS_NEXT, IN_REMOVE, IN_CLOSE, CLOSED
trackId a sequentially generated id for this iterator

The collection of these objects grows for each executing/executed query, however older objects in the CLOSED state expire and are removed from the collection as the query result iterators are finalized.

There is a single operation available with this MBean that allows an administrator to request that a query terminates early. The operation is called requestStop and requires the trackId of the query that is to be stopped. If this operation is invoked on a running query, the isRequestedToStop flag is set to true and the next call to hasNext() will return false.

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