Configuring OWLIM-SE for ST

This guide is outdated with respect to latest OWLIM versions and to capabilities of ST for interacting with OWLIM/GraphDB. We

A more recent and simple article which benefits from improvements brought to ST0.10 and VB2.2.1 is available here: Using GraphDB (formerly OWLIM) with Semantic Turkey

We keep this page open as it still contains useful information such as using custom rulesets, however the page above is the official reference for (easily) accessing an OWLIM/GraphDB repository.

This guide is meant to remain as “static” as possible, along different configuration scenarios embracing data and vocabulary updates, changes in the various installation settings etc. For this reason, reference is made to an external wiki page on the google project site of Semantic Turkey:

https://code.google.com/p/agrovoc-cs-workbench/wiki/VB2_Installation (note: if you want to perform a quick test-drive of ST, you don't need to follow this)

In the above wiki page, several configuration parameters have been defined, belonging to the different components which are part of VB2.0. The user may refer to a particular installation configuration presented there, as a series of ATTRIBUTE-VALUE pairs, where ATTRIBUTE is one of the configuration parameters required by the installation and VALUE represents the specific value which will be assigned for that particular configuration. This installation guide will use ATTRIBUTE names which are consistent with those present in the wiki.

The ATTRIBUTE will be explicitly mentioned by wrapping it between {} brackets.

E.g. {OWLIM.TOTAL_CACHE_MEMORY}

OWLIM Setup  

By using the content of {OWLIM.VERSION}, follow the instructions online at: http://owlim.ontotext.com/display/OWLIMv54/OWLIM-SE+Installation#OWLIM-SEInstallation-Easyinstall only for deploying the OWLIM .war files into Tomcat. We will ot use OWLIM for a first inst

and stop before the instruction starting with this text:
“Fill in the fields as required…”   
follow now the specific instructions here below for creating a repository

  • If you followed the above instructions, you should now be sitting in front of the sesame2 workbench web application, with the “New Repository” Form on the screen. There should be two text fields to be filled up, fill:
    • ID: {OWLIM.REPOSITORY_ID}
    • Title: whatever you like, the title is not important, it is just a comment field
    • After filling the above parameters and clicking on the next button, you will get to a second page with lot more parameters. Fill all of them with all the configuration parameters starting with the “OWLIM.” prefix, from the following configuration sections:
      • {OWLIM General}
      • {OWLIM Repository Configuration}
      • {Data Configuration}         

Also, other than all the “OWLIM.” prefixed properties, consider the {DATA.BASEURL} to be used in the “Base URL” field of the configuration.

In particular, be sure to check that all the parameters starting with {OWLIM. in the interested configurations have found a match in the entries (with a similar name) in the form, and leave untouched all those form fields which are not specified in the configurations.   
Confirm after all the fields have been filled up, by clicking the “create” button.

  • Now, the just-created repository should be already selected in the Sesame2 workbench. However, to be certain of that, click, from the menu on the left, on the “Repositories” section and then select the repository you just created.
  • Now it’s time to import the the SKOS Data file for the Concept Scheme you are using. To do so:
    • Click on the “Modify\Add” option on the left menu. You should see a form called “Add RDF”.
    • You may fill the Base URI field with the ({DATA.BASEURL}) value. However, if you import an NT file (which we recommend), there is no need to fill this field (the NT format already contains full URIs and no unprefixed local name). In any case, always uncheck the "use base URI as context identifier" and do not specify any value for "Context". Leave the other choices untouched.
    • Select with the radio button the option: “Select the file containing the RDF data you wish to upload” and then, in the “RDF Data File” field, choose the one specified in {DATA.VERSION} from your file system.
    • Then Click Upload

 2.   Add the new project to Semantic Turkey

This will be defined in a new version of the guide. If you have installed SemanticTurkeyData in the “Semantic Turkey Server Setup”, it will come with an already configured project for your first install.

 

Create a new project   with OWLIM

Follow the steps in Configuring OWLIM-SE for ST (section Create new project), until "Creating a plain Sesame2 project (no OWLIM)" excluded. Then follows these steps for connecting to the OWLIM instance.

Creating an OWLIM project

  • Select remote access option and it will prompt to input following parameters:
    • repositoryId
      • ID of the sesame2 repository to be accessed  (e.g. {OWLIM.REPOSITORY_ID})
      • This should match the ID value used in repository (Repository ID value while creating new repository in OWLIM)
    • serverURL
    • Username
      • Identifier for the user connecting to the rdf repository
      • If not applicable, add “test” as this is mandatory field
    • Password
      • Password for the user connecting to the rdf repository
      • If not applicable, add “test” as this is mandatory field
    • Click on [?] icon to view each field information.
    • It is assumed that Repository Server is already running and new repository has been created.
    • Click [Add] button to create the project.
    • Newly created project will be added to the list.

How to use a custom ruleset

OWLIM allows for loading custom rulesets (used for inferencing) instead of the precompiled ones bundled with the OWLIM distribution. .

Custom rulesets may be easily loaded by specifying the full path to their file location as a value for the OWLIM configuration parameter: “ruleset” (instead of the code name of the standard ones).

However, while this is pretty straightforward when specifying an OWLIM configuration programmatically, doing this through the Sesame2 workbench is not trivial, as the workbench only allows for pre-defined values (associated to the standard preloaded ruleset).

Here follows the instructions for changing ruleset in Sesame2 workbench

The instructions have been compiled by following the example reported in this post on the OWLIM forum:

http://answers.ontotext.com/questions/996/archive-setting-ruleset-owlim-repository-using-sesame-workbench

  • Create a new repository, but do not initialize it! (don't access it, or at least don't put data into it). When selecting the parameters for the repository, select the “Empty” ruleset.
  • Now, select the “SYSTEM” repository, and perform the following SPARQL query:

PREFIX sys:  <http://www.openrdf.org/config/repository#>     
PREFIX sail: <http://www.openrdf.org/config/repository/sail#>
PREFIX onto: <http://www.ontotext.com/trree/owlim#>
SELECT ?g ?sail ?param ?value
WHERE {
    GRAPH ?g { ?rep sys:repositoryID ?id . }
    GRAPH ?g { ?rep sys:repositoryImpl ?impl . }
    GRAPH ?g { ?impl sys:repositoryType ?type . }
    GRAPH ?g { ?impl sail:sailImpl ?sail . }
    GRAPH ?g { ?sail ?param ?value . }
    FILTER( ?id = "{OWLIM.REPOSITORY_ID}" ) .
    FILTER( ?param = onto:ruleset ) .
}


to check that the parameter is, as expected, the “empty” value that has been selected when creating the repository. Note the use of the OWLIM.REPOSITORY_ID, which you must obviously replace with your OWLIM repository ID.

  • Now, perform the following SPARQL update:

PREFIX sys:  <http://www.openrdf.org/config/repository#>
PREFIX sail: <http://www.openrdf.org/config/repository/sail#>
PREFIX onto: <http://www.ontotext.com/trree/owlim#>
DELETE { GRAPH ?g {?sail ?param ?old_value } }
INSERT { GRAPH ?g {?sail ?param ?new_value } }
WHERE {
   GRAPH ?g { ?rep sys:repositoryID ?id . }
   GRAPH ?g { ?rep sys:repositoryImpl ?impl . }
   GRAPH ?g { ?impl sys:repositoryType ?type . }
   GRAPH ?g { ?impl sail:sailImpl ?sail . }
   GRAPH ?g { ?sail ?param ?old_value . }
   FILTER( ?id = "{OWLIM.REPOSITORY_ID}" ) .
   FILTER( ?param = onto:ruleset ) .
   BIND( "<directorypathtoyourcustompiefile>/builtin_owl2-rl-fixed.pie" AS ?new_value ) .
}

by changing the parameters of the last and the third to last rows in the following way:

  • Again, replace the value associated to ?id with the id of the repo you want to modify
  • replace the value on the BIND, with the absolute path of a custom rule set (it is possible to omit the ending .pie extension, it will be attached by default)
  • You may re-perfom the initial query to check that the substitution for the variable ?value is now the path to the custom ruleset that you defined.
  • Close and restart tomcat, as OWLIM needs to compile the new ruleset
  • Now the repository is ready for receiving data, which will be analysed and expanded into new triples through inference, by exploiting the new ruleset.