Archive for the ‘Jena’ Category

Setting up MySql on Mac OSX for Jena SDB

Friday, October 17th, 2008

Awhile ago I installed MySQL 5.0.37 on my MacBook Pro using the default mysql settings.

Recently I installed Jena SDB 1.1, following the instructions on the wiki.

As part of the install I created a mysql database, specifying utf8, e.g.

mysql> create database sdb-index character set utf8 ;

and set up a store description (named sdb-index.ttl) based on the SDB example, changing it to use mysql and the “layout2/index” layout.

The create command worked fine
SDBROOT > bin/sdbconfig –sdb=sdb-index.ttl –create

but when I ran the testsuite
SDBROOT > bin/sdbtest –sdb=sdb-index.ttl testing/manifest-sdb.ttl

I got the following error in the Unicode-5 test.

Checking out the SDB notes for Mysql it seemed likely that the problem was related to the msyql default character set.

To see what was currently set I ran the “show variables” command below

mysql> show variables like ‘character%’;
+————————–+————————————————————+
| Variable_name | Value |
+————————–+————————————————————+
| character_set_client | latin1 |
| character_set_connection | latin1 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | latin1 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/local/mysql-5.0.37-osx10.4-i686/share/mysql/charsets/ |
+————————–+————————————————————+

The SDB notes for Mysql recommends setting default-character-set=utf8. The Mysql documentation seemed to favour setting character-set-server=utf8 and collation-server=utf8_general_ci.

To make the changes I needed to create a config file with the changed settings that mysql reads on startup.

To do this I copied the example config file for small installations to /etc/my.cnf.

cp /usr/local/mysql-5.0.37-osx10.4-i686/support-files/my-small.cnf /etc/my.cnf

In the [mysqld] section of my.cnf I added the lines:
# utf8
init-connect=’SET NAMES utf8′
character-set-server=utf8
collation-server=utf8_general_ci

After restarting mysql the “show variables” command showed the following utf8 updates.
mysql> show variables like ‘character%’;
+————————–+————————————————————+
| Variable_name | Value |
+————————–+————————————————————+
| character_set_client | latin1 |
| character_set_connection | latin1 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | latin1 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/local/mysql-5.0.37-osx10.4-i686/share/mysql/charsets/ |
+————————–+————————————————————+

When I tried it again the SDB testsuite ran without errors.

SDBROOT > bin/sdbtest –sdb=sdb-index.ttl testing/manifest-sdb.ttl

A Semantic Web Architecture for a Rails Hosted Environment

Saturday, October 20th, 2007

Last week-end I installed ActiveRDF on my Mac OS X Powerbook, together with the Sparql, RDFLite and Redland adapters. Ideally I am working towards setting up an environment that allows me to build RESTful Semantic Web Applications that support reasoning over RDF data and implement a SPARQL query end point. Support for OpenID authentication, integrated with FOAF, is also at the top of the list.

On the Powerbook I could also install the ActiverRDF adapters for Sesame and Jena to give me the functionality that I am after but that only works in my development environment. Sesame and Jena are Java based. When it comes to deploying an application onto the web my options are currently more limited. 3kbo is deployed into hosted environment which supports PHP, Python, Ruby and Ruby On Rails and PERL, but no Java. (There is C/C++, limited to my local user account.)

Currently there are two PHP SPARQL implementations, ARC and RAP. RAP also provides a reasoning engine InfModel, with support for owl:sameAs and owl:inverseOf.

So at this stage the architecture that is emerging is an ActiveRDF RESTful Ruby On Rails application that uses RAP as the triple store, SPARQL query engine and reasoning engine. To integrate Rails with PHP I am planning to implement a RESTful PHP interface that acts as a facade to RAP.