FOAF Blogrolls

I came across a posting from Matthew Haughey this morning which contained this comment:

I think developers forget that people won’t or can’t use any technology until it’s got an easy-to-use interface. I know it’s important at some level, but I couldn’t care less about say, which RDF vocabulary FOAF will use, I only care how easy it will be to add FOAF stuff to my site (best is having something do it automatically

The posting was noting that blo.gs has just added XFN support.
So taking Matt’s comments to heart I whipped up a simple interface that uses FOAF to generate a blogroll.


Basically I’ve just hacked up a JSP page that does the following:

  • Loads a FOAF document, specified using a foaf parameter in the query string, then
  • Finds all foaf:weblog properties in the resulting graph, and
  • Works out the name of the thing with the weblog (using, in order: foaf:name, foaf:nick, dc:title, “unknown”, and
  • Generates a series of div elements each containing a link to that weblog using that name

I’ve added foaf:weblog properties to some of the people that I know so you can see the result. The URL is:

http://www.ldodds.com/micro-util/blogroll.jsp?foaf=http://www.ldodds.com/ldodds-knows.rdf

By default the JSP generates HTML, but if you add type=js to the querystring it generates Javascript instead. So you can include it in your blog either directly (with an include), or using a script tag.
Here’s the same thing except as Javascript:

http://www.ldodds.com/micro-util/blogroll.jsp?foaf=http://www.ldodds.com/ldodds-knows.rdf&type=js

And here’s how you’d incorporate it into your blog:

<script language="javascript" src="http://www.ldodds.com/micro-util/blogroll.jsp?foaf=http://www.ldodds.com/ldodds-knows.rdf&type=js"/>

The JSP page doesn’t do some fairly obvious things like sorting based on names, using foaf:homepage if there’s no weblog, or adding XFN attributes based on the type of relationship, but it’s easy enough to add. This is just a quick lunch hour hack. Drop a comment to encourage me to extend it!
There are possibly better ways to model blogrolls in FOAF, I’m certainly not suggesting that this is the perfect solution. Hopefully though it goes some way to wards meeting Matt’s criteria for easy integration and provide some simple returns on maintaining a FOAF description.