<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="xmlspec.xsl"?>
<!DOCTYPE spec PUBLIC "-//W3C//DTD Specification V2.1//EN"
     "http://www.w3.org/XML/1998/06/xmlspec-v21.dtd" [
    <!ENTITY note.name "RDFa Primer">
    <!ENTITY version "1.0">
    <!ENTITY XFormsNS "http://www.w3.org/2002/xforms">
    <!ENTITY prev-dd "10">
    <!ENTITY prev-mm "03">
    <!ENTITY prev-year "2006">
    <!ENTITY dd "01">
    <!ENTITY MM "October">
    <!ENTITY mm "10">
    <!ENTITY year "2006">
    <!ENTITY iso.doc.date "&year;&MMDD;">
    <!ENTITY MMDD "&mm;&dd;">
    <!ENTITY ne "≠">
    <!ENTITY ouml "ö">
    <!ENTITY times "×">
    <!ENTITY order "£">
    <!ENTITY le "≤">
    <!ENTITY cellback "#d0d9fa">
    <!ENTITY eacute "é">
    <!ENTITY copy "©">
    <!ENTITY sect "§">
    <!ENTITY mdash "&#8212;">
]>
<!-- "http://www.w3.org/XML/1998/06/xmlspec-v21.dtd" -->
<spec w3c-doctype="draft">
    <header>
        <title>&note.name;</title>
        <subtitle>Embedding Structured Data in Web Pages</subtitle>
        <version>&version;</version>
        <w3c-designation>Internal Working Draft</w3c-designation>
        <w3c-doctype>Editors' Draft</w3c-doctype>
        <!-- notice>Notice this!!</notice -->
        <publoc>
            <loc href="http://www.w3.org/2006/07/SWD/RDFa/primer/20070910/">http://www.w3.org/2006/07/SWD/RDFa/primer/20070910/</loc>
            $Id: Overview.xml,v 1.2 2007/09/11 00:47:53 adida Exp $
        </publoc>
        <prevlocs>
<ul>
  <li> <loc href="http://www.w3.org/2006/07/SWD/RDFa/primer/20070302/">http://www.w3.org/2006/07/SWD/RDFa/primer/20070302/</loc></li>
    <li> <loc href="http://www.w3.org/2006/07/SWD/RDFa/primer/20070227/">http://www.w3.org/2006/07/SWD/RDFa/primer/20070227/</loc></li>
  <li> <loc href="http://www.w3.org/2006/07/SWD/RDFa/primer/20070104/">http://www.w3.org/2006/07/SWD/RDFa/primer/20070104/</loc></li>
<li> <loc href="http://www.w3.org/2001/sw/BestPractices/HTML/2006-04-24-rdfa-primer">http://www.w3.org/2001/sw/BestPractices/HTML/2006-04-24-rdfa-primer</loc></li>
</ul>
        </prevlocs>
        <latestloc>
    <loc href="http://www.w3.org/2006/07/SWD/RDFa/primer">http://www.w3.org/2006/07/SWD/RDFa/primer</loc>
        </latestloc>
        <authlist>
            <author>
                <name>Ben Adida</name>
                <affiliation>Creative Commons</affiliation>
                <email href="mailto:ben@adida.net">ben@adida.net</email>
            </author>
            <author>
                <name>Mark Birbeck</name>
                <affiliation>x-port.net Ltd.</affiliation>
                <email href="mailto:mark.birbeck@x-port.net">mark.birbeck@x-port.net</email>
            </author>
        </authlist>
        <abstract>

            <p> Current web pages, written in XHTML, contain inherent
            structured data: calendar events, contact information, photo
            captions, song titles, copyright licensing information, etc. When
            publishers can express this data precisely, and when tools can
            read it robustly, a new world of user functionality becomes
            available, letting users transfer structured data between
            applications and web sites. An event on a web page can be directly
            imported into a desktop calendar. A license on a document can be
            detected to inform the user of his rights automatically. A photo's
            creator, camera setting information, resolution, and topic can be
            published as easily as the original photo itself. </p>

            <p> RDFa lets an XHTML author express this structured data using
            extra XHTML attributes. Where the data is already present on the
            page, e.g. the photo's caption, the author need not repeat it. A
            web publisher can easily reuse concepts, e.g. an event's date,
            defined by other publishers, or create new ones altogether. RDFa
            gets most of its expressive power from RDF, though the reader need
            not understand RDF to read on.</p>

            <p> This document introduces XHTML authors to RDFa with simple
            examples. For more detailed syntax specification, please consult
            the <a href="http://www.w3.org/2006/07/SWD/RDFa/syntax">RDFa
            Syntax Document</a>. </p>

        </abstract>
        <status>

          <p> This is an internal draft produced by the Semantic Web
          Deployment Working Group <bibref ref="SWD-WG" />, in
          cooperation with the HTML Working Group
          <bibref ref="HTML-WG" />. Initial work on RDFa began with
          the Semantic Web Best Practices and Deployment Working Group
          <bibref ref="SWBPD-WG" />.
	  </p>

      <p>
        This document is for internal review only and is subject
        to change without notice. This document has <em>no formal
        standing within the W3C</em>.
      </p>
            <p>
<!--                <emph>Last Modified: &year;-&mm;-&dd;</emph>-->
            </p>
        </status>
	<changes>
	  <p>
	    Since <a href="http://www.w3.org/2006/07/SWD/RDFa/primer/20070302/">Working Draft #3</a> of this document:
	    <ul>
	      <li> Section 3 on Shutr was split up and moved to "advanced concepts", rather than be a semi-syntax'ish thing.</li>
	      <li> the <att>class</att> attribute is no longer used to declare <code>rdf:type</code>, as this was found to be too confusing. We now use the new <att>instanceof</att> attribute.</li>
	      <li> the updated syntax for chaining (previously referred to as striping) is introduced.</li>
	    </ul>
	  </p>
	</changes>
        <languages>
            <language>en</language>
        </languages>
        <revisiondesc>
            <p>
                <emph>Last Modified: $Id: Overview.xml,v 1.2 2007/09/11 00:47:53 adida Exp $</emph>
            </p>
        </revisiondesc>
    </header>
    <body>
      <div1>
  <head>Purpose and Preliminaries</head>

  <p> Current web pages, written in XHTML, contain inherent structured data:
  calendar events, contact information, photo captions, song titles, copyright
  licensing information, etc. When publishers can express this data precisely,
  and when tools can read it robustly, a new world of user functionality
  becomes available, letting users transfer structured data between
  applications and web sites. An event on a web page can be directly imported
  into a desktop calendar. A license on a document can be detected to inform
  the user of his rights automatically. A photo's creator, camera setting
  information, resolution, and topic can be published as easily as the
  original photo itself.</p>

  <p> RDFa lets an XHTML author express this structured data using extra XHTML
  attributes. Where the data is already present on the page, e.g. the photo's
  caption, the author need not repeat it. A web publisher can easily reuse
  concepts, e.g. an event's date, defined by other publishers, or create new
  ones altogether. RDFa gets most of its expressive power from RDF, though the
  reader need not understand RDF to read on.</p>

  <p>
    We note that RDFa makes use of XML namespaces. In this document,
    we assume, for simplicity's sake, that the following namespaces
    are defined: <att>dc</att> for Dublin Core, <att>foaf</att> for
    FOAF, <att>cc</att> for Creative Commons, and <att>xsd</att> for
    XML Schema Definitions:
    
    <ul>
      <li><att>dc</att>: http://purl.org/dc/elements/1.1/</li> 
      <li><att>foaf</att>: http://xmlns.com/foaf/0.1/</li> 
      <li><att>cc</att>: http://web.resource.org/cc/</li> 
      <li><att>xsd</att>: http://www.w3.org/2001/XMLSchema</li> 
    </ul>
  </p>

  
      </div1>
      <div1>
  <head>Simple Data: Publishing Events and Contacts</head>
    <p>
        Jo keeps a private blog for her friends and family.
    </p>
    
    <div2>
        <head>The Basic XHTML</head>

        <p> Jo is organizing one last summer Barbecue, which she hopes all of
        her friends and family will attend. She blogs an announcement of her
        talk at her private blog, <code>http://jo-blog.example.org/</code>.
        Her blog also includes her contact information: </p>

    <eg><![CDATA[<html>
    <head><title>Jo's Friends and Family Blog</title></head>
    <body>
...
    <p>
        I'm holding one last summer Barbecue, on September 16th at 4pm.
    </p>
...
    <p class="contactinfo">
        Jo Smith. Web hacker
        at
        <a href="http://example.org">
            Example.org
        </a>.
        You can contact me
        <a href="mailto:jo@example.org">
            via email
        </a>.
    </p>
...
    </body>
</html>
]]></eg>

    <p>
        This short piece of mark-up contains important structured data.
    </p>
    
    <p>
  The markup describes an <em>event</em>: a Barbecue that Jo
  is hosting. This Barbecue <em>starts</em> at 4pm on
  September 16th. A <em>summary</em> of the event is "one last summer Barbecue." We also have contact information for Jo: she works for the <em>organization</em> Example.org,
  with <em>job title</em> of "Web Hacker." She can be contacted at the <em>email</em>
  address "jo@example.org."
  </p>

  <p> At the moment, it is very difficult for software &mdash; like web
  browsers and search engines &mdash; to make use of this data's implicit
  structure. We need a standard mechanism to explicitly express it, so that it
  can be extracted consistently. This is precisely where RDFa comes in. </p>

    </div2>
    
     <div2 id="publishing-an-event"> <head>Publishing An Event</head>
    
     <p> Jo would like to label this blog entry so that her friends and family
    can add her Barbecue directly to their calendar. RDFa allows her to
    express this structure using a small handful of extra attributes. Since
    this is a calendar event, Jo will specifically use the iCal vocabulary
    <bibref ref="ICAL-RDF" /> to denote the data's structure. </p>
    
     <p> The first step is to reference the iCal vocabulary within the XHTML
    page, so that Jo's friends' web browsers can look up the calendar concepts
    and make use of them: </p>
    
     <eg><![CDATA[<html xmlns:cal="http://www.w3.org/2002/12/cal/ical#">
    ...]]></eg>
    
     <p> then, Jo declares a new event: </p>
    
     <eg><![CDATA[ <p instanceof="cal:Vevent"> ... </p> ]]></eg>

        <p> Note how the <att>instanceof</att> attribute is used here to
        define the kind of the data being expressed. The use of this attribute
        on the <el>P</el> element ensures that, by default, data expressed
        inside this element refers to the same event. Thus, inside this event
        declaration, Jo can set up the event fields, reusing the existing
        XHTML. For example, the event summary can be declared as: </p>

        <eg><![CDATA[    I'm holding <span property="cal:summary">
        one last summer Barbecue
    </span>
]]></eg>

        <p> The <att>property</att> attribute on the <el>span</el> element
        declares the data field <code>cal:summary</code>. The existing
        content, "one last summer Barbecue", is the value of this field.
        Sometimes, this isn't the desired effect. Specifically, the start time
        of the event should be displayed pleasantly &mdash; "September 16th"
        &mdash;, but should likely be represented in a machine-parsable way,
        the standard iCal format: <code>20070916T1600-0500</code> (which is
        clearly not pleasant for human display). In this case, the markup
        needs only a slight modification: </p>

        <eg><![CDATA[       <span property="cal:dtstart" content="20070916T1600-0500">
          September 16th at 4pm
       </span>
]]></eg>
  
  <p>
    The actual content of the <el>span</el> element, "September 16th at 4pm", is ignored by the RDFa portion of the browser: it has been replaced by the explicit <att>content</att> attribute. The full markup is then:
  </p>
        
    <eg><![CDATA[<html xmlns:cal="http://www.w3.org/2002/12/cal/ical#">
    <head><title>Jo's Friends and Family Blog</title></head>
    <body>
...
    <p instanceof="cal:Vevent">
        I'm holding
        <span property="cal:summary">
            one last summer Barbecue,
        </span>
        on
        <span property="cal:dtstart" content="20070916T1600-0500">
            September 16th at 4pm.
        </span>
    </p>
...
    </body>
</html>
]]></eg>
        
    <p>
      Note that Jo could have used any other XHTML element, not just <el>span</el>, to mark up her event. In other words, when the event information is already laid out in the XHTML using elements such as <el>h1</el>, <el>em</el>, <el>div</el>, etc..., Jo can simply add the <att>instanceof</att> data type declaration, the <att>property</att> attribute, and optionally the <att>content</att> attribute, to mark up the event.
    </p>

    <p>(For the RDF-inclined reader, the RDF triples that correspond to the above markup are available in Section <specref ref="events-rdf-triples" />.)
    </p>

    
    </div2>
    <div2 id="publishing-contact-info">
        <head>Publishing Contact Information</head>
        
        <p>
            Now that Jo has published her event in a human-and-machine-readable way, she realizes there is much data on her blog that she can mark up in the same way. Her contact information, in particular, is an easy target:
        </p>
        
        <eg><![CDATA[...
    <p class="contactinfo">
        Jo Smith. Web hacker
        at
        <a href="http://example.org">
            Example.org
        </a>.
        You can contact me
        <a href="mailto:jo@example.org">
            via email
        </a>.
    </p>
...]]></eg>
   
        <p>
            Jo discovers the vCard RDF vocabulary <bibref ref="VCARD-RDF" />, which she adds to her existing page. Since Jo thinks of vCards as a way to publish her contact information, she uses the prefix <code>contact</code> to designate this vocabulary. Note that, although Jo already imported the iCal vocabulary, adding the vCard vocabulary is just as easy and does not interfere:
        </p>

        <eg><![CDATA[<html xmlns:cal="http://www.w3.org/2002/12/cal/ical#"
      xmlns:contact="http://www.w3.org/2001/vcard-rdf/3.0#">
...]]></eg>

        <p> Jo then sets up her vCard using RDFa, by deciding that the
        <el>P</el> with <att>class</att> set to <att>contactinfo</att> will be
        the container for her vcard. She notes that the vCard schema does not
        require declaring a vCard type. Instead, it is recommended that a
        vCard refer to a web page that identifies the individual. Jo thus uses
        RDFa's special attribute <att>about</att> for just for this purpose,
        indicating that all contained XHTML pertains to Jo's designated URI.
        Note how the <att>about</att> attribute is inherited from parent
        elements in the XHTML: the <att>about</att> attribute on the nearest
        containing element applies. </p>

        <eg><![CDATA[...
    <p class="contactinfo" about="http://example.org/staff/jo">
        
        <!-- everything here pertains to http://example.org/staff/jo -->

    </p>
...]]></eg>

        <p>
            
            "Simple enough!" Jo realizes. She adds her first vCard fields: name, title, organization and email.
        </p>
        
        <eg><![CDATA[...
    <p class="contactinfo"  about="http://example.org/staff/jo">
        
        <span property="contact:fn">
            Jo Smith
        </span>.

        <span property="contact:title">
            Web hacker
        </span>

        at

        <a rel="contact:org" href="http://example.org">
            Example.org
        </a>.

        You can contact me

        <a rel="contact:email" href="mailto:jo@example.org">
            via email
        </a>.

    </p>
...]]></eg>

        <p> Notice how Jo was able to use the <att>rel</att> attribute
        directly within the anchor tag for designating her organization and
        email address. In this case, the <att>rel</att> indicates the type of
        <emph>relationship</emph> between the current URI, designated by
        <att>about</att>, and the target URI, designated by <att>href</att>.
        Specifically, <code>contact:org</code> indicates a relationship of
        type "vCard organization", while <code>contact:email</code> indicates
        a relationship of type "vCard email". </p>
        
         <p> For simplicity's sake, we have slightly abused the
        vCard vocabulary above: vCard technically requires that the
        <emph>type</emph> of the email address be specified, e.g. work or home
        email. In Section <specref ref="layered-data" />, we show how
        <att>rel</att> can be used without a corresponding <att>href</att>, in
        order to create subresources and provide the correct markup for
        expressing a true vCard. </p>
        
         </div2>
        
         <div2> <head>The Complete XHTML with RDFa</head>
        
         <p> Jo's complete XHTML with RDFa is thus: </p>

    <eg><![CDATA[<html xmlns:cal="http://www.w3.org/2002/12/cal/ical#"
      xmlns:contact="http://www.w3.org/2001/vcard-rdf/3.0#">
    <head><title>Jo's Friends and Family Blog</title></head>
    <body>
...
    <p instanceof="cal:Vevent">
        I'm holding
        <span property="cal:summary">
            one last summer Barbecue,
        </span>
        on
        <span property="cal:dtstart" content="20070916T1600-0500">
            September 16th at 4pm.
        </span>
    </p>
...
    <p class="contactinfo" about="http://example.org/staff/jo">
        <span property="contact:fn">
            Jo Smith
        </span>.
        <span property="contact:title">
            Web hacker
        </span>
        at
        <a rel="contact:org" href="http://example.org">
            Example.org
        </a>.
        You can contact me
        <a rel="contact:email" href="mailto:jo@example.org">
            via email
        </a>.
    </p>
...
    </body>
</html>
]]></eg>

         <p> If Jo changes her email address link, her organization, or the
         title of her talk, RDFa-enabled browsers will automatically pick up
         these changes in the marked up, structured data. The only places
         where this doesn't happen is when the <att>content</att> attribute
         must override the rendered content, which is inevitable when the
         human-rendered data and the machine-readable data must differ. </p>

         <p> (Once again, the RDF-inclined reader will want to consult the
        resulting RDF triples <specref ref="events-rdf-triples" />.) </p> </div2>
        <div2> <head>Working Within a Fragment of the XHTML</head>
        
         <p> What if Jo does not have complete control over the XHTML of her
        blog? For example, she may be using a templating system which makes it
        particularly difficult to add the vocabularies in the <el>html</el>
        element at the top of her page without adding it to every page on her
        site. Or, she may be using a web provider that doesn't allow her to
        change the header of the page to begin with. </p>
        
         <p> Fortunately, RDFa uses standard XML namespaces, which means that
        the vocabularies can be imported "locally" to an XHTML element. Jo's
        blog page could express the exact same structured data with the
        following markup: </p>

    <eg><![CDATA[<html>
    <head><title>Jo's Friends and Family Blog</title></head>
    <body>
...
    <p instanceof="cal:Vevent" xmlns:cal="http://www.w3.org/2002/12/cal/ical#">
        I'm holding
        <span property="cal:summary">
            one last summer Barbecue,
        </span>
        on
        <span property="cal:dtstart" content="20070916T1600-0500">
            September 16th at 4pm.
        </span>
    </p>
...
    <p class="contactinfo" about="http://example.org/staff/jo"
        xmlns:contact="http://www.w3.org/2001/vcard-rdf/3.0#">
        <span property="contact:fn">
            Jo Smith
        </span>.
        <span property="contact:title">
            Web hacker
        </span>
        at
        <a rel="contact:org" href="http://example.org">
            Example.org
        </a>.
        You can contact me
        <a rel="contact:email" href="mailto:jo@example.org">
            via email
        </a>.
    </p>
...
    </body>
</html>
]]></eg>
    
    <p>
        In this case, each <el>p</el> only needs one vocabulary: the first uses iCal, the second uses vCard. However, just as before, more than one vocabulary can be imported into any element. This makes copying and pasting XHTML with RDFa much easier. In particular, it allows web widgets to carry their own RDFa in a self-contained manner.
    </p>
        
    </div2>
    
</div1>
<!--
      <div1>
    <head>A Second Scenario: Publishing Photos</head>
    <div2>
      <head>The Shutr Photo Management System</head>
    <p>
      Consider a (fictional) photo management web site
      called <em>Shutr</em>, whose web site
      is <code>http://www.shutr.net</code>. Users of Shutr can upload
      their photos at will, annotate them, organize them into
      albums, and share them with the world. They can choose to
      keep these photos private, or make them available for public
      consumption under licensing terms of their choosing.
    </p>

    <p>
      The primary interface to Shutr is its web site and the HTML
      it delivers. Since photos are contributed by users with
      significant amount of built-in structured data (camera type,
      exposure, etc...) and additional, explicitly provided
      data (photo caption, license, photographer's name),
      Shutr may benefit from using RDF to express this structure.
    </p>

    <p>
      We explore how Shutr might use RDFa to express RDF right in the
      HTML it already publishes. We assume an additional XML
      namespace, <code>shutr</code>, which corresponds to
      URI <code>http://www.shutr.net/rdf/shutr#</code>.
    </p>
    <p>
      The simplest structured data Shutr might want to expose is basic
      information about a photo album: the creator of the album, the
      date of creation, and its license. We consider literal
      properties first, and URI properties second. (We ignore
      photo-specific data for now, as that involves RDF statements
      about an image, which is not an HTML document. We will, of
      course, get back to this soon.)
    </p>

    </div2>
    <div2>
      <head>Literal Properties</head>

      <p>
        A <em>literal property</em> is a string of text, e.g. "Ben
        Adida", a number, e.g. "28", or any other typed,
        self-contained datum that one might want to express as a
        property. In RDFa, literal properties are expressed using the <att>property</att> attribute and an optional <att>content</att> attribute.
      </p>

      <p>
        Consider Mark Birbeck, a user of the Shutr system with
        username <code>markb</code>, and his latest photo album
        "Vacation in the South of France." This photo album
        resides
        at <code>http://www.shutr.net/user/markb/album/12345</code>. The
        HTML document presented upon request of that URI includes
        the following HTML snippet:
      </p>

      <eg><![CDATA[<h1>Photo Album #12345: Vacation in the South of France</h1>
<h2>created by Mark Birbeck</h2>
]]></eg>

      <p>
        Notice how the rendered HTML contains elements of the
        photo album's structured data. Using RDFa, Shutr can
        mark up this HTML to indicate these structured data
        properties without repeating the raw data:
      </p>

      <eg><![CDATA[<h1>Photo Album #12345: <span property="dc:title">Vacation in the South of France</span></h1>
<h2>created by <span property="dc:creator">Mark Birbeck</span></h2>
]]></eg>

      <p>
        An RDFa-aware browser would thus extract the following
        RDF triples:
      </p>
      
      <eg><![CDATA[<> dc:title "Vacation in the South of France" .
<> dc:creator "Mark Birbeck" .
]]></eg>

      <p>
        When the existing HTML elements already delineate the exact structure, adding a new <el>span</el> element is not required. One can easily add the RDFa attributes to existing HTML elements:
      </p>

      <eg><![CDATA[<h1 property="dc:title">Vacation in the South of France</h1>
<h2>created by <span property="dc:creator">Mark Birbeck</span></h2>
]]></eg>

      <p>
        which yields the same RDF triples, of course. The use of an extra <el>span</el> is helpful when existing HTML markup isn't enough to isolate the rendered content that is relevant to the RDF triple.
      </p>

      <p>
        A reader who knows about XML datatypes might, at this
        point in the presentation, wonder what datatype these
        values will have. Given the above RDFa, "Vacation in the
        South of France" is a plain literal. In some cases, this
        may not be appropriate. Consider an expanded HTML snippet
        which includes the photo album's creation date:
      </p>

      <eg><![CDATA[<h1>Vacation in the South of France</h1>
<h2>created by Mark Birbeck on 2007-01-02</h2>
]]></eg>

      <p>
        A precise way to augment this HTML with RDFa is:
      </p>

      <eg><![CDATA[<h1 property="dc:title">Vacation in the South of France</h1>
<h2>created by <span property="dc:creator">Mark Birbeck</span>
    on <span property="dc:date" datatype="xsd:date">2007-01-02</span></h2>
]]></eg>

      <p>
        which would yield the following triples:
      </p>

      <eg><![CDATA[<> dc:title "Vacation in the South of France" .
<> dc:creator "Mark Birbeck" .
<> dc:date "2007-01-02"^^xsd:date .
]]></eg>
      
      <p>
        Going further, Shutr realizes
        that <code>2007-01-02</code>, while a correct xsd:date
        representation, is not exactly user-friendly. In this
        case, having the rendered data be the same as the
        structured data might not be the right answer. Shutr may
        instead opt for the following RDFa:
      </p>

      <eg><![CDATA[<h1 property="dc:title">Vacation in the South of France</h1>
<h2>created 
  by <span property="dc:creator">Mark Birbeck</span>
  on <span property="dc:date" datatype="xsd:date"
           content="2007-01-02">
    January 2nd, 2007
     </span>
</h2>
]]></eg>

      <p> The above HTML will render the date as "January 2nd, 2007" but will
      yield the exact same triples as above. The use of the <att>content</att>
      attribute should be limited to cases where the rendered text is not
      sufficiently structured to represent the data. </p>
      
       <p> If Shutr wants to indicate that a specific object, e.g. "Mark
      Birbeck", plays two different roles, e.g. creator and publisher, the
      markup can easily be updated to reflect this duality without repeating
      the data:</p>

      <eg><![CDATA[<h1 property="dc:title">Vacation in the South of France</h1>
created by <span property="dc:creator dc:publisher">Mark Birbeck</span>]]></eg>

      <p> In all of the above markup and triples, as well as in the rest of
      the document, we use the <code>dc:creator</code> predicate with both
      literals, e.g. strings, and URIs, e.g. names and "persons": both are
      allowed by the Dublin Core specification. We show in <specref
      ref="beyond-current-document" /> how to refer to fragments of a
      document, and in <specref ref="foaf" /> how to create deeper structures
      to address this type of issue. </p>

    </div2>

    <div2>
      <head>URI Properties</head>

      <p>
        A <em>URI property</em> is one that is merely a reference
        to a web-accessible resource, e.g. an image, a PDF
        document, or another HTML document, all reachable via the
        web. In RDFa, URI properties are expressed using the <att>rel</att>, <att>rev</att>, and <att>href</att> attributes. The <att>href</att> attribute is the well-understood target of a link, while <att>rel</att> indicates a <em>relationship</em>, and <att>rev</att> indicates a reverse relationship.
      </p>

      <p>
        Shutr may want to give its users the ability to
        license their photos to the world under certain specific
        conditions. For this purpose, there are numerous existing
        licenses, including those published by Creative
        Commons. Thus, if Mark Birbeck chooses to license his
        vacation album for others to reuse, Shutr might use the
        following HTML snippet:
      </p>

      <eg><![CDATA[This document is licensed under a
<a href="http://creativecommons.org/licenses/by-nc/2.5/">
  Creative Commons Non-Commercial License
</a>.
]]></eg>

      <p>
        This clickable link has an intended meaning: it
        is the document's license. Using RDFa can cement that
        meaning within the HTML itself:
      </p>

      <eg><![CDATA[This document is licensed under a
<a rel="cc:license"
   href="http://creativecommons.org/licenses/by-nc/2.5/">
  Creative Commons Non-Commercial License
</a>.
]]></eg>

      <p> Note the use of the <att>rel</att> attribute to indicate a URI
      property rather than a textual one. The use of this attribute goes hand
      in hand with an <att>href</att> attribute within the same element. This
      <att>href</att> attribute indicates the URI object of the RDF triple.
      Thus, the above RDFa yields the following triple: </p>

      <eg><![CDATA[<> cc:license <http://creativecommons.org/licenses/by-nc/2.5/> .
]]></eg>

      <p>
        It is worth noting that the <att>rel</att> attribute, like <att>property</att> and <att>class</att>, supports multiple values, separated by spaces. The triples generated are the same as if each value were declared independently.
      </p>

      <p> Compared with other existing RDF mechanisms to indicate Creative
      Commons licensing&mdash;e.g. a parallel RDF/XML file or inline RDF/XML
      within HTML comments&mdash;, the RDFa approach provides Creative Commons
      and Shutr with a significant integrity advantage: the clickable link
      <em>is</em> the semantic link, and any change to the target will change
      both the human and machine views. Also, a simple copy-and-paste of the
      HTML will carry through both the rendered and semantic data. The target
      URI may provide an HTML document which includes further RDFa statements.
      The Creative Commons license page, for example, may include RDFa
      statements about its legal details. </p>
      
      <p>
          The attribute <att>rev</att> can be used to express a relationship in the opposite direction. Consider, for example, a link from "Mark Birbeck"'s homepage to one of his many blog posts:
      </p>

<eg><![CDATA[<h1>Mark Birbeck</h1>
Author of <a href="http://internet-apps.blogspot.com/2007/06/yowl-open-source-centralised.html">Yowl</a>.
    ]]></eg>
 
    <p>
        The relationship <tt>dc:creator</tt> expects the work as the subject, and the creator as the object. Thus, the way to express this in XHTML+RDFa, starting with the template above, is:
    </p>

<eg><![CDATA[<h1>Mark Birbeck</h1>
Author of <a
           rev="dc:creator" 
           href="http://internet-apps.blogspot.com/2007/06/yowl-open-source-centralised.html">
              Yowl
          </a>.
    ]]></eg>

    </div2>
      </div1>
    -->
      <div1 id="advanced-concepts">
    <head>Advanced Concepts: Custom Vocabularies, Document Fragments, Complex Data, ...</head>


    <p> RDFa can do much more than the simple examples described above. In
    this section, we explore some of its advanced capabilities.
    We consider:
    <ul>
      <li> the creation of a custom vocabulary,</li>
      <li>the use of precise datatypes,</li>
      <li> the description of resources beyond the current web page, and</li>
      <li> the definition and annotation of "subresources".</li>
    </ul>
    </p>

    <div2> <head>Creating a Custom Vocabulary and Using Compact URIs</head>
    
     <p> All field names and data types in RDFa are URIs, e.g.
    <att>http://purl.org/dc/elements/1.1/title</att> is the "Dublin Core
    title" field. In RDFa, we often use compact versions of those URIs, by
</p>
    <ul>
    <li> defining a prefix using XML namespaces, and</li>
    <li> using the prefixed notation to
    designate the URI.</li>
    </ul>
    <p>This helps keep the markup short and clean: </p>
    
     <eg><![CDATA[<div xmlns:dc="http://purl.org/dc/elements/1.1/">

   <span property="dc:title">Yowl</span>,

   created by

   <span property="dc:creator">Mark Birbeck</span>.

</div> ]]></eg>

    <p> Because concepts are simply URIs, it is trivial to create one's own
    vocabulary: simply mint new URIs in a domain you control, and use them in
    RDFa markup. This is, in fact, the power of RDF, RDFa's underlying
    technology.</p>

    <p>
      Consider a (fictional) photo management web site
      called <em>Shutr</em>, whose web site
      is <code>http://www.shutr.net</code>. Users of Shutr can upload
      their photos at will, annotate them, organize them into
      albums, and share them with the world. They can choose to
      keep these photos private, or make them available for public
      consumption under licensing terms of their choosing.
    </p>

    <p> Shutr chooses to mark up its photos with RDFa, so that browsers may be able to extract information automatically. Some concepts,
    such as <att>dc:title</att>, <att>dc:date</att>, etc. can be clearly
    reused from the Dublin Core vocabulary, but other concepts, such as lens
    settings, camera model, and other photographer parameters, may need to be
    defined from scratch. For this purpose, Shutr defines a vocabulary
    namespace URI:</p>
    
     <p> <att>http://shutr.net/vocab/1.0/</att> </p>

     <p>
       Shutr can then publish terms such as <el>http://shutr.net/vocab/1.0/takenWithCamera</el>, <el>http://shutr.net/vocab/1.0/aperture</el>, etc.
     </p>
     
     </div2>
     <div2>
      <head>Qualifying Other Documents and Document Chunks</head>

      <p> Shutr may choose to present many photos in a given XHTML page. In
      particular, at the URI
      <code>http://www.shutr.net/user/markb/album/12345</code>, all of the
      album's photos will appear inline. Structured data about each photo can
      be included simply by specifying an <att>about</att> attribute, which
      indicates the resource that fields refer to within that XHTML element.
      </p>

      <eg><![CDATA[<ul>
  <li> <img src="/user/markb/photo/23456_thumbnail" />,
  
    <span about="/user/markb/photo/23456" property="dc:title">
      Sunset in Nice
    </span>
  
  </li>

  <li> <img src="/user/markb/photo/34567_thumbnail" />,

    <span about="/user/markb/photo/34567" property="dc:title">
      W3C Meeting in Mandelieu
    </span>

  </li>
</ul>
]]></eg>

      <p> This same approach applies when the field value is a URI. For
      example, each photo in the album has a creator and may have its own
      copyright license. We can use the convenient inheritance of the
      <att>about</att> attribute to refer to the photo once, and add as many fields as we need:</p>

      <eg><![CDATA[
<ul>
  <li about="/user/markb/photo/23456">
    
    <img src="/user/markb/photo/23456_thumbnail" />,
    
    <span property="dc:title">
      Sunset in Nice
    </span>
    
    taken by photographer
    
    <a property="dc:creator"
       href="/user/markb">
      Mark Birbeck
    </a>,
    
    licensed under a
    
    <a rel="cc:license"
       href="http://creativecommons.org/licenses/by-nc/3.0/">
      Creative Commons Non-Commercial License
    </a>.
    
  </li>

  <li about="/user/markb/photo/34567">
    
    <img src="/user/markb/photo/34567_thumbnail" /> 
    
    <span property="dc:title">
      W3C Meeting in Mandelieu
    </span>
    
    taken by photographer
    
    <a property="dc:creator"
       href="/user/stevenp">
         Steven Pemberton
    </a>,
    
    licensed under a
    
    <a rel="cc:license"
       href="http://creativecommons.org/licenses/by/3.0/">
         Creative Commons Commercial License
    </a>.
  
  </li>
</ul>
]]></eg>

      <p> While it makes sense for Shutr to have a whole web page dedicated to
      each photo album, it might not make as much sense to have a single page
      for each camera owned by a user. A single page that describes
      <em>all</em> cameras belonging to a single user is more appropriate. For
      this purpose, RDFa provides ways to mark up document fragments using
      natural XHTML constructs. </p>

      <p>
        Consider the
        page <code>http://www.shutr.net/user/markb/cameras</code>,
        which, as its URI implies, lists Mark Birbeck's
        cameras. Its XHTML contains:
      </p>
      
      <eg><![CDATA[<ul>
  <li id="nikon_d200"> Nikon D200, 3 pictures/second.
  </li>

  <li id="canon_sd550"> Canon Powershot SD550, 5 pictures/second.
  </li>
</ul>
]]></eg>
      
      <p>
        and the photo page will then include information about
        which camera was used to take each photo:
      </p>

      <eg><![CDATA[<ul>
  <li>
    <img src="/user/markb/photo/23456_thumbnail" />
    ...
    using the <a href="/user/markb/cameras#nikon_d200">Nikon D200</a>,
    ...
  </li>
...
</ul>
]]></eg>
      
      <p>
        The RDFa syntax for formally specifying the relationship
        is exactly the same as before, as expected:
      </p>

      <eg><![CDATA[
<ul>
  <li about="/user/markb/photo/23456">
    <img src="/user/markb/photo/23456_thumbnail" />
    ...
    using the <a rel="shutr:takenWithCamera" 
         href="/user/markb/cameras#nikon_d200">Nikon D200</a>,
    ...
  </li>
...
</ul>
]]></eg>

      <p>
        Then, the XHTML snippet at <code>http://www.shutr.net/user/markb/cameras</code> is:
      </p>

      <eg><![CDATA[
<ul>
  <li id="nikon_d200" about="#nikon_d200">
    
    <span property="dc:title">
      Nikon D200
    </span>
    
    <span property="shutr:shutterSpeed">
      3 pictures/second
    </span>
    
  </li>

  <li id="canon_sd550" about="#canon_sd550">

    <span property="dc:title">
      Canon Powershot SD550
    </span>

    <span property="shutr:shutterSpeed">
      5 pictures/second
    </span>

  </li>
</ul>
]]></eg>

    <p>
        Notice, again, how text can serve both for the human and machine readable versions: there is no need to keep a separate file up-to-date.
    </p>      
<!--
      <p>
        One immediately wonders whether the redundancy between
        the <att>about</att> and <att>id</att> attributes can be
        simplified. Partly for this purpose, RDFa includes
        elements <el>link</el> and <el>meta</el>. These elements are similar in function to <el>a</el> and
        <el>span</el> except for one special behavior: they only apply to their immediate parent
        element, even if an ancestor element bears an
        alternate <att>about</att> attribute.
      </p>

      <eg><![CDATA[
<ul>
  <li id="nikon_d200">
    <meta property="dc:title" datatype="xsd:string">
      Nikon D200
    </meta>
    purchased on
    <meta property="dc:date" datatype="xsd:date">
      2004-06-01
    </meta>
  </li>

  <li id="canon_sd550">
    <meta property="dc:title" datatype="xsd:string">
      Canon Powershot SD550
    </meta>
    purchased on
    <meta property="dc:date" datatype="xsd:date">
      2005-08-01
    </meta>
  </li>
</ul>
]]></eg>
      
      <p>
        One might now wonder how <el>meta</el> and <el>link</el>
        behave when their parent element doesn't have
        an <att>id</att> or <att>about</att> attribute. The result
        of such syntax is an RDF bnode, an advanced topic which we
        skip in this Primer.
      </p>
-->
    </div2>
      
<!--    <p>
      If the reader wishes only to embed simple, name-value pairs into
      an HTML document, this section is not required reading. However,
      many structured datasets quickly require some additional level
      of depth. In this section, we consider these more complex
      structures. One popular RDF vocabulary is FOAF
      <bibref ref="FOAF" />, which provides structure for social
      networking and personal information. FOAF is particularly
      interesting to consider because it provides deeper structure
      than the examples provided so far: a FOAF person has an office,
      which has an address, which has a street, city, zip code, and
      country. So far, we have only explained how to define structure
      "one-level deep."
</p>
-->

  <div2>
    <head>Data Types</head>

    <p> When dealing with fields of structured data, one may well want (or
    need) to specify a data type so that computer programs that read the data
    can make sense of it. Consider the expression of a date. We have already
    seen how the human-rendered and machine-readable data may not be the same,
    and how we can use <att>content</att> to provide a machine-readable value.
    Adding a datatype is only one more attribute: <att>datatype</att>. For
    example, when expressing the date on which a photo was taken:</p>

<eg><![CDATA[
    <ul>
      <li about="/user/markb/photo/23456">

        ...
        
        take on
        <span property="dc:date" content="2007-05-12" datatype="xsd:date">
          May 12th, 2007
        </span>

        ...
        
      </li>

    </ul>
]]></eg>

<p>
  Note how we use XML data types.
</p>

  </div2>
  

  <div2>
    <head>Layers of Structure &mdash; Subresources</head>
    
    <p>
        Sometimes, one may need to mark up a resource with a number of fields, all without giving it a URL, or even a fragment identifier. Consider the case where Shutr decides to let users annotate photos in order to indicate which individuals are depicted in the photo. The barebones XHTML is:
    </p>

<eg><![CDATA[This photo depicts Mark Birbeck (mark@example.org) and Steven Pemberton (steven@example.org).
]]></eg>

    <p>
        The simplest way to mark this up without attempting to resolve unique identities for photo subjects is to define <em>subresources</em>, effectively new resources that are not given a name. (In RDF, we call these blank nodes.) The following markup will do just that, thanks to the FOAF (Friend-Of-A-Friend) vocabulary which includes the handy field <code>foaf:depicts</code> for just this purpose:
    </p>

    <eg><![CDATA[<div about="/user/markb/photo/23456">
  This photo depicts

  <span rel="foaf:depicts">
    <span property="foaf:firstname">Mark</span>
    <span property="foaf:lastname">Birbeck</span>
    (<span property="foaf:mbox">mark@example.org</span>)
  </span>
 
  and
 
  <span rel="foaf:depicts">
    <span property="foaf:firstname">Steven</span>
    <span property="foaf:lastname">Pemberton</span>
    (<span property="foaf:mbox">steven@example.org<span>).
  </span>

</div>
]]></eg>
    
    <p>
        The use of the <att>rel</att> attribute without an <att>href</att> triggers the definition of a new subresource, which is then the value of the <code>foaf:depicts</code> field. Then, all contained markup applies to this new subresource. In RDFa-speak, we call this "chaining," as it allows one to easily chain one resource to a subresource.
    </p>
  </div2>
  
  <div2>
      <head>Using <att>src</att> on <el>IMG</el>, and the <att>rev</att> attribute</head>
      
      <p>
          Shutr may notice that, in a number of cases, the URI of the photos it displays inline using the <el>IMG</el> element is actually the same as the <att>about</att> attribute for marking up the photo's fields. In order to minimize markup, RDFa allows Shutr to make use of the <att>src</att> attribute on an <el>IMG</el> element: it behaves just like <att>href</att>.
      </p>
      
      <p>
          Consider Mark's profile page on Shutr, which lists all of his albums and cameras. This page will likely include a picture of Mark himself:
      </p>
      
    <eg><![CDATA[<div>
        <h1>Mark Birbeck's Photos</h1>
        <img src="/user/markb/profile_photo.jpg" />
  ...
</div>
]]></eg>

    <p>
        Shutr may want to indicate that this is Mark's photo, using the FOAF field <code>foaf:img</code> defined specifically for this purpose. This can be accomplished as follows:
    </p>

    <eg><![CDATA[<div about="/user/markb">
        <h1>Mark Birbeck's Photos</h1>
        <img rel="foaf:img" src="/users/markb/profile_photo.jpg" />
  ...
</div>
]]></eg>

    <p>
        Shutr then notes that the profile photo isn't only Mark's profile photo, it also happens to depict Mark, since Mark obviously appears in his own profile photo (hopefully). This requires expressing an <emph>inverse relationship</emph>, where the field is actually added to the image's URI, not to Mark's profile.
    </p>
    
    <p>
        For this purpose, Shutr uses the <att>rev</att> attribute, which can be used on <el>IMG</el> or any other element. The attribute <att>rev</att> functions much like <att>rel</att>, except the opposite relationship is expressed:
    </p>

    <eg><![CDATA[<div about="/user/markb">
        <h1>Mark Birbeck's Photos</h1>
        <img rel="foaf:img" rev="foaf:depicts" src="/user/markb/profile_photo.jpg" />
  ...
</div>
]]></eg>

    <p>
        In other words, Mark has, as his main image, <code>/user/markb/profile_photo.jpg</code>, which of course happens to depict Mark.
    </p>
  </div2>
  
  <div2>
      <head>Overriding <att>href</att></head>

      <p> When the displayed content is not quite the correct machine-readable
      data, we used the <att>content</att> attribute to override it. In some
      cases, the clickable link is not quite the right machine-readable data,
      either. Consider, for example, the case where the displayed photo on
      Mark Birbeck's profile is, in fact, just a thumbnail, while his official
      FOAF image is the full-sized version. In this case, and in any case
      where <att>href</att> or <att>src</att> appears and needs to be
      overridden by another URI, RDFa offers the attribute
      <att>resource</att>.</p>

      <p>
          The XHTML written above can then be transformed to:
      </p>

    <eg><![CDATA[<div about="/user/markb">
        <h1>Mark Birbeck's Photos</h1>
        <img rel="foaf:img"
             resource="/user/markb/profile_photo.jpg"
             src="/user/markb/profile_photo_thumbnail.jpg" />
  ...
</div>
]]></eg>

    <p>
        Here, the loaded image will the thumbnail, but an RDFa-aware browser will know that the machine-readable data only cares about the full-sized version specified in <att>resource</att>.
    </p>
    
    <p> The <att>resource</att> attribute can be particularly useful in cases
    where the URI is not clickable in any way, e.g. a book's ISBN number represented as <code>URN:ISBN:0-395-36341-1</code>.</p>
    
     </div2>
    
     </div1> <div1 id="rdf-triples"> <head>RDF Correspondence</head>

    <p> RDF <bibref ref="RDF" /> is the W3C's standard for interoperable
    structured data. Though one need not be versed in RDF to understand the
    basic concepts of RDFa, it helps to know that RDFa is effectively the
    embedding of RDF in XHTML. </p>
    
     <p> Briefly, RDF is an abstract generic data model. An RDF statement is a
    triple, composed of a subject, a predicate, and an object. For example,
    the following triple has <att>/photos/123</att> as subject, <att>dc:title</att> as predicate, and the literal "Beautiful Sunset" as object:</p>

<eg><![CDATA[  </photos/123> dc:title "Beautiful Sunset" .
]]></eg>

    <p> A triple effectively relates its subject and object by its predicate:
    the document <att>/photos/123</att> has, as title, "Beautiful Sunset".
    Structured data in RDF is represented as a set of triples. The notation
    above is called N3 <bibref ref="N3" />. URIs are written using angle
    brackets, literals are written in quotation marks, and compact URIs are
    written directly. </p>
    
     <p> All subjects and predicates are nodes, while objects can be nodes or
    literals. Nodes can be URIs, or they can be blank, in which case they are
    not addressable by other documents. Blank nodes, denoted
    <code>_:bnodename</code>, are particularly useful when expressing layered
    data without having to assign URIs to intermediate nodes.</p>

      <div2 id="events-rdf-triples">
          <head>Events and Contact Information</head>

  	<p>
  	  In Section <specref ref="publishing-an-event" />, Jo
            published an event without giving it a URI. The RDF triples extracted from her markup are:
  	</p>

          <eg><![CDATA[_:bn0
       rdf:type cal:Vevent; 
       cal:summary "last summer Barbecue";
       cal:dtstart "20070916T1600-0500" .]]></eg>

          <p>
              In Section <specref ref="publishing-contact-info" />, Jo published contact information. The RDFa is parsed to generate the following RDF triples:
          </p>

          <eg><![CDATA[<http://example.org/staff/jo>
         contact:fn "Jo Smith";
         contact:title "Web Hacker";
         contact:org <http://example.org>;
         contact:email <mailto:jo@example.org>.
          ]]></eg>

      </div2>

      <div2 id="shutr-triples">
        <head>Simple Shutr Data</head>

        <p> The XHTML+RDFa in the first Shutr example yields the following
        triples: </p>

<eg><![CDATA[</user/markb/photo/23456> dc:title "Sunset in Nice" .
              
</user/markb/photo/34567> dc:title "W3C Meeting in Mandelieu" .
]]></eg>

        <p>
          The more complete example, including licensing information, yields the following triples:
      </p>

<eg><![CDATA[</user/markb/photo/23456>
    dc:title "Sunset in Nice" ;
    dc:creator "Mark Birbeck" ;
    cc:license <http://creativecommons.org/licenses/by-nc/3.0/> .

</user/markb/photo/34567>
    dc:title "W3C Meeting in Mandelieu" ;
    dc:creator "Steven Pemberton" ;
    cc:license <http://creativecommons.org/licenses/by/3.0/> .
]]></eg>
        
        
        <p>
          The example that links a photo to the camera it was taken with corresponds to the following triple:
        </p>

<eg><![CDATA[</user/markb/photo/23456> shutr:takenWith </user/markb/cameras#nikon_d200> .
]]></eg>

  <p>
    while the complete camera descriptions yields:
  </p>

<eg><![CDATA[<#nikon_d200>
  dc:title "Nikon D200" ;
  shutr:shutterspeed "3 pictures/second" .

<#canon_sd550>
  dc:title "Canon SD550" ;
  shutr:shutterspeed "5 pictures/second" .
]]></eg>

  <p>
    Finally, the <att>datatype</att> attribute indicates a datatype as follows:
  </p>

<eg><![CDATA[</user/markb/photo/23456> dc:date "2007-05-12"^^xsd:date .
]]></eg>

      </div2>
    <div2 id="layered-data">
      <head>Layered Data and Subresources</head>

        <p>
            The subresources example, with photos annotated with the individuals depicted, correspond to RDF bnodes as follows:
        </p>

<eg><![CDATA[</user/markb/photo/23456>
    foaf:depicts _:span0 ;
    foaf:decpits _:span1 ;
    
_:span0
    foaf:firstname "Mark" ;
    foaf:lastname "Birbeck" ;
    foaf:mbox "mark@example.org" .

_:span1
    foaf:firstname "Steven" ;
    foaf:lastname "Pemberton" ;
    foaf:mbox "steven@example.org" .
]]></eg>

<p>
    Note specifically how the bnode, in this example, is both the object of a first triple, and the subject of a number of follow-up triples. This is specifically the point of the layered markup approach: to create an unnamed subresource.
</p>        
    </div2>

    <div2 id="">
        <head>Using <att>src</att> on <el>IMG</el>, and the <att>rev</att> attribute</head>
        <p>
            The use of <att>src</att> on an image yields exactly the same triple as if the <att>src</att> were <att>href</att>:
        </p>
        
<eg><![CDATA[</user/markb> foaf:img </user/markb/profile_photo.jpg> .
]]></eg>

    <p>
        The <att>rev</att> attribute specifies a triple with the subject and object reversed:
    </p>

    <eg><![CDATA[</user/markb> foaf:img </user/markb/profile_photo.jpg> .
    
</user/markb/profile_photo.jpg> foaf:depicts </user/markb> .
]]></eg>
    
    </div2>
    
    <div2 id="clickable-vs-nonclickable">
     <head>Overriding <att>href</att></head>
     
    <p>
        Where <att>resource</att> is present, the same triples are generated, with the value of <att>resource</att> replacing the value of <att>href</att>. Even though the <att>href</att> points to <code>/user/markb/profile_photo_thumbnail.jpg</code>, the corresponding triple is:
    </p>

<eg><![CDATA[</user/markb> foaf:img </user/markb/profile_photo.jpg> .
]]></eg>

    </div2>
  </div1>
  <div1>
    <head>Case Studies</head>
    
    <p>
        A number of RDFa Case Studies are under development and available at <code><a href="http://rdfa.info/rdfa-case-studies/">http://rdfa.info/rdfa-case-studies/</a></code>.
    </p>
<!--
      <div2 id="foaf">
      <head>FOAF</head>
      <p>
        Consider, specifically, that Tim Berners-Lee is encouraging folks to publish a FOAF file. Let's express (a portion of) Tim's FOAF file using RDFa. We start with a portion of Tim's homepage:
      </p>

      <eg><![CDATA[<dl>
     <dt>Email</dt>
     <dd>timbl@w3.org</dd>

     <dt>Address</dt>
     <dd>
      77 Massachusetts Ave.<br />
        MIT Room 32-G524<br />
      Cambridge MA 02139<br />
      USA
     </dd>

     <dt>Phone</dt>
     <dd>+1 (617) 253 5702</dd>

     <dt>Fax:</dt>
     <dd>+1 (617) 258 5999</dd>
    </dl>]]></eg>

      <p>
        We can easily mark up the "one-layer deep" structure, specifically
        the email, phone, and fax fields with
        properties <att>foaf:mailbox</att>, <att>foaf:phone</att>,
        and <att>foaf:fax</att>:
      </p>

      <eg><![CDATA[<dl instanceof="foaf:Person" about="#card" id="card">
     <dt>Email</dt>
     <dd property="foaf:mbox">timbl@w3.org</dd>

    ...

     <dt>Phone</dt>
     <dd property="foaf:phone">+1 (617) 253 5702</dd>

     <dt>Fax:</dt>
     <dd property="foaf:fax">+1 (617) 258 5999</dd>
    </dl>]]></eg>

      <p>
        Now, we need to express the address information in relation to
        Tim, as well as the address's properties, e.g. street address,
        city, state, etc. Recall that, when referencing another named
        resource, we've used the <att>rel</att> attribute. For example, to
        describe the licensing of a document, we've used the markup:
      </p>

      <eg><![CDATA[This document is licensed under a
    <a rel="cc:license" href="http://creativecommons.org/licenses/by/2.5/">
      Creative Commons License
    </a>
    ]]></eg>

      <p>
        What we need to do here is describe a relationship
        of <att>foaf:address</att> between Tim and some <em>unnamed</em>
        node of data, off which we want to hang additional
        properties. Thus, we use the <att>rel</att> attribute again, this
        time <em>without a corresponding <att>href</att></em>.
      </p>

      <eg><![CDATA[...
     <dt>Address</dt>
     <dd rel="foaf:address">
      77 Massachusetts Ave.<br />
      MIT Room 32-G524<br />
      Cambridge MA 02139<br />
      USA
     </dd>

    ...
    </dl>]]></eg>

      <p>
        The HTML element on which this <att>rel</att> is expressed, in
        this case <att>dd</att>, then represents a <em>blank node</em> (in
        RDF terminology) that is the object of
        the <code>foaf:address</code> relationship. In addition, the
        subject of all contained RDFa statements is transparently set to
        be this blank node, as if there were an
        implicit <att>about</att>. This then allows the following markup
        to say exactly what we mean:
      </p>

      <eg><![CDATA[<dl instanceof="foaf:Person" about="#card" id="card">
    ...
     <dt>Address</dt>
     <dd rel="foaf:address">
      <span property="foaf:address_line_1">77 Massachusetts Ave.</span><br />
        <span property="foaf:address_line_2">MIT Room 32-G524</span><br />
      <span property="foaf:city">Cambridge</span> MA 02139<br />
      <span property="foaf:country">USA</span>
     </dd>
    ...
    </dl>]]></eg>

    <p>
      When interpreted as RDF, the use of the <att>rel</att> attribute
      without a corresponding <att>href</att> creates a new RDF blank
      node. Specifically, in the first example where Tim publishes a
      single address, the triples are:
    </p>

      <eg><![CDATA[<#card> rdf:type foaf:Person .
    <#card> foaf:address _:dd0 .

    _:dd0 foaf:address_line_1 "77 Massachusetts Avenue" .
    _:dd0 foaf:address_line_2 "MIT Room 32G-524" .
    _:dd0 foaf:city "Cambridge" .
    _:dd0 foaf:country "USA" .
    ]]></eg>

      <p>
        In the case of the multiple addresses, the triples become:
      </p>

      <eg><![CDATA[<#card> rdf:type foaf:Person .
    <#card> foaf:office _:dd0 .
    <#card> foaf:home _:dd1 .

    _:dd0 foaf:address _:div0 .

    _:div0 foaf:address_line_1 "77 Massachusetts Avenue" .
    _:div0 foaf:address_line_2 "MIT Room 32G-524" .
    _:div0 foaf:city "Cambridge" .
    _:div0 foaf:country "USA" .

    _:dd1 foaf:address _:div1 .

    _:div1 foaf:address_line_1 "1 Web Way" .
    _:div1 foaf:city "Cambridge" .
    _:div1 foaf:country "USA" .
    ]]></eg>


      <p>
        This layering of structured data easily extends to multiple
        layers. Consider what Tim might do if he were to list both his
        home and office addresses. The properties <code>foaf:office</code>
        and <code>foaf:home</code> each relate a <code>foaf:Person</code>
        to a location, and each location has an address. Thus, the markup
        becomes, quite naturally:
      </p>

      <eg><![CDATA[<dl instanceof="foaf:Person" about="#card" id="card"> ...
     <dt>Office Address</dt>
     <dd rel="foaf:office">
       <div rel="foaf:address">
         <span property="foaf:address_line_1">77 Massachusetts Ave.</span><br />
         <span property="foaf:address_line_2">MIT Room 32-G524</span><br />
         <span property="foaf:city">Cambridge</span> MA 02139<br />
         <span property="foaf:country">USA</span>
       </div>
     </dd>

     <dt>Home Address</dt>
     <dd rel="foaf:home">
       <div rel="foaf:address">
         <span property="foaf:address_line_1">1 Web Way</span><br />
         <span property="foaf:city">Cambridge</span> MA 02139<br />
         <span property="foaf:country">USA</span>
       </div>
     </dd>
    ...
    </dl>]]></eg>

      <p>
        Using this technique, it is relatively easy and natural to express fairly extensive and complex structured data.
      </p>

      </div2>

        <div2>
          <head>Naming the Nodes</head>

          <p>
            In most cases, it is neither useful nor desired to make the
            internal components of the structured data accessible by the
            outside world. For example, there is likely no good reason for
            Tim to give his office address a URI which other RDF statements
            might reference. Simply handing out his FOAF URI is enough.
          </p>

          <p> However, in some cases, it may in fact be useful to name all
          components yet to continue to use the <att>rel</att> chaining to designate
          the structured relationship. RDFa allows this as naturally as possible: one can simply add the <att>href</att> attribute back in. Chaining will still occur. If <att>href</att> appears on an element other than <el>A</el>, it will, of course, not be clickable. However, the value of the <att>href</att> becomes the intermediate node: the object of the parent triple, and the subject of all the child triples.
          </p>

          <p>
            For example, if Tim chose the following markup:
          </p>

        <eg><![CDATA[<dl class="foaf:Person" about="#card" id="card">
      ...
       <dt>Address</dt>
       <dd rel="foaf:address" href="#address">
        <span property="foaf:address_line_1">77 Massachusetts Ave.</span><br />
          <span property="foaf:address_line_2">MIT Room 32-G524</span><br />
        <span property="foaf:city">Cambridge</span> MA 02139<br />
        <span property="foaf:country">USA</span>
       </dd>
      ...
      </dl>]]></eg>

        <p>
          the triples would then become:
        </p>

        <eg><![CDATA[<#card> rdf:type foaf:Person .
      <#card> foaf:address <#address> .

      <#address> foaf:address_line_1 "77 Massachusetts Avenue" .
      <#address> foaf:address_line_2 "MIT Room 32G-524" .
      <#address> foaf:city "Cambridge" .
      <#address> foaf:country "USA" .
      ]]></eg>

        <p>
          Note that this doesn't change anything significant about the
          structured data itself, only that the address is now addressable
          by other structured data statements.
        </p>
</div2>
-->
  </div1>
  <div1>
      <head>Acknowledgments</head>
    <p>
      This document is the work of the RDF-in-HTML Task Force, including (in alphabetical order) Ben Adida, Mark Birbeck, Jeremy Carroll, Michael Hausenblas, Steven Pemberton, Ralph Swick, and Elias Torres. This work would not have been possible without the help of the Semantic Web Deployment and Best Practices Working Group and the subsequent Semantic Web Deployment Working Group, in particular chairs Guus Schreiber and David Wood, and Ivan Herman, head of the Semantic Web Activity. Earlier versions of this document were officially reviewed by Gary Ng and David Booth, both of whom provided insightful comments that significantly improved the work. Manu Sporny provided crucial feedback in the end stages.
    </p>
  </div1>
  <div1>
    <head>Bibliography</head>
        <blist>
    <bibl id="FOAF" href="http://www.foaf-project.org/">The Friend of a Friend (FOAF) Project</bibl>
          <bibl id="RDFHTML" href="http://www.w3.org/2001/sw/BestPractices/HTML/">RDF-in-HTML Task Force</bibl>
          <bibl id="SWD-WG" href="http://www.w3.org/2006/07/SWD/">Semantic Web Best Deployment Working Group</bibl>
          <bibl id="SWBPD-WG" href="http://www.w3.org/2001/sw/BestPractices/">Semantic Web Best Practices and Deployment Working Group</bibl>
          <bibl id="HTML-WG" href="http://www.w3.org/MarkUp/Group/">HTML Working Group</bibl>
          <bibl id="ICAL-RDF" href="http://www.w3.org/TR/rdfcal/">RDF Calendar Interest Group Note</bibl>
          <bibl id="VCARD-RDF" href="http://www.w3.org/TR/vcard-rdf">Representing vCard Objects in RDF/XML</bibl>
        </blist>
      </div1>
      
    </body>
</spec>
