For a recent project, we had to install a selection of RDF triple stores on a Mac Mini, which had literally just come out of the box. Since it was a bit of a mission to get everything up and running, I thought I’d better keep track of what I did. Here’s the steps taken to prep the machine and set up 4store – it looks pretty long, but if everything works (if…), it shouldn’t take more than 15 minutes. May the odds be forever in your favour.
Hardware: Apple Mac Mini (running Mac OS X Lion 10.7), out of the box
Install XCode, Command Line Tools, and Java on the Mac:
- Install XCode via the AppStore (if you can only access remotely, use screen sharing)
- The command-line tools are not bundled with Xcode 4.3 by default. Instead, they can be installed optionally using the Components tab of the Downloads preferences panel in Xcode.
- Change the XCode Developer directory (which no longer exists in 4.3) to the new directory:
- sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer/
Install Fink on the Mac to be able to use apt-get etc. (needs XCode + Command line tools)
- Download source tarball, then follow instructions on http://www.finkproject.org/download/srcdist.php (they’re very good!)
- create .profile file and add . /sw/bin/init.sh
Install dependencies using Fink
- List of dependencies on: http://4store.org/trac/wiki/Dependencies
- apt-get doesn’t find the right packages, so you have to use the fink tool to install them manually:
- fink install automake1.11
- fink install autoconf2.6
- fink install glib2-dev
- fink install make
- fink install pcre
- fink install pcre-bin
All other libs seem to be installed already. Then set your .profile file to init fink on startup:
- open ~/.profile file with your text editor of choice:
- . /sw/bin/init.sh
Install 4store
(I mostly followed the instructions here: http://fishdelish.cs.man.ac.uk/2011/installing-4store/)
1) Download and install Raptor
Raptor is an RDF syntax library, provides parsers and serializers.
- (version at the time of writing: http://download.librdf.org/source/raptor2-2.0.7.tar.gz)
- curl -O http://download.librdf.org/source/raptor2-2.0.7.tar.gz
- tar -xzvf raptor2-2.0.7.tar.gz
- cd raptor2-2.0.7
- ./configure && make && sudo make install
2) Download and install Rasqual
Rasqal is a library that handles RDF query languages, e.g. SPARQL, supports all of SPARQL 1.0 and most of 1.1.
- (version at time of writing: http://download.librdf.org/source/rasqal-0.9.29.tar.gz)
- curl -O http://download.librdf.org/source/rasqal-0.9.29.tar.gz
- tar -xzvf rasqal-0.9.29.tar.gz
- cd rasqal-0.9.29
- ./configure –enable-query-languages=”sparql laqrs” && make && sudo make install
Make sure both rasqal and raptor have a .pc file in their directories. If not, you might have forgotten to run configure which should generate the .pc file from .pc.in.
3) Set environment variables so that the 4store install can find raptor2 and rasqal
Set to the directories which contain the raptor2.pc and rasqal.pc files:
- open ~/.profile file with your text editor of choice:
- PKG_CONFIG_PATH=/Users/fishdelish/fishbench/rasqal-0.9.29:/Users/fishdelish/fishbench/raptor2-2.0.7
4) Download 4store tarball (latest version on http://4store.org/download/) and install:
- tar -xvzf 4store-v1.1.4.tar.gz
- cd to the 4store directory
- ./configure –enable-no-prefixes
- Configure should run without error messages, i.e. raptor2 and rasqal are found if they environment variables are set correctly.
- make && sudo make install
Run a series of tests to see whether 4store works:
- make test (or make test-query, make test-httpd
- tests should pass with [PASS], although some of them failed for me and the actual store worked fine
Create a triple store once 4store is installed
http://4store.org/trac/wiki/GettingStarted
1) Setup the DB:
4s-backend-setup testfish
2) And start the DB backend:
4s-backend testfish
(Stop the DB: pkill -f ‘^4s-backend testfish$’ )
3) Import a test file:
(I just used a few triples I copied from from http://www.w3.org/TR/rdf-testcases/#ntriples)
4s-import -v testfish –format ntriples testfish.n3
Important: Import doesn’t work if the httpd is running. Also, make sure there’s no line breaks in the .n3 file.
4) Start http server for SPARQL endpoint and nice HTML frontend for tests:
4s-httpd testfish
(to kill the server, e.g. to import data: killall 4s-httpd)
- http://localhost:8080/test/ (input fields for testing SPARQL queries)
- http://localhost:8080/status/ (status page)
- http://localhost:8000/sparql/ (SPARQL endpoint)
That’s it. You should have a working 4store install and a sample DB now. Please be warned that I can’t guarantee that everything will work as it should if you follow these instructions 🙂
[…] 2 of the “Things PhD students do on a saturday night” series: Having successfully installed 4store on our brand new Mac Mini running OSX 10.7 (Lion), I know tackle the next candidate for our triple-store-o-rama: Virtuoso […]
[…] now for the third in a row of triple-store installations. This time it’s Sesame, an open source datastore for RDF and relational data. Thankfully, due […]