Installing SwiftOWLIM on MacOSX

I’m sure there are other guides out there, but his is how I did it, and works for me.

Install tomcat

Use macports to install tomcat6

sudo port install tomcat6

This puts tomcat in /opt/local/share/java/tomcat6/

The tomcatctl script can be used to start and stop tomcat.

sudo tomcatctl start
sudo tomcatctl stop
sudo tomcatctl restart

We’ll also be editing tomcatctl to add some specifics for our sesame install.

Install Sesame

  1. Download the sesame tar and unwrap it somewhere convenient.
  2. Drop the .war files from the war/ directory into the tomcat6/webapps/ directory.
  3. Restart tomcat
  4. go to http://localhost:8080/openrdf-sesame
  5. You’ll likely get an error beacuse sesame is tryin to write some directories and log files to a protected area of the system. Therefore you can do this:
    cd ~
    mkdir Aduna
    chmod 777 Aduna
  6. Then add this Java opt to your tomcatctl script. You may also want to change the maximum memory tomcat can use.
    JAVA_OPTS='-Dinfo.aduna.platform.appdata.basedir=/Users/myid/Aduna/'
    JAVA_OPTS="$JAVA_OPTS -Xmx1024m"

Install SwiftOWLIM

  1. Download the SwiftOWLIM distribution.
  2. Follow the instructions in the SwiftOWLIM documentation for a step by step vanilla install.
    (I also copyed {swiftowlim_dir}/lubm/ontology/owl.rdfs to /Users/myid/Aduna/ontology/ but not sure I needed to.)

All Done: hopefully…. now to load some data…

Load Data

Now, I’m sure there are better ways… but…

This script (run using sudo) finds all the files in a given directory that are .nt (ntriples) files.

#!/bin/bash
# script to load data to a local swiftowlim instance.

LOG=load_mydata_swiftowlim.log

for file in `find $1 -name "*.nt"`
do
    ( time  ./loadFileSwiftOwlim.sc $file ) 2>&1 | tee -a $LOG
done

Which calls this expect script to use the sesame console to load the files into the repository.

#!/usr/bin/expect
# script to load data to a local swiftowlim instance.

puts "\n#### Sending $argv"
spawn /opt/local/share/openrdf-sesame-2.3.3/bin/console.sh 

expect "> "
send "connect http://localhost:8080/openrdf-sesame.\r"

expect "> "
send "open mystore.\r"

expect "mystore> "
send "load $argv.\r"

expect "mystore> "
puts "\nLoaded $argv"