<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>George Brocklehurst's weblog &#187; markup</title>
	<atom:link href="http://blog.georgebrock.com/tag/markup/feed" rel="self" type="application/rss+xml" />
	<link>http://blog.georgebrock.com</link>
	<description>Because some things are too long for Twitter</description>
	<lastBuildDate>Fri, 19 Feb 2010 00:15:27 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>XFN and the rev attribute</title>
		<link>http://blog.georgebrock.com/code/xfn-and-the-rev-attribute</link>
		<comments>http://blog.georgebrock.com/code/xfn-and-the-rev-attribute#comments</comments>
		<pubDate>Thu, 14 May 2009 09:13:20 +0000</pubDate>
		<dc:creator>George Brocklehurst</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[markup]]></category>
		<category><![CDATA[microformats]]></category>
		<category><![CDATA[rel]]></category>
		<category><![CDATA[rev]]></category>
		<category><![CDATA[semantics]]></category>
		<category><![CDATA[xfn]]></category>

		<guid isPermaLink="false">http://blog.georgebrock.com/?p=155</guid>
		<description><![CDATA[Background: XFN and rel
XFN is a microformat that expresses relationships.  If a page represents you (for example your blog or your profile on a social network site) you can annotate the links on that page to indicate whether you are linking to another of your own profiles or to a friend, colleague or contact&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<h3>Background: <acronym title="XHTML Friends Network">XFN</acronym> and <code>rel</code></h3>
<p><a href="http://microformats.org/wiki/xfn"><acronym title="XHTML Friends Network">XFN</acronym></a> is a <a href="http://microformats.org">microformat</a> that expresses relationships.  If a page represents you (for example your blog or your profile on a social network site) you can annotate the links on that page to indicate whether you are linking to another of your own profiles or to a friend, colleague or contact&#8217;s page.</p>
<p>The annotations are made using the <abbr title="Extensible Hypertext Markup Language or Hypertext Markup Language">(X)HTML</abbr> <code>rel</code> attribute.  The HTML 4 specification provides several <a title="Link types in the HTML 4 specification" href="http://www.w3.org/TR/REC-html40/types.html#type-links">standard values for the <code>rel</code> attribute</a> include <code>next</code>, <code>prev</code> and <code>contents</code>.  In an age of social networks, where URLs often represent people, XFN is a logical extension of this attribute.</p>
<p>Of course, this is open to abuse.  I could add a link to this page that points to someone else&#8217;s site and uses XFN to claim that it is also my site.  This is why the claims made by XFN are generally not trusted unless they are reciprocal.  For example, this blog links to <a href="http://georgebrock.com">georgebrock.com</a> and <a href="http://georgebrock.com">georgebrock.com</a> links back to this blog.  Both pages claim that the other site is about the same person, and because the claim is reciprocal it can be considered trustworthy.</p>
<h3>XFN and <code>rev</code></h3>
<p>I&#8217;ve recently been building a social networking site, and marking up the user profiles and contact lists using a combination of <a href="http://microformats.org/wii/hcard">hCard</a> and XFN.  While I was marking this up I found myself reaching not only for the <code>rel</code> attribute, but also the less common <code>rev</code> attribute.  The <code>rev</code> attribute specifies the reverse relationship described by the link, for example <code>rel="prev"</code> is equivalent to <code>rev="next"</code>.</p>
<p>This is the markup that I came up with:</p>
<pre><code> &lt;h3&gt;<strong>1 user wants to be your friend</strong>&lt;/h3&gt;
 &lt;ul&gt;
   &lt;li class="vcard"&gt;
     &lt;a <strong>rev="friend"</strong> class="fn url" href="…"&gt;
       Tom Smith
     &lt;/a&gt;
   &lt;/li&gt;
 &lt;/ul&gt;

 &lt;h3&gt;<strong>Waiting for confirmation from 1 user</strong>&lt;/h3&gt;
 &lt;ul&gt;
   &lt;li class="vcard"&gt;
     &lt;a <strong>rel="friend"</strong> class="fn url" href="…"&gt;
       Dick Jones
     &lt;/a&gt;
   &lt;/li&gt;
 &lt;/ul&gt;

 &lt;h3&gt;<strong>Friends with 1 user</strong>&lt;/h3&gt;
 &lt;ul&gt;
   &lt;li class="vcard"&gt;
     &lt;a <strong>rel="friend" rev="friend"</strong> class="fn url" href="…"&gt;
       Harry Taylor
     &lt;/a&gt;
   &lt;/li&gt;
 &lt;/ul&gt;</code></pre>
<p>I&#8217;ve also considered using some of my own link types (with an accompanying <a href="http://microformats.org/wiki/xmdp"><acronym title="XHTML Meta Data Profile">XMDP</acronym> document</a>, of course).  For example, if you have asked to be friends with someone and they haven&#8217;t yet confirmed the relationship that could be made more explicit using <code>rel="friend" rev="unconfirmed"</code> on your profile and inverse on their profile: <code>rel="unconfirmed" rev="friend"</code>.</p>
<h3>Pros and cons</h3>
<p>There are a few things about this that I really like:</p>
<ol>
<li>The markup is more semantically rich that it would be if only using <code>rel</code>.  It expresses not only all the claims that a user has made, but also all the claims that have been made about that user, even if they are not (or not yet) reciprocal.</li>
<li>Having all the relationship information about a given user in one place makes it incredibly easy to extract very specific information with a tool like <a href="http://developer.yahoo.com/yql"><acronym title="Yahoo Query Langauge">YQL</acronym></a> or <a href="http://www.w3.org/2004/01/rdxh/spec"><acronym title="Gleaning Resource Descriptions from Dialects of Languages">GRDDL</acronym></a> without having to rely on specific knowledge of the page structure.</li>
</ol>
<p>There are also a few things that I don&#8217;t like:</p>
<ol>
<li>The <code>rev</code> attribute isn&#8217;t often used and is commonly misunderstood (although I&#8217;m not sure why, <a title="HTML 4 specifiction: Forward and reverse links" href="http://www.w3.org/TR/REC-html40/struct/links.html#h-12.3.1">the specification is very clear</a> on what it means). Because of the lack of understanding the microformats wiki <a title="Microformats wiki, rel attribute FAQ: Should rev even be used?" href="http://microformats.org/wiki/rel-faq#Should_rev_even_be_used">strongly discourages the use of <code>rev</code></a>.</li>
<li>It has been suggested that <a title="Microformats wiki, XFN brainstorming: Discussion of rel-fan proposal" href="http://microformats.org/wiki/xfn-brainstorming#rejected_fan_follower_terms">using <code>rev</code> instead of <code>rel</code> for XFN link types is tantamount to creating a whole new microformat</a>.</li>
<li>The reason reciprocal claims are trustworthy is that they are made by both of the pages involved. This markup claims reciprocation without involving the other page.  While this makes sense in this specific case (the links are between profiles in the same site and are being automatically generated based on the same set of data) it would not be good in the general case to assume that just because a link has both <code>rel</code> and <code>rev</code> it is reciprocal and therefore trustworthy.</li>
</ol>
<h3>What do you think?</h3>
<p>I&#8217;ve not previously seen the link types defined in  XFN used with the <code>rev</code> attribute, so I&#8217;m curious what other developers, and particularly those in the microformats community think of this?</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.georgebrock.com/code/xfn-and-the-rev-attribute/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
