Summary:
This article covers some of the basics of
Sesame and how to deploy Ontotext OWLIM as a semantic repository.
You also need a copy of OWLIM(
http://www.ontotext.com/owlim) semantic database from Ontotext. OWLIM comes in two favors: Swift OWLIM and Big OWLIM. Here the Big-OWLIM version 3.2.5 has been used. Big-OWLIM is the more robust and scalable version of OWLIM.
Currently this is not a guide to optimize your OWLIM performance, it just tells you how to install/use OWLIM. In order to configure OWLIM for best performance you need to read the documentation and/or consult Ontotext.
Without installing Sesame
This means to use only the content that comes with the OWLIM archive.
Actually when I first downloaded OWLIM I started searching for something like "start-server", but (from the OWLIM archive) there is no such thing. You can only use Sesame and OWLIM as libraries, not as a server waiting on a specific port. This is because OWLIM comes with some of the Sesame libaries, but not all. This on the other hand keeps the the OWLIM package size small - only 4MB. Also you may want a different version of Sesame.
You can use the "example.cmd" in the "getting-started" folder. This way by using various configuration files you can load ontologies, set queries to execute and do this without writing a single line of Java code. This use of OWLIM as a library is helpful when you would like to complete some task and release the memory.
Installing OWLIM in Sesame
The benefit of this option is that by having Sesame running as a "server" you actually use Big OWLIM as a "server" in the sense that we are all used to when using a relational regular database. Sesame allows support for external storage and inference engines. This allows you to use the same API (the Sesame API) and use different back-ends(like Big OWLIM for example).
First step is to download Aduna OpenRDF
Sesame 2.2.4. There are also newer versions of Sesame, but in this article version 2.2.4 is recommended.
Let's refer to your Sesame installation folder as "SESAME_INSTALL"
Note that you may need to add the
Lucene indexing jar file to the SESAME_INSTALL\lib folder. For Big OWLIM 3.2.6 for example version Lucene version 2.9.1 is required to be in your classpath.
What we do next is to enable enable Sesame to work through Tomcat as a server.
Next we deploy the Workbench which is the web UI that we would like to use.
1. Copy the following wars:
openrdf-sesame.war
openrdf-workbench.war
from
(Windows): %SESAME_INSTALL%\war
(Linux): $SESAME_INSTALL/war
to your Tomcat webapps folder.
1.1 Start the Tomcat server
(Linux):NOTE: the user which starts the Tomcat server, must be the same as the user which you logged-in to perform the deployment of Big OWLIM.
2. Sesame uses an application folder to store its files:
(Windows): %APPDATA%\Aduna\
(Linux): $HOME/.aduna
From the command prompt execute:
(Windows): echo %APPDATA%\Aduna\
(Linux): echo $HOME/.aduna
to see the full path.
If you have never used Sesame (just downloaded) maybe these directories are still not created!
To configure the Sesame Workbench go to:
(Windows): "%APPDATA%\Aduna\OpenRDF Sesame"
(Linux): $HOME/.aduna/openrdf-sesame
and then check for "templates" folder. You need to create this directory if it does not exist. You must put in it a repository descriptor file for your new repository. You have to use the "bigowlim.ttl" from Big OWLIM installation folder as a template.
3. Then you need to add the owlim-big-3.2.5.jar from Big OWLIM installation folder to:
(Windows): "%TOMCAT_HOME%\webapps\openrdf-sesame\WEB-INF\lib"
(Linux): $TOMCAT_HOME/webapps/openrdf-sesame/WEB-INF/lib
4. Open http://localhost:8080/openrdf-workbench to get to know the Sesame UI workbench.
And here comes the bad surprise - OWLIM won't appear in the “new repository” form in the “Sesame Workbench” UI as available Semantic Repository type!
How to enable OWLIM in Aduna workbench
Summary:
Here will learn more details about how Sesame works and the basic configuration files you would need.
The key moment here is that we are going to use Sesame from another client. This is the console client. We are going to create an OWLIM repository through the console client and then this repository will be usable through the Sesame Web Workbench.
First you need to do the above procedure, but this time you need to copy the bigowlim.ttl in:
(Windows): "%APPDATA%\Aduna\OpenRDF Sesame console\templates"
(Linux): $HOME/.aduna/openrdf-sesame-console/templates
and you need to put owlim-big-3.2.5.jar file in SESAME_INSTALL\ib folder.
We are doing this to make the console client aware of OWLIM.
Now there are two ways to continue to create an OWLIM repository and make it available in the Sesame UI workbench:
1.1 Start the OpenRDF Sesame console with:
(Windows): %SESAME_INSTALL%\bin\console.bat
(Linux): $SESAME_INSTALL/bin/console.sh
This way you connect to the default repository in
(Windows): "%APPDATA%\Aduna\OpenRDF Sesame console\"
(Linux): $HOME/.aduna/openrdf-sesame-console
1.2 Connect to the openrdf-sesame.war that you have loaded in Tomcat by entering this command in the console:
connect http://localhost:8080/openrdf-sesame.
1.3 Now you can create a repository which will use
(Windows): "%APPDATA%\Aduna\OpenRDF Sesame\repositories\"
(Linux): $HOME/.aduna/openrdf-sesame
as this is the repository configured for the openrdf-sesame.war with the following command:
create bigowlim.
Do not add the "ttl" extension.
Alternative path to enable Big OWLIM in Sesame workbench.
2.1 Start the OpenRDF Sesame console with:
(Windows): %SESAME_INSTALL%\bin\console.bat
(Linux): $SESAME_INSTALL/bin/console.sh
This way you connect to the default repository in:
(Windows): "%APPDATA%\Aduna\OpenRDF Sesame console\"
(Linux): $HOME/.aduna/openrdf-sesame-console
2.2 Issue the command:
create bigowlim.
to create the new repository. Do not add the "ttl" extension. So now your new repository is in the console config/storage folder
(Windows): "%APPDATA%\Aduna\OpenRDF Sesame console\repositories\"
(Linux): $HOME/.aduna/openrdf-sesame-console/repositories
,but you need it in the config/storage file
(Windows): "%APPDATA%\Aduna\OpenRDF Sesame\repositories\"
(Linux): $HOME/.aduna/openrdf-sesame/repositories
because this is the one used by the Sesame Workbench.
2.4 Copy your newly created repository from:
(Windows): "%APPDATA%\Aduna\OpenRDF Sesame console\repositories\"
(Linux): $HOME/.aduna/openrdf-sesame-console/repositories
to
(Windows): "%APPDATA%\Aduna\OpenRDF Sesame\repositories\"
(Linux): $HOME/.aduna/openrdf-sesame/repositories
Next start again the workbench http://localhost:8080/openrdf-workbench and your new OWLIM repository should be ready to use (you have already created it in the previous steps).
So the bottom line is that you use the Sesame console with config/storage
(Windows): "%APPDATA%\Aduna\OpenRDF Sesame console\"
(Linux): $HOME/.aduna/openrdf-sesame-console
to create an OWLIM repository and you use
(Windows): "%APPDATA%\Aduna\OpenRDF Sesame\"
(Linux): $HOME/.aduna/openrdf-sesame
config/storage with the Sesame workbench.
Special thanks goes to:
Zdravko Tashev
Danail Kozhuharov