<?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>Peter Williams &#187; XML</title>
	<atom:link href="http://barelyenough.org/blog/tag/xml/feed/" rel="self" type="application/rss+xml" />
	<link>http://barelyenough.org</link>
	<description>… and there is much to be learned</description>
	<lastBuildDate>Mon, 19 Jul 2010 14:57:18 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Unobtrusive link info</title>
		<link>http://barelyenough.org/blog/2010/01/unobtrusive-link-info/</link>
		<comments>http://barelyenough.org/blog/2010/01/unobtrusive-link-info/#comments</comments>
		<pubDate>Tue, 05 Jan 2010 05:19:14 +0000</pubDate>
		<dc:creator>Peter Williams</dc:creator>
				<category><![CDATA[Software Development]]></category>
		<category><![CDATA[JSON]]></category>
		<category><![CDATA[REST]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://barelyenough.org/?p=416</guid>
		<description><![CDATA[ Mr Amundsen&#8217;s recent post regarding the design of &#8220;semantic machine media types&#8221; got me thinking about media type design. One of the commonly encouraged practices, particularly on the REST discuss group, is the use of link elements.

I really dislike this idea. It sets my teeth on edge because it treats links &#8211; which are possibly [...] ]]></description>
			<content:encoded><![CDATA[<p><a href='http://amundsen.com/blog/archives/1023'>Mr Amundsen&#8217;s</a> recent post regarding the design of &#8220;semantic machine media types&#8221; got me thinking about media type design. One of the commonly encouraged practices, particularly on the <a href='http://tech.groups.yahoo.com/group/rest-discuss'>REST discuss group</a>, is the use of <a href='http://tools.ietf.org/html/rfc4287#section-4.2.7'><code>link</code> elements</a>.</p>

<p>I really dislike this idea. It sets my teeth on edge because it treats links &#8211; which are possibly the most important bits of data in existence &#8211; as second class citizens. It is easiest to show what i mean with a bit of extrapolation:</p>

<pre><code>&lt;complexElement rel=&quot;entry&quot;&gt;
  &lt;string rel=&quot;id&quot;&gt;234132&lt;/string&gt;
  &lt;string rel=&quot;displayName&quot;&gt;Peter Williams&lt;/string&gt;
  &lt;complexElement rel=&quot;name&quot;&gt;
    &lt;string rel=&quot;familyName&quot;&gt;Williams&lt;/string&gt;
    &lt;string rel=&quot;givenName&quot;&gt;Peter&lt;/string&gt;
  &lt;/complexElement&gt;
  &lt;complexElement rel=&quot;emails&quot;&gt;
    &lt;link rel=&quot;email&quot; href=&quot;mailto:pezra@barleyenough.org&quot;/&gt;
    &lt;string rel=&quot;type&quot;&gt;personal&lt;/string&gt;
  &lt;/complexElement&gt;
&lt;/complexElement&gt;</code></pre>

<p>That is what a <a href='http://portablecontacts.net/'>portable contact</a> might look like if we treated all data the way <code>link</code> elements work. That example looks pretty ugly to me, as i suspect it does to most people. It is ugly because very important information regarding the role of elements is relegated to a subsidiarity position in favor of fairly unimportant information about its type. However, <code>link</code> elements do to links exactly what my example does to all the data. The effect is that properties whose values happen to be independently addressable resources are obfuscated.</p>

<p>The <a href='http://en.wikipedia.org/wiki/Revealed_preference'>revealed preference</a> of the world is against <code>link</code> elements. Just look at pretty much any format that embeds application specific semantics. As far as i know, there is not a single widely used format that actually represents its links as <code>link</code> elements. Even <a href='http://tools.ietf.org/html/rfc4287'>atom</a> uses properly named elements for most its links. The <code>link</code> element it defines is largely relegated to the back water of extensibility.</p>

<p>One benefit that <code>link</code> elements have, or at least could have if they where more widely used, is the facilitation of standard link processing tools. Fortunately, we do not have to give up the expressiveness and clarity of <a href='http://c2.com/cgi/wiki?IntentionRevealingNames'>intention revealing names</a> to achieve this result. Rather than obscuring the links we could just treat them as normal data. The additional information needed to support standard tools could be added in a relatively unobtrusive way. Consider the following:</p>

<pre><code>&lt;entry xmlns:link=&quot;http://unobtrusive-generic-linking.org/&quot;&gt;
  ...
  &lt;emails&gt;
    &lt;value link:hrefDisposition=&quot;elementContent&quot; 
           link:rel=&quot;foo&quot;&gt;
      mailto:pezra@barelyenough.org&lt;/value&gt;
    &lt;type&gt;personal&lt;/type&gt;
  &lt;emails&gt;
&lt;/entry&gt;</code></pre>

<p>This is idea is similar to <a href='http://www.w3.org/TR/xlink'>xLink</a> but more flexible and simpler to use.</p>

<p>You could expand the idea to JSON with relative ease. Consider the following expansion of the portable contacts json format tagged with some unobtrusive link info.</p>

<pre><code>{&quot;entry&quot;: [
  {&quot;id&quot;: &quot;42&quot;,
  &quot;emails&quot;:
    [{&quot;address&quot;   : &quot;mailto:pezra@barelyenough.org&quot;,
      &quot;type&quot;      : &quot;personal&quot;,
      &quot;_linkInfo&quot; : {&quot;hrefDisposition&quot; : &quot;address&quot;, 
                     &quot;rel&quot; : &quot;foo&quot;}}]}]}</code></pre>

<p>Unobtrusive link info makes links visible to and usable by generic link processing tools while protecting the use of intention revealing names that format designers, and users, want. This is important because it allows new formats to reuse &#8220;standard&#8221; link semantics more easily and uniformly.</p>
]]></content:encoded>
			<wfw:commentRss>http://barelyenough.org/blog/2010/01/unobtrusive-link-info/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
	</channel>
</rss>
