[uf-discuss] Re: A (big) problem with XFN: identity of source and target not findable

Toby A Inkster mail at tobyinkster.co.uk
Tue Mar 18 07:29:37 PST 2008

David Janes wrote:

> FOAF is, quite frankly, an ugly mess. This, based on my experience of
> trying to code to extract useful information out of it rather than just
> an opinion I pulled out of the air. I spent way to many hours coding
> trying to pull info out of FOAF because, well, things seem to be doable
> in lots of different ways.

Don't try to parse it yourself -- use an RDF parser. I recommend Redland 
(a.k.a. librdf) -- it's stable, has bindings for a bunch of different 
language, and feature-wise seems to beat the competition hands down.

As far as relationships go, once the FOAF is parsed, it's just a matter of 
looking for any subjects that have an rdf:type of foaf:Person and one or 
more foaf:knows predicates. Each foaf:knows predicate will be a resource 
(i.e. URI) representing a person that the subject knows. In terms of the 
actual XML representing this kind of information, it's a nightmare to 
parse, but once the RDF parser has reduced it to subject-predicate-object 
triples, it's much easier to consume.

Recently I've been doing quite a bit of work on rationalising data 
discovered from RDF and Microformats and integrating them into a single 

http://examples.tobyinkster.co.uk/hcard (click "cognify")

FOAF and microformats *can* work nicely together.

Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux, up 16:54.]

                              The Semantic Web

More information about the microformats-discuss mailing list