Expressing the XFN microformat in RDF

Richard Cyganiak (DERI Galway/
Last updated:
Vocabulary namespace:


  1. Introduction
  2. How XFN works: Pages as proxies for people
  3. How XFN in RDF works: Explicit resources for people
  4. Relationship to FOAF
  5. Overview of terms
  6. RDF Schema definitions


Links on the Web often represent not just connections from one web page to another, but also human relationships: The links to your friend's pages on a social networking site represent social connections, and the link from your weblog to your Twitter profile page expresses that the same person – you – is responsible for both pages. XFN is a microformat for making these social relationships explicit. Here we describe the XFN in RDF vocabulary, an RDF Schema vocabulary that can be used to express XFN microformat data in RDF.

How XFN works: Pages as proxies for people

The XFN microformat defines 17 types of social relationships, such as friend and co-worker and sweetheart. The types are used by turning simple hyperlinks in HTML pages into typed links. This is achieved by adding some simple markup to the HTML code. In the example below, Bob states that Alice is a friend by adding some XFN markup to his web page.

Figure 1: An XFN friend link in HTML
<!-- This is bob.html -->
<a rel="friend" href="alice.html">Alice</a>

Hyperlinks are connections between web pages. In XFN, hyperlinks are used to express relationships between people. The web pages are proxies for the people.

A special link type in XFN is the me link. Bob can use a me link to point to his other pages on the Web, e.g. from his weblog to his Flickr page.

Figure 2: An XFN me link in HTML

How XFN in RDF works: Explicit resources for people

RDF is a powerful modelling mechanism, and makes it easy to be explicit about what is related to what. In our RDF representation of XFN, there is an explicit node for each of the people involved. Social relationships are expressed as connections between those person nodes, not as connections between the pages.

Each person node is connected to its respective web page by an RDF property called me page. A me page is any page I'm responsible for.

Figure 3: An XFN friend link in RDF
# This is an RDF representation of bob.html

@prefix xfn: <> .

    xfn:mePage <bob.html>;
    xfn:friend [
        xfn:mePage <alice.html>;

XFN's me link, which expresses that the same person is responsible for the target page, is handled in a special way. There is a single person node, and both the current page and the target page are me pages of that person.

Figure 4: An XFN me link in RDF
# This is an RDF representation of bob.html

@prefix xfn: <> .

    xfn:mePage <bob.html>;
    xfn:mePage <bobs-blog.html>;

In addition to the explicit properties that connect people nodes, this RDF version of XFN also defines a set of properties that directly connect web pages, just as in raw XFN. These properties have a “-hyperlink” suffix appended to their identifiers (URIs) to distinguish them from the normal, person-connecting properties.

Figure 5: An XFN friend link in RDF, expressed using a hyperlink property

Relationship to FOAF

FOAF is a popular RDF Schema vocabulary for expressing social network data in RDF. FOAF provides a rich set of terms for describing people's online presence, contact data, and groups. Unlike XFN, it defines just a single type of relationship between people: foaf:knows.

Some of the XFN relationship types are subproperties of foaf:knows. For example, if Alice is an xfn:friend of Bob, then this implies that Bob foaf:knows Alice, so we made xfn:friend into a subproperty of foaf:knows. This means that FOAF-supporting applications are automatically compatible with XFN-in-RDF (if the FOAF application performs RDFS inference).

For other terms in XFN, it is not quite as clear if the relationship implies that the two connected people know each other. For example, it is possible that Bob does not foaf:know his xfn:parents. But we decided to be quite liberal in mapping the XFN types to foaf:knows, and made most of them subproperties. This has the benefit of greater compatibility with the popular FOAF vocabulary.

Overview of terms

Click any term with an RDF-capable browser to see its definition.

Support properties

Properties for connecting people

Properties for connection web pages

RDF Schema definitions

RDF Schema definitions of this vocabulary are available: