OWLIM is packaged as a Storage and Inference Layer (SAIL) for Sesame version 2.x and makes extensive use of the features and infrastructure of Sesame, especially the RDF model, RDF parsers and query engines. Explicit and inferred statements are stored in highly-optimized data structures. The inferred closure is updated through inference at the end of each transaction that modifies the repository.
This section will describe using the Sesame API to create and access OWLIM repositories, both on the local file-system and remotely via the Sesame HTTP server. Furthermore, a brief introduction will be given to the Sesame workbench Web application that provides many repository management functions through a convenient user interface.
Sesame Application Programming Interface (API)
Programmatically, OWLIM can be used via the Sesame Java framework of classes and interfaces. Documentation for these interfaces (including Javadoc) can be found at http://www.openrdf.org. Code snippets in the following sections are taken from (or are variations of) the GettingStarted example program that comes with the OWLIM distribution.
Using the Sesame API to access a local OWLIM repository
With Sesame 2, repository configurations are represented as RDF graphs. A particular repository configuration is described as a resource, possibly a blank node, of type:
@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 "swiftowlim:Sail" ; owlim:ruleset "owl-horst-optimized" ; owlim:noPersist "true" ; owlim:storage-folder "storage" ; owlim:base-URL "http://example.org/owlim#" ; owlim:new-triples-file "new-triples-file.nt" ; owlim:entity-index-size "200000" ; owlim:jobsize "200" ; owlim:repository-type "in-memory-repository" ; owlim:imports "./ontology/owl.rdfs " ; owlim:defaultNS " http://example.org/owlim#" . ] ].
Note that the code to parse this file and find the 'root' node for the configuration can be found in the getting-started program.
Using the Sesame API to access a remote OWLIM repository
The Sesame Server is a Web application that allows interaction with repositories using the HTTP protocol. It runs in a JEE compliant servlet container, e.g. Tomcat, and allows client applications to interact with repositories located on remote machines. All that is required to connect to and use a remote repository instead of a local one is to replace the local repository manager for a remote one. The URL of the Sesame Server must be provided, but no repository configuration is needed if the repository already exists on the server. The following lines can be added to the getting-started example program, although a correct URL must be specified:
The rest of the example program should work as expected, although the following library files must be added to the class-path:
Example to create a connection to a remote repository
Managing repositories with the Sesame Workbench
The installation section explains how to set up an OWLIM repository that is exposed via the Sesame HTTP Server. In summary, the Sesame Server and Workbench applications are deployed to a Tomcat instance. After this, the workbench can be used to connect to the Sesame server and create a repository instance.
The server has a simple user interface that shows status, logging and configuration information.
The workbench lists repositories and their namespaces, allows for the addition and deletion of statements, and provides a query interface for SPARQL and SeRQL query languages.
The Sesame HTTP server is a fully fledged SPARQL endpoint - the Sesame HTTP protocol is a super-set of the SPARQL 1.1 protocol - that provides an interface for transmitting SPARQL (federated) queries and updates to a SPARQL processing service and returning the results via HTTP to the entity that requested them.
Any tools or utilities designed to interoperate with the SPARQL protocol will function with OWLIM when deployed using the Sesame HTTP server, i.e. the openrdf-sesame Web application.
Graph Store HTTP Protocol
The SPARQL 1.1 Graph Store HTTP Protocol is fully supported for direct and indirect graph names. The W3C working draft has the most details, although further information can be found in the Sesame user guide.
This protocol supports the management of RDF statements in named graphs in the REST style, by providing the ability to get, delete, add to or overwrite statement in named graphs using the basic HTTP methods.
OWLIM-Lite Usage Scenarios
Skip to end of metadata Go to start of metadata