Summer of FOAF

This is turning out to be a very interesting summer – even if the weather here in Denmark doesn’t really make it feel like it’s actually summer.

In June I was in Madrid for the Image Description Workshop organised by SWAD-Europe, in two weeks time I’ll be at the SWAD-E workshop on Metadata for a multilingual world, held locally in Copenhagen, just today a community FOAF Camp in Twente in August was announced, and then of course there’s FOAFcon, the 1st Workshop on Friend of a Friend, Social Networking and the Semantic Web in Galway in September, also by SWAD-E.

Phew.

It’s a good thing that this coincides with a favourable tax return…

(Post title credit goes to danbri in #rdfig.)

Concise Bounded Resource Descriptions in Redland/MySQL

While I’m not sure about the merits of the entire URIQA proposal by Patrick Stickler, it does introduce the very nice concept of CBD‘s.

The concept is similar to — actually a superset of — FOAF’s notion of minimally identifying set of properties, the set of properties for a person that is needed to identify, display and get more information about the person, usually including a name (or nickname), at least one inverse functional property and a link, rdfs:seeAlso.

For this reason, and a few others, I decided to implement this in Redland and the Redland/MySQL storage engine as a method for the Model “class”, librdf_model_cbd_as_stream. Since I wanted to leave it up to each storage implementation how to implement it, it turned out to require quite a few source file changes, but I will be handing them over to Dave Beckett for inclusion in the next version of Redland if he sees it fit.

The definition of CBD is recursive, as for each bnode object the statements where it appears as a subject must be included in the result and so on, but implementing infinite recursive queries in SQL is impossible. To overcome this issue, I decided to go with the following algorithm (node is the input resource for which a CBD is wanted):

list of nodes = (node)
count of nodes = 1
REPEAT
  last count of nodes = count of nodes
  list of nodes = SQL(bnodes objects of statements with subject in list of nodes) + node
  count of nodes = COUNT(list of nodes)
UNTIL count of nodes = last count of nodes
RETURN statements with subject in list of nodes

The SQL generated for the query for bnode objects looks like this (operating on the most recent Redland/MySQL storage engine database schema):

select distinct ID
from Statements join Bnodes on Object=ID
where Subject=7972813756443468730 or Subject=10313337636846108089

While the algorithm works, and doesn’t put too much strain on the connection between the client and server, it does require at least one extraneous query, since the loop ends when two subsequent queries yield the same result. Hints on improving this will be much appreciated.

Please note that I have left out step 3 of the CBD definition, the reification part. This is mostly due to the reason that I don’t work with reification in my models, but also because I don’t see reification in the RDF sense to be of much use in practical implementations.

Also, in contrast to the CBD definition, this algorithm and implementation allows for CBDs for bnodes, not just URIs.

Linksys WPC54G and Redhat Linux

Just in case someone else runs into the same problems I did — and in case I need it later — here’s what I did when trying to get my laptop with Redhat Linux 9 and a Linksys WPC54G wireless card working together.

First I tried the Linuxant drivers, but luckily they didn’t work — they aren’t free (as in beer). Then I went on to try the NdisWrapper NDIS API implementation, and even though I had to build the tools and modules myself because of a kernel version mismatch, they ended up working perfectly without too much hassle.

To build the tools and install the XP driver (NdisWrapper works by emulating the NDIS API for the non-free Windows drivers):

make install
ndiswrapper -i WPC54G/lsbcmnds.inf

Next up is creating an interface configuration file in /etc/sysconfig/network-scripts/ifcfg-wlan0:

MODE=Managed
ESSID=wifi.mfd-consult.dk
KEY=<26 hex characters for the 128 bit WEP key specific to my AP>
DEVICE=wlan0
ONBOOT=yes
BOOTPROTO=dhcp
USERCTL=no
PEERDNS=no
TYPE=Wireless

Then came the tricky part: The WPC54G is a PCMCIA card, but on my Redhat Linux 9 installation, the networking is set to start up before the PCMCIA interface is initialized. To overcome this problem, I changed the chkconfig parameters for three of the startup scripts (the NFS script failed to work properly if not started after the network):

  • pcmcia: 21 96
  • network: 22 90
  • nfslock: 23 86

After that, I issued the following commands to reset the sequence:

chkconfig pcmcia reset
chkconfig network reset
chkconfig nfslock reset

The only thing missing was to make sure the PCMCIA and NdisWrapper drivers were loaded on startup, by simulating a card insert event — if necessary — and forcing the drivers to load:

rmmod ndiswrapper 2>/dev/null
cardctl status | grep "no card" > /dev/null && cardctl insert
modprobe ndiswrapper

That’s it, running /etc/init.d/network restart should bring up the wireless interface, after which I could turn off the ethernet connection by setting ONBOOT=no in /etc/sysconfig/network-scripts/ifcfg-eth0.

Semantic Comments Feeds from WordPress

As hinted to last week, I now have my WordPress installation output comments as RSS 1.0, both as a blog-wide feed and as a feed per post.

At the core they are just like other feeds, but comments are a little more diverse than posts. There are regular comments, entered in the comment form for each post, and PingBack‘s and TrackBack‘s, both of which are “remote” — a notification of reference from somewhere else.

Each of these three types of comments are different from each other, and need to be handled differently.

Continue reading Semantic Comments Feeds from WordPress

Label Vocabulary in Spanish

The Label vocabulary now also contains labels in Spanish.

{Leandro Mariano López}, the master behind inkelog and the Speaks, Reads and Writes Schema, stepped up to plate last night and sent me a translation of the terms and comments – thanks!

That of course meant that I had to make it possible to navigate between the different language versions, and tweak the content negotiation a bit.

The owl2html XSLT is now up to version 0.2, and a new small tool has seen the light of day: rdf-path.

It’s a simple Perl script with an XPath interface to an RDF/XML document, with a bunch of prefixes and namespaces predeclared. It’s simple to the point of triviality, but does its job well, in this case extracting a list of available languages for an ontology, to automate the generation of HTML pages:

#!/bin/bash
base=http://purl.org/net/vocab`/bin/pwd|sed -e 's/^.*web//'`/
for lang in `rdf-path "/*/*[rdf:type[@rdf:resource='http://www.w3.org/2002/07/owl#Ontology']]/rdfs:comment/@xml:lang" $1.rdf`; do
  owl2html $1.rdf uri $base$1# lang $lang css "http://www.wasab.dk/morten/2004/06/owl2html.css" > $1.$lang.html 
done

Additional translations are of course more than welcome.