Using XFN with FOAF

So, before I just start splattering your screen with Acronyms, lets define a few, eh?

  • FOAF: Friend of a Friend – An XML Schema containing information about you, as well as a small bit of information, or links to information, about the people you know.
  • XFN: XHTML Friends Network – A Microformat generally used in links to other sites or pages to identify that person’s relevance to you, such as "contact", "friend", "acquaintance", "met", "muse" and etcetera.

Generally, you wouldn’t combine an XHTML standard with a different XML Schema.  But, I’ve personally decided the best way to use the two together.

First, declare the XHTML namespace in your FOAF file.  This is with all the others, and generally looks like xmlns:xhtml="http://www.w3.org/1999/xhtml".

Next, go to where you have included your contacts.  For each <foaf:knows> tag, add inside of it xhtml:rel="contact" or similar, following the XFN standards.

And voila!  You now have XFN and FOAF working together.  Of course, the only problem is that nobody quite supports this standard yet, but it will hopefully come in the future.

My Guidelines for using XFN in FOAF is that it should be used when referencing another <foaf:Person>.  In fact, if you want, you should probably even add xhtml:rel="me" to your own <foaf:Person>.

  • Willscrlt
    This seems like sort of a "Well, DUH! yeah. Of course!" So why aren't people doing this? (I don't mean to imply that your idea is a bad or dumb one, quite the opposite. It's so logical that it should be self-evident.)


    I'm going to start using it in my own links. Thanks for putting it all together in a logical manner. :-)
blog comments powered by Disqus