Chapter 4. Defining Relationships: XFN

In the last chapter, we examined how to define links using rel-based microformats and VoteLinks, which uses the rev attribute. Now we will focus on using the rel attribute for links in order to define social relationships.

What Is XFN?

XFN (XHTML Friends Network) is another elemental microformat—it uses just one attribute-value pair—that defines link relationships. But unlike the rel-based microformats, which describe relationships of href destinations to pages, XFN describes social relationships among people.

Developed by the Global Multimedia Protocols Group (GMPG), XFN evolved in response to the blogroll trend, where content authors publish links to other sites they recommend. Often these blogrolls are links to personal sites and blogs (hence the name) that are representative of the people behind them. In effect, these URLs are part of people’s online identities.

XFN was created in order to represent these online identities through links, using the rel attribute and a standard set of keywords (values) that describe the relationships you, as the content author, have with the people whose sites you link to. Such relationships include whether you have physically met that person, if that person is a friend or colleague, even if that person is a family member or significant other.

Benefits of the social web

As much as I detest the term Web 2.0 (I think I just threw up in my mouth a little), it has come to represent, in part, the emergence of online social media. This includes everything from user-generated content to popular social networks like Facebook and Twitter.

XFN, too, is a part of this social web. Because it is used to describe human relationships, it supports the creation and extension of social networks. Web tools can crawl the web, searching for XFN links, and discover the social relationships among people, such as the following:

• Dick and Jane have met and they are friends

• Brad and Angelina are spouses

• A Blog Not Limited and @emilylewis are the same person

Let’s consider the Google Social Graph API (Application Programming Interface), which drives Google’s My Connections service. With My Connections, you enter a few of your own URLs (such as that for your blog, your portfolio, and your Twitter profile page), and it uses the Social Graph API to gather links from other people with whom you’ve indicated a social relationship (via XFN). It also returns information about the people who have indicated, via XFN, relationships with you, including reciprocal relationships (Figure 4.1).

Figure 4.1 Google’s My Connections displays my XFN social connections gathered from my blog, Twitter profile, and design portfolio.

image

Even better, you can use this Social Graph API to create your own social network without having to code your own application, access other APIs, or scrape sites for data. Google’s Social Graph API has already indexed the sites and relationships.

And XFN is already widely used. The majority of social networking sites use XFN to describe the relationships between friends and followers using the XFN contact or friend values (assigned to links as rel="contact" and rel="friend", respectively).

Benefits of identity consolidation

Nowadays, particularly with the emergence of social networks, people exist on many different and disparate sites. You may have a blog, a Twitter profile, a Facebook page, and more. With all of these distributed sites, a user may want a way to indicate that each site represents the same person. This is known as identity consolidation, and XFN supports it.

One of the values for XFN is me (assigned to links as rel="me"). By assigning this value to the links to all of your online “identities,” you are indicating that each site represents you, effectively consolidating your identity without having to centrally maintain that information.

The key to identity consolidation with rel="me" is that each site in your online identity must have this XFN value applied. The logic is where any site claims another site, the identity between the two is consolidated.

This isn’t too difficult. On your own sites, you control the content and can add rel="me" where relevant. And already, many sites and services apply rel="me" to links to their users’ profile pages to support identity consolidation, including Flickr, Twitter, LinkedIn, Plaxo, and ClaimID. As such, web applications can gather all of your rel="me" links to create a single profile about you.

One social service that leverages the full power of identity consolidation via XFN is Huffduffer, the audio podcasting service. It utilizes Google’s Social Graph API to gather reciprocal rel="me" links from a single URL (namely, your own blog or site) in order to generate a list of “elsewhere” links (such as Twitter and Flickr) on users’ profiles.

So, when you create an account at Huffduffer, you enter a URL for one of your websites, and the Social Graph API then returns a list of all other sites that belong to you, based on the presence of the XFN rel="me".

The beauty of this is that instead of editing your profile manually to include links for yourself, Huffduffer does it for you automatically, saving time and ensuring you don’t have to maintain that data within the application (Figure 4.2).

Figure 4.2 My Huffduffer profile’s Elsewhere links gathered via the Social Graph API

image

Everything has challenges

Of course, despite these powerful benefits, XFN faces some challenges:

• There are 18 XFN values; however, the two most commonly used are friend and contact, making some folks question the semantic value of the other 16 values.

• Some people believe there isn’t enough semantic distinction between friend and contact.

• Others suggest more values are needed to indicate narrower professional relationships beyond co-worker and colleague, such as “manager” or “subordinate.”

• There isn’t a way to indicate how a relationship may change over time, such as an “ex-friend.”

Regarding the first point, I truly believe that as more people adopt XFN, the use of those remaining 16 values will increase and, with it, more tools will parse and extract information for those types of relationships. Kind of a “build it and they will come” perspective.

For the other concerns, I believe people are missing the point about microformats in general: they are intended to be simple and address the majority of use-cases, not all.

Adding more values to XFN, in my opinion, would convolute the microformat and go against simplicity. In the case of professional relationships, managers are co-workers, just as subordinates are; co-worker is a global value that encompasses both managers and subordinates. I don’t see the need to get any more specific. Plus, XFN doesn’t prohibit you from assigning to your rel attribute a value of “manager,” which you can then use to customize your own web application to extract that particular data.

Finally, in the case of changed relationships, I believe that because XFN is assigned to links at a given point in time, the indicated relationship is relevant at the time the link was created. If the relationship changes over time, the XFN values assigned to links can change, thus suggesting that changed relationship.

Now that we’ve covered the good and the (not really) bad, let’s take a look at XFN in detail, starting with the profile.

Profile

XFN has its own profile that you should reference in the <head> of your documents:

<head profile="http://gmpg.org/xfn/11">

Syntax

The XFN syntax should be very familiar to you, since it is identical to that of the rel-based microformats. You simply add the rel attribute to links referencing other people, and apply the appropriate XFN value to indicate your relationships with those people.

For example, I often include links on my blog to my friends’ sites, and I apply rel="friend" to those links:

<a href="http://twitter.com/cdharrison" rel="friend">Chris
Harrison</a>

Most of the time, though, I have more than one XFN relationship with those friends. For those cases, I can list more than one value, each separated in my markup with a space:

<a href="http://twitter.com/cdharrison" rel="friend met
colleague">Chris Harrison</a>

This compound XFN statement says:

• Chris is a friend of mine.

• I have met Chris.

• Chris is my colleague.

It is worth noting that for these compound XFN statements, the order of the values is irrelevant. Just be sure to separate each with a space so that all of the values can be parsed correctly.

Understanding the values

The XFN values are listed in Table 4.1 above, but their meaning may not be entirely clear to you, so let me explain them.

Table 4.1 XFN Values

image

Identity

The only value that falls under the identity category is me, which I’ve discussed in reference to identity consolidation. You apply it to links that reference URLs about you: your blog, your tumblelog, your design portfolio, or any site about you.

The one XFN value that should exist on its own is me. Yes, by some lines of thinking you have met yourself and you may even be a friend to yourself. However, these values are pretty much assumed. But hey, two thumbs up for good self-esteem and being your own friend!

Friendship

Of the three values in the friendship category, you can use only one:

contact is the least intimate of the friendship relationships. It is basically someone for whom you have basic contact information, such as their name and, maybe, a URL to their site.

acquaintance indicates someone with whom you are familiar and who is familiar with you. It’s just a step above contact in terms of intimacy.

friend is the most intimate friendship value, but it is largely defined by personal parameters. For me, it includes people I’ve known for years, as well as those I know more casually but who are more than just contacts or acquaintances.

Professional

You can use either one or both of the values in the professional category:

colleague is a professional peer, someone with whom you share professional skills and/or interests.

co-worker is someone you work with for the same employer.

Family

From the five family XFN values, you can use only one:

kin is any relative, whether by blood, marriage, or adoption.

spouse is someone to whom you are married. However, it does not require legal marriage. It can also be someone to whom you feel you are married, such as gay couples who aren’t legally allowed to marry or folks in common-law marriages.

child is anyone you parent, and applies to both biological and adoptive children.

parent is someone—again, either biological or adoptive—who parented you.

sibling is someone with whom you share a parent, either through biology, marriage, or adoption.

Romantic

You can use any one or all of the values in the romantic category:

muse is someone who inspires you. Now I admit that, at the outset, it seems strange to categorize this as romantic. However, the value falls under the comparative definition of romantic with rational, the thinking being that inspiration isn’t rational, so it must be romantic.

crush is someone to whom you are attracted but doesn’t return the feeling. And, in my case, someone who doesn’t even know you are alive (ah, Hugh Jackman).

date is someone you date on a regular basis, where there isn’t (yet?) a commitment to the relationship.

sweetheart is someone to whom you are committed and are physically and/or emotionally intimate.

Physical

The only physical value is met, and it refers to people you have actually met in person (so that would not be the guy in the chat room you just met online).

Geographic

Of the two geographic values, you can use only one:

neighbor is someone who lives near you, but not at the same street address. This value has broad definitions: you may consider someone who lives in your condo building a neighbor, as well as someone who lives several blocks away.

co-resident is someone with whom you share a street address, such as a roommate.

Another thing worth noting is that XFN doesn’t require reciprocity. If you reference a person as a date and they reference you as a friend, it has no impact on the ability for machines to work with XFN. However, it may be time to have a “where are we in this relationship” conversation with that person.

Practical Markup

Since XFN describes social relationships via links, the markup is always a link (<a>). But it is still worthwhile to see some examples of how these links might appear in content.

Blogroll using <ul>

I mentioned that the blogroll trend was, in part, inspiration for the genesis of XFN, so let’s see how it looks in action using an excerpt from my own blogroll:

image

rel="met"

Each of the links in this example is to a site about a person I have met in real life, so I will add the rel attribute to each of my links and assign the value met:

image

rel="friend"

Additionally, each of these folks is someone I consider a friend, so I will also add that XFN value to my rel attribute, making sure to separate the multiple values with a space:

image

rel="co-worker"

One of the links is to my boss, so for his link I will also add the co-worker value:

<a href="http://www.iso-100.com/" rel="met friend
co-worker">Ian Pitts</a>

rel="colleague"

Another link is to someone who is my professional peer with similar interests and skills, so in goes the colleague value:

<a href="http://cdharrison.com/" rel="met friend colleague">
Chris Harrison</a>

rel="muse"

Finally, the last link is to someone whom I admire and who inspires me on a regular basis—a muse:

<a href="http://www.webteacher.ws/" rel="met friend muse">
Virginia DeBolt</a>

The end result

Now I have a nice blogroll that also indicates my social relationships:

image

I would use this same markup structure (an unordered list) for lists of followers/friends in a social network, such as Twitter. Sadly, while Twitter embraces the semantics of XFN, it does not embrace POSH, instead using a bunch of completely nonsemantic <span> elements (tsk, tsk, but I still love you, Twitter).

The logic behind the markup

There’s not much to the logic for a blogroll. It is a list of links to blogs/sites that I read and recommend. So a link element makes POSH sense. And because there is no sequence to these links, an unordered list (<ul>) is appropriate.

However, if you wanted to have a blogroll with a bit more information than just a link, such as a brief description of the site/blog, you could use a definition list (<dl>). In this case, you would contain your XFN link in a <dt>, followed by your brief description contained in a <dd>, like so:

image

Note that I only included one link and description in this example for brevity’s sake (I already suspect I’ve killed a few trees and this book isn’t even halfway finished). I would not encourage a definition list with a single item. From my semantic perspective, lists should be for two or more items.

XFN in natural language

Links, by their nature, are commonly included in natural language. That is, you can put links in language that appears in natural sentences, as opposed to chunking the content in list elements as I’ve done in the previous examples.

So let’s take a look at applying XFN to links that appear naturally in sentences of a paragraph that might be in one of my blog posts:

<p>At SXSWi, I attended an excellent session on the future
of web education, along with my friends Chris Harrison and
Virginia DeBolt.</p>

Adding the links

Whenever I reference a person on my blog (or any site I maintain, for that matter) and that person has a site, I always give them a little link-love:

<p>At SXSWi, I attended an excellent session on the future
of web education, along with my friends <a href="http://
cdharrison.com/">Chris Harrison</a> and <a href="http://
www.webteacher.ws/">Virginia DeBolt</a>.</p>

Adding the XFN

Once the links are in place, I just drop in the appropriate XFN values for each person’s link:

<p>At SXSWi, I attended an excellent session on the future
of web education, along with my friends <a href="http://
cdharrison.com/" rel="met friend colleague">Chris Harrison
</a> and <a href="http://www.webteacher.ws/" rel="met friend
muse">Virginia DeBolt</a>.</p>

This rel-friend markup is styled with CSS in Chapter 12 (page 273).

Authoring Tools

I’m the first to admit that I’m a bit of a snob about hand-coding. But I realize that is my own issue, not yours. So you should be aware of a few tools available to help you author XFN:

• GPMG offers the XFN 1.1 Creator (www.gmpg.org/xfn/creator) to generate links containing XFN values.

• Accessify’s XFN Link Creator (www.accessify.com/tools-and-wizards/developer-tools/xfn/default.php) also creates XFN links.

• Rel-lint (http://tools.microformatic.com/help/xhtml/rel-lint/) is a browser bookmark that validates your XFN (as well as the other rel-based microformats).

Bye-bye Elementals, Hello Compounds

So now you know how to add semantic richness to your social links with XFN. And you know all the elemental microformats: rel-based, VoteLinks, and XFN. Remember, these are microformats that rely on a single attribute-value pair.

From this point forward, all of the microformats we’ll be covering are compound microformats, comprised of properties and subproperties. But don’t fret! The elemental microformats are often used within compounds, so you’ll be seeing them again.

Now get ready to learn how to add semantics to bookmarks with xFolk.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset