hFoaf (Hypertext Friend of a Friend) has recently been updated to version 0.3, this one has been an important update because basically the XSLT needed a lot of tidying, refining, which also gave me an opportunity to add a few more actions such as being able to extract things that a user has made or authored, and a more complete expansion of XFN rel="me".
What may be a good idea now would be to give you some clues on how to build hFoaf in a quick and dirty howto, but first... hFoaf is not a microformat or a proposed one, although it does rely heavily on microformats to determine the output of a FOAF RDF document.
The first step is to create a hcard, then add an id="" to the hcard and a class="url" with the XFN relationship rel="me"
Example:
- <div class="vcard" id="weborganics">
- <p class="fn n">
- <span class="given-name">Martin</span>
- <span class="family-name">McEvoy</span>
- </p>
- <p><img alt="weborganics" src="http://weborganics.co.uk/images/me.jpg" class="photo"/></p>
- <p>Contact: <a class="email" href="mailto:weborganics@googlemail.com"
- id="sha1:3cc1a719a5023e9087ced9c74610b66cfbb58d54">weborganics@googlemail.com</a></p>
- <p>Web: <a rel="me" class="url" href="http://weborganics.co.uk/">WebOrganics</a></p>
- <div class="geo">
- <p>Location: <abbr title="53.7552" class="latitude">N 53.7552</abbr>,
- <abbr title="-2.3675" class="longitude">W -2.3675</abbr><p>
- </div>
- </div>
hCard classes and how they map to FOAF are as follows...
"vcard"=> foaf:Person"fn"=> foaf:name"given-name"=> foaf:givenname"family-name"=> foaf:family_name"email"=> foaf:email"url"=> foaf:homepage"url org"=> foaf:workplaceHomepage"photo"=> foaf:img
The geo component of hcard maps to foaf:based_near and defined using the WGS84 Geo Positioning RDF vocabulary...
"geo"=> geo:Point"latitude"=> geo:lat"longitude"=> geo:long
Lastly The value of foaf:mbox_sha1sum uses the id="" of class email prefixed with "sha1:"
XFN relationship values are also expanded and added to your FOAF output. rel="me" values that are links to popular social networking sites are mapped to foaf:holdsAccount, although not all rel me links are added to the output, a list of supported sites are as follows...
- flickr
- digg
- ma.gnolia
- last.fm
- delicious
- pownce
- youtube
Example:
- <a rel="me" href="http://delicious.com/weborganics">delicious</a>
All XFN relationships are defined as foaf:knows, foaf:Person, foaf:name and foaf:weblog along with its XFN value eg: xfn:met.
Example:
- <a rel="friend met" href="http://www.djkippax.com/" title="James Kippax">James Kippax</a>
Interests and things that have been made or authored by a user are simply defined as foaf:interest maps to hAtom rel="bookmark".
And thats it, easy eh? There is a Demo of how to use hFoaf With GRDDL along with some copy and paste code and some example output available at hFoaf Demo and also a webservice available at TransFormr that extracts a FOAF document


