Archive for July 7th, 2009

Barcamp 09

Tuesday, July 7th, 2009

I went to Barcamp London 09 this year, it was the first one I have been to. Barcamp was a little less targetted than I am used to but I still met some interesting people and had some fun. I gave a talk on “The Web of Data and Personal Information”, my slides were written in slidy, and are valid XHTML. Am thinking I am going to stop using M$ Powerpoint and am going to embrace open standards when writing slides from this point onwards… W3C++;

Ah, good work tobyink …

Tuesday, July 7th, 2009

I have just read tobyink’s article on how one could cater for 3rd parties wanting to contribute triples to an RDF file you own. Firstly, great stuff, this follows on from some things I have been thinking about recently, which include, that of how best to inform RDF documents of when they have been mentioned elsewhere.

tobyink and various other people have been talking about such things recently you can find them of the irc://irc.freenode.net/swig chatlogs here (thanks phenny…). I first started thinking about this when I read this email and when I was thinking about how technologies like linkback, inc. trackback and pingback changed blogging for the better.

I like tobyink’s approach, but I think I would prefer to use a SPARQL endpoint for updating any RDF I own. And I would definitely protected this behind some sort of security mechanism, from .htaccess rules to techniques such as OAuth or FOAF+SSL or similar, I would stress that I would be very careful who I allowed access to any data I owned.

I guess I come from a world of triple-stores, and do enjoy being able to SPARQL quads efficiently as apposed to coming to this from a linked data standpoint. In JXT the SPARQL Endpoint implements a HTTP DELETE and HTTP PUT to allow for graph’s to be updated in the quad store. Give the following SPARQL endpoint :

http://example.com/sparql

We would delete a graph like so :

'curl -X DELETE http://example.com/sparql/http://mmt.me.uk/foaf.rdf'

and similarly for adding triples we use PUT to add triples into the quad store, in the form of a string of RDF and its graph URI. There is work underway to get a SPARUL implementation working so that we can update individual triples in future quad stores.

I was more envisaging the mechanism that would pingback to my FOAF file (or any RDF document I own) as soon as it has been used elsewhere. So for example if Alice befriends Bob, in the form of I know this chap with some URI, then the Alice should somehow ping Bob, like bloggers do, with a simple request, something like what tobyink describes in the section 2.2 POST of the aforementioned post. I would definately not let other people add triples to my FOAF file, and would rather have the triple which mentioned my FOAF URI and have the graph URI where the statement was made, so that I can decide on any future action I may take. If Alice doesn’t know Bob’s FOAF URI, but knows another identifier for him, they could always use a service like the QDOS FOAF search to find a URI for Bob before befriending him.

So something like 2.2 sounds good, but I would prefer if they simply sent me the triple(s) authored that mentioned me, along with the graph URI, than triples they would like to insert into one of my graphs.

I understand how the approach tobyink mentions could be beneficial in a linked data world, and do kind of like the idea of have some sort of “RDF scrap book” which my FOAF friends could write to, but I still think I prefer to not let anyone but me author triples on my domain. If I where to implement an “RDF scrap book” which my foaf:friends could add triples to, whatever they may be ? dbtune scrobbles, their dbpedia interests, I would much rather that information be hosted on one of their sites, which in turn I would store in my quad store for future SPARQL goodness.

Finally, tobyink, why did you decide to use charset="us-ascii" ?

Timemachine to a Linux Box

Tuesday, July 7th, 2009

By default TimeMachine on Mac OSX is configured to run through the Apple Filing Protocol only.

At home I run a backup server for Time Machine on one of my Linux boxes, I did this by enabling the following feature on the machine which I have configured to be backed up.

defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1

This in turn allows for unsupported network volumes to be used as backup volumes.

Below are some other Apple related preferences I have configured on my macbook:

defaults write com.apple.dock persistent-others -array-add '{ "tile-data" = { "list-type" = 1; }; "tile-type" = "recents-tile"; }'

defaults write com.apple.terminal FocusFollowsMouse -string YES

defaults write com.apple.Safari IncludeDebugMenu 1

defaults write com.apple.finder AppleShowAllFiles Yes (ALL FILES IN FINDER)

Configuring Yum to only install 64bit binaries

Tuesday, July 7th, 2009

This post follows the fact that I noticed that some of my 64bit development machines had 32bit binaries installed on them. It should be noted that this is not fatal in any sense of the word, but it is simply not ideal.

Here I will present how you can first identify what your machine’s architecture is, and then I will show how you can b
oth remove existing 32bit binaries, and how you can configure YUM so that it will only ev
er install 64bit software.

This blog post is only relevant if your linux box uses YUM as a package manager.

Identifying your machine’s architecture

In order to find out what your machine’s architecture is you need to execute the following command from your command line:

uname -a

If the result looks something like below, it means you have a 64bit machine, where the x86_64 implies the machine is 64bit.
If it had any of i386, i586, or i686, it would imply that the machine was a 32bit one.

Linux foo.bar.com 2.6.18-92.el5 #1 SMP Tue Jun 10 18:51:06 EDT 2008 x86_64 x86_64 x86_64 GNU/Linux

Remove all 32bit binaries :

yum erase *.i386
yum erase *.i586
yum erase *.i686

Tell YUM to never install 32bit binaries again:

You need to add the below line to your yum.conf file (usually found in /etc/) :

exclude=*.i386 *.i586 *.i686

At this point, all future software install via the YUM package manager will be optimised for your machine’s architecture.

ld: duplicate symbol _g_bit_nth_lsf Mac OSX Leopard/Darwin

Tuesday, July 7th, 2009

I have had some problems installing software from source on my Max OS X Leopard machine. I should thank Martin Szomszor for his help on getting this working, but after some time faffing we finally got it sorted out.

I found that I was having problems making software on Leopard, which I could build fine on my linux (fedora) machines. The error I was getting was:

ld: duplicate symbol _g_bit_nth_lsf in foo.o and bar.o

I am running Leopard 10.5.3. I was using glib2, installed via Fink, version number: 2.12.0-103. After spending lots of time googling I found the following article to be of the most use, “Wireshark with Macports”, where Anders Brownworth pointed out that the error was due to a “extern inline bug in glib/gutils.h which is easily fixed“.

So to fix this:

  • I located gutils.h, which I found here:

    /sw/include/glib-2.0/glib/gutils.h
  • I then replaced these lines:

    #ifdef G_IMPLEMENT_INLINES

    # define G_INLINE_FUNC

    # undef G_CAN_INLINE

    #elif defined (__GNUC__)

    # define G_INLINE_FUNC extern inline

    #elif defined (G_CAN_INLINE)

  • With this:

    #ifdef G_IMPLEMENT_INLINES

    # define G_INLINE_FUNC

    # undef G_CAN_INLINE

    #elif defined (__APPLE__)

    # define G_INLINE_FUNC static inline

    #elif defined (__GNUC__)

    # define G_INLINE_FUNC extern inline

    #elif defined (G_CAN_INLINE)

  • By adding these two middle lines:

    #elif defined (__APPLE__)

    # define G_INLINE_FUNC static inline
  • The start of the fragment of code was at line number 96 in my gutils.h file

Here is a link to my edited and working gutils.h file.

Note 1: I would make sure I get a copy of my original gutils.h file, as this may come in handy

Note 2: There is a patch which one could apply to make the same changes which I have just described here. This patch follows this ticket. I didn’t know what to do with the patch file, so I ended up editing the file by hand:). I am guessing that is something todo with macports, mmm, nevermind, its working now.

duplicate dylib libiconv.2.dylib

Tuesday, July 7th, 2009

When building from source on Mac OSX, I have regularly come across the problem whereby the compiler complains about duplicate dylibs.

duplicate dylib libiconv.2.dylib

This is due to my use of the Fink and Darwin packages to install various bits I need for OSX development.

I recently noticed that many configure scripts cater for the user to select which dylib they would like to include. So I figured that my problem of duplicate iconv’s can be overcome by looking for options like :

--with-iconv=

So look out for similar parameters in configure scripts

./configure --with-iconv=/opt/local/..

So, why do I not just remove all but one instance of iconv? Well, Leopard ships with an old version of iconv, and I require recent versions for my development work.

3store Installation Guide

Tuesday, July 7th, 2009

I have put together these notes on installing 3Store on linux boxes. I should thank Dave Dupplaw for his notes on installation, this blog is also a good point of call.

Pre-Install

Before you install 3Store you must ensure that you have raptor and rasqal libraries installed. You should install these from source! This is not a necessity but what we have found
it best after a number of installations.

Rasqal and Raptor are both libraries produced by Redland, and can be downloaded from their site: http://librdf.org.

Unpack each tar ball, configure, make, and make install each one.

Rasqal and Raptor both install their package files into /usr/local/lib/pkgconfigg but 3Store does not expect the files there. To fix this set the environment variable PKG_CONFIG_PATH to point to that directory. If that directory does not exist, locate rascal.pc to find its location and place that path in your PKG_CONFIG_PATH environment variable. For example, on a 64 bit architecture, these files should be found in /usr/local/lib64/pkgconfig.

In [t]csh this is:

setenv PKG_CONFIG_PATH /usr/local/lib/pkgconfig/

In bash this is:

export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/

It should be noted that 3store also requires glib, as well as the Berkeley DB libraries. You should be able to install these via your package manager, i.e. apt-get, yum, or through emerge.

3Store Installation

Installation is from source, so unpack the source and enter the 3store directory.

Use ./configure to configure the compilation scripts.

Make the scripts with the make command. Install 3Store with make install (you will have to be root to do this).

Troubleshooting

Package rascal.pc does not exist

If you get this error:

checking for RASQAL… Package rasqal was not found in the pkg-config
search path.

Perhaps you should add the directory containing rasqal.pc to the

PKG_CONFIG_PATH environment variable.

Other issue:

No package ‘rasqal’ found configure: error: Package requirements (rasqal >= 0.9.11) were not met:

Then check that you have correctly installed rascal and set up the PKG_CONFIG_PATH environment variable.

Library libidn.so does not exist

If you get this error:

gcc: /usr/lib/libidn.so: No such file or directory

Then locate libidn and make a soft link to the necessary library.
For example, if libidn.so.11 exists, link it to the filename libidn.so:

ln -s /usr/lib/libidn.so.11 /usr/lib/libidn.so

The make script will then be able to find the file.

glibc 386 libraries missing RedHat

If you are working on x86 platform, you may still require the i386 libraries to do
the compilation. This error may be typified by the following error message during compilation:

/usr/bin/ld: crti.o: No such file: No such file or directory

It is easiest if you are signed up to the RedHat network to do update your glibc libraries to the latest versions:

up2date --showall # (optional to find latest versions)

up2date --get glibc-devel-2.3.4-2.19.i386

rpm -Uvh /var/spool/up2date/glibc-devel-2.3.4-2.19.i386.rpm

Alternatively, you can check your original discs for the i386 glibc-devel library rpm. RedHat Enterprise Linux comes with the i386 versions of the libraries on disc 3. Install them using the last command given above.

Wrong Architecture/File Format

There is a bug in the RedHat Enterprise installer that means even if you tell if not to install MySQL it will do. Unfortunately, in either case it will install the 32 bit version, which causes an error similar to this:

/usr/local/lib/librasqal.so: could not read symbols: File in wrong format

If this is the case, you need to ensure that the compilation knows where your 64-bit MySQL installation is. If you do not have one you will have to download an appropriate version (or build from source).

The installation works by calling the mysql-config script which tells the compilation how to compile-in the MySQL libraries. To make it work, ensure that the script in your path is the correct version:

In [t]csh:

setenv PATH /usr/local/mysql/bin:${PATH}

Or in bash:

export PATH=/usr/local/mysql/bin:$PATH

Libraries not found

When you run a 3store tool (e.g. ts-query) you get a message similar to the following:

ts-query: error while loading shared libraries: lib3store.so.0: cannot open shared object file: No such file or directory

This means the 3Store tool cannot find the 3Store libraries. You can locate lib3store to find the location of the libraries (which by default are put into /usr/local/lib) and add this to your LD_LIBRARY_PATH:

In [t]csh:

setenv LD_LIBRARY_PATH /usr/local/lib

Or in bash:

export LD_LIBRARY_PATH=/usr/local/lib

Better still, you should add this path to your ld configuration so that it will always
work. To do this create a new file in /etc/ld.so.conf.d/ called 3store.conf. Put /usr/local/lib on its own at the top of the file. Save it, and run /sbin/ldconfig, to update your configuration. The tools should now be able to find the libraries, and will be able to for anyone who uses the machine.

This is fixed in another manner if you are using Gentoo Linux. There is no /etc/ld.so.conf.d/ directory. In gentoo you should add the path to the
LDPATH environment variable (not LD_LIBRARY_PATH!), this can be done like so:

Edit /etc/env.d/00basic

And add the LIBDIR to the line:

LDPATH="/usr/local/lib"

On a 64 bit architecture it may look like so:

LDPATH="/usr/local/lib:/usr/local/lib64"

Then make sure you run the env-update script in gentoo.

Berkeley DB library not found

So if you get the following error during the configure process.

“configure: error: Cannot find Berkeley DB library version 4″

You either don’t have the Berkeley DB libraries installed, or there are not where 3store expects them to be.

If you don’t have it installed, grab it and cd to the directory, then:

cd build_unix
../dist/configure

make
sudo make install

So now, if you are in the position where you have Berkeley DB 4 installed, but you are still getting the above error then 3Store is assuming it is somewhere which it isn’t! So now we have to make a soft link from where the db.h file actually resides, and where 3store thinks it should be.

su
mkdir /usr/include/db4
cd /usr/include/db4
ln -s /usr/local/BerkeleyDB.4.5/include/db.h
./configure LDFLAGS=-L/usr/local/BerkeleyDB.4.5/lib

If you are using a version 4.5 or above of Berkeley DB, you make have to edit the configure script as follows:

Edit line 21151, which looks like so:

for ac_lib in db-4.4 db-4.3 db-4.2 db-4.1 db; do

and add your version of db to it, like so:

for ac_lib in db-4.5 db-4.4 db-4.3 db-4.2 db-4.1 db; do

And now you should be able to make and make install.

Problems during compilation “make”

If you had problems with the configure script and Berkeley DB, then you may have to edit some on the source code in the src directory. In order to get it to work I have had to:

Change the source code and which had #include <db.h> to #include<PATHTO/db.h>

This had to be done in the following files:

Datatypes.h

Bulkimport.c

Problems with ts-util!

If you are having problems when running the command:

ts-util optimise "KBNAME"

You will have to edit line number 164 in ts-util.c in the src directory, and recompile.

Line 164 is missing an “AND”, and should look like so

ts_mysql_query(c->db, "DELETE FROM "T_S" WHERE NOT EXISTS (SELECT * FROM "T_T" WHERE model=hash) AND NOT EXISTS (SELECT * FROM "T_T" WHERE subject=hash) AND NOT EXISTS (SELECT * FROM "T_T" WHERE predicate=hash) AND NOT EXISTS (SELECT * FROM "T_T" WHERE object=hash)");