Strabon is a triple store that has been developed with a focus on spatio-temporal query functions. I’ve meant to play around with Strabon for a while, and while at ISWC earlier this week, I decided to finally give it a shot. There are no instructions for setting up Strabon on Mac OS in the user guide, so here’s what I did to get it running:
If you don’t have Homebrew installed yet, open a terminal window and paste the following command to install it:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install maven mercurial postgres postgis
Don’t worry if you have any of those already installed, Homebrew is smart enough to figure that out and will just skip over those.
Next, we’ll initialize a new PostGIS database folder and start PostGIS:
initdb strabon postgres -D strabon
The terminal window will now be “occupied” by PostGIS (press Control+C to shut down PostGIS when you are done), so open a new terminal window (⌘N) to continue there. Next, we’ll create the actual database and enable the PostGIS extensions on it:
createdb -E UTF8 -T template0 template_postgis psql -d template_postgis -c "CREATE EXTENSION postgis;"
Next, we’ll adjust the permissions on that database so that Strabon can make changes later, do some housekeeping, and create another database for the endpoint:
psql -d template_postgis -c "GRANT ALL ON geometry_columns TO PUBLIC;" psql -d template_postgis -c "GRANT ALL ON geography_columns TO PUBLIC;" psql -d template_postgis -c "GRANT ALL ON spatial_ref_sys TO PUBLIC;" psql -d template_postgis -c "VACUUM FULL;" psql -d template_postgis -c "VACUUM FREEZE;" psql -d postgres -c "UPDATE pg_database SET datistemplate='true' WHERE datname='template_postgis';" psql -d postgres -c "UPDATE pg_database SET datallowconn='false' WHERE datname='template_postgis';" createdb endpoint -T template_postgis
That’s all for a PostGres database with spatial extension. Next, we’ll install the temporal extension (you can skip over this part if you are only interested in the spatial functions). We’ll download, build, and install the temporal extension like so:
git clone https://github.com/jeff-davis/PostgreSQL-Temporal.git cd PostgreSQL-Temporal make make install make installcheck psql -d endpoint -c "CREATE EXTENSION temporal;"
Next, we’ll install Tomcat, a servlet container that we’ll use to host Strabon, and modify the Tomcat users. Note that if you already have Tomcat and other servlets are running in it, you should just add a user to the Tomcat configuration and skip this step:
cd ~ curl http://mirror.symnds.com/software/Apache/tomcat/tomcat-8/v8.0.28/bin/apache-tomcat-8.0.28.zip > apache-tomcat-8.0.28.zip unzip apache-tomcat-8.0.28.zip rm apache-tomcat-8.0.28.zip cd apache-tomcat-8.0.28/conf mv tomcat-users.xml tomcat-users-backup.xml curl https://gist.githubusercontent.com/crstn/2daac7483501c8b8beda/raw/26d66cbfaec03cb8b36bedd895c6c4e4955ffe7e/tomcat-users.xml > tomcat-users.xml
And start Tomcat:
cd ../bin sh catalina.sh start
Now we’re done setting up the PostGIS backend and Tomcat, let’s move on to download and compile Strabon:
cd ~ hg clone http://hg.strabon.di.uoa.gr/Strabon/ cd Strabon hg update temporals mvn clean package
Don’t worry if you get an error message here for
Strabon: Executable endpoint. This part tries to automatically deploy the compiled code in Tomcat, we’ll do that manually:
cp endpoint/target/strabon-endpoint-*.war ~/apache-tomcat-8.0.28/webapps/strabonendpoint.war
That’s all. At this point, you should be able to visit http://localhost:8080/strabonendpoint/ in your browser. Before you can load data into Strabon and write stSPARQL queries, there is one last bit of configuration to do. On the web interface, go to Explore/Modify Operations > Configuration and enter the following information (assuming you used the information exactly as provided above):
- Database Name: endpoint
- Username: test
- Password: test
- Port: 5432
- Hostname: localhost
- Database Backend: postgis
Since we didn’t set up the database with a password, you can put in any username and password you want, but the fields can’t be empty (this seems to be a JDBC issue). If Strabon can connect to PostGIS with the configuration parameters provided, it will take you to the query page after you click connect. If there is something wrong with your parameters, nothing happens – you will just stay on the configuration page, but there is no error message (it took me a while to figure this out…). If that happens, take a look at the terminal window running PostGIS and at the Tomcat logs in
~/apache-tomcat-8.0.28/logs/, which should give you an idea of what’s going wrong.