<?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 RDF in XHTML</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/20070305/">http://www.w3.org/2006/07/SWD/RDFa/primer/20070305/</loc> $Id: Overview.xml,v 1.1 2007/03/05 19:09:29 adida Exp $
        </publoc>
        <prevlocs>
<loc href="http://www.w3.org/2006/07/SWD/RDFa/primer/20070302/">http://www.w3.org/2006/07/SWD/RDFa/primer/20070302/</loc>
        </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 HTML, contain significant
                inherent structured data. When publishers can express this
                data more completely, and when tools can read it, 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 user's
                desktop calendar. A license on a document can be detected so
                that the user is informed of his rights automatically. A
                photo's creator, camera setting information, resolution, and
                topic can be published as easily as the original photo itself,
                enabling structured search and sharing.
            </p>
            <p>
                RDFa is a syntax for expressing this structured data in
                XHTML. The rendered, hypertext data of XHTML is reused
                by the RDFa markup, so that publishers don't repeat
                themselves. The underlying abstract representation is
                RDF, which lets publishers build their own vocabulary,
                extend others, and evolve their vocabulary with
                maximal interoperability over time. The expressed
                structure is closely tied to the data, so that
                rendered data can be copied and pasted along with its
                relevant structure.
            </p>

            <p>
              This document is an introduction to RDFa. 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/2001/sw/BestPractices/HTML/2006-04-24-rdfa-primer">Working Draft #2</a> of this document:
	    <ul>
	      <li> the section on CURIEs has been removed, as it will be better addressed in the Syntax Document without too much upfront confusion.</li>
	      <li> the <att>role</att> attribute is no longer used to declare <code>rdf:type</code>, as this was rushed out before the group agreed on the syntax. We now use the <att>class</att> attribute.</li>
	      <li> the use of <att>link</att> and <att>meta</att> in the body is not mentioned anymore in this Primer, because this may confuse folks working on XHTML 1.1 and earlier.</li>
	      <li> the new syntax for striping is introduced.</li>
	    </ul>
	  </p>
	</changes>
        <languages>
            <language>en</language>
        </languages>
        <revisiondesc>
            <p>
                <emph>Last Modified: $Id: Overview.xml,v 1.1 2007/03/05 19:09:29 adida Exp $</emph>
            </p>
        </revisiondesc>
    </header>
    <body>
      <div1>
  <head>Purpose of RDFa and Preliminaries</head>
  <p>
      Current web pages, written in HTML, contain significant inherent
      structured data. When publishers can express this data more completely,
      and when tools can read it, 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
      user's desktop calendar. A license on a document can be detected so that
      the user is informed of his rights automatically. A photo's creator,
      camera setting information, resolution, and topic can be published as
      easily as the original photo itself, enabling structured search and
      sharing.
  </p>

  <p> RDFa is a syntax that expresses this structured data using a set of
  elements and attributes that embed RDF in HTML. An important goal of RDFa is
  to achieve this RDF embedding without repeating existing HTML content when
  that content <em>is</em> the structured data. RDFa is designed to work with
  different XML dialects, e.g. XHTML1, SVG, etc., given proper schema
  additions. In addition, RDFa is defined so as to be compatible with non-XML
  HTML.</p>

  <p> An XHTML document marked up with RDFa constructs should validate, and a
  non-XML HTML document marked up with RDFa remains compliant. RDFa uses
  existing HTML constructs and HTML-compatible extensions to specify RDF
  'content'. It is not about embedding RDF/XML syntax into HTML documents.
  </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>

  <div2>
    <head>Audience</head>
    <p>
      The audience for this document should have a working
      knowledge of XHTML. Some familiarity with RDF is useful,
      though the basics can be picked up from reading this
      Primer. Similarly, the basic XML concepts used in this
      work&mdash;in particular namespaces&mdash; can be picked
      up from reading this Primer.
    </p>
  </div2>

<!--  <ednote><name>Ben</name><date>2006-10-21</date>
    <edtext>
We may want to reference other RDF documents here, like N3 or Turtle notation (as per LeeF's comments).
    </edtext>
  </ednote>-->
      </div1>
      <div1>
  <head>A First Scenario: Publishing Events and Contacts</head>
    <p>
        Jo blogs about her work, which involves web development.
    </p>
    
    <div2>
        <head>The Basic HTML</head>
        <p>
            Jo has an upcoming talk at the XTech Conference, on May
            8th at 10am, where she will be discussing "web
            widgets". She blogs an announcement of her talk
            at <code>http://jo-blog.example.org/</code>. Her blog also
            includes her contact information (Jo has a fantastic spam
            filter, so she is unafraid of publishing her email
            address):
        </p>
    <eg><![CDATA[<html>
    <head><title>Jo's Blog</title></head>
    <body>
...
    <p>
        I'm giving a talk at the XTech Conference about web widgets, on May 8th at 10am.
    </p>
...
    <p class="contactinfo">
        My name is Jo Smith. I'm a distinguished web engineer
        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 is already full of structured data.
    </p>
    
    <p>
  The markup describes an <em>event</em>: a talk that Jo
  is giving. This event <em>starts</em> at 10am on
  May 8th. A <em>summary</em> of the event is "a talk
  at XTech 2007 on web widgets." We also have contact information for Jo: she works for the <em>organization</em> Example.org,
  with <em>job title</em> of "Distinguished Web
  Engineer." 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 implicit
  data. We need a standard mechanism to explicitly express it. This is
  precisely where RDFa comes in.
  </p>
    </div2>
    
    <div2 id="publishing-an-event">
      <head>Publishing An Event</head>
      
      <p>
        Jo would like to add some structure to this blog entry so that
        readers of her blog might be able to add her talk directly to
        their calendar. RDFa allows her to do just that, using 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 HTML page, so that a parser may know where to look up the vocabulary terms:
      </p>
      
        <eg><![CDATA[<html xmlns:cal="http://www.w3.org/2002/12/cal/ical#">
...]]></eg>
        
        <p>
            then, Jo declares a new event and gives it a name:
        </p>
        
        <eg><![CDATA[   <p class="cal:Vevent" id="xtech_conference_talk">
        ...
   </p> 
]]></eg>

        <p>
          Note how the <att>class</att> attribute is used here to define the type of the data being expressed, exactly as this attribute was initially intended in HTML. (If Jo wanted to declare multiple types, she could include more than one value in the <att>class</att> attribute with space separation.) Now, Jo wants to make sure that all information within this <el>p</el> describe the event itself. She adds an additional attribute:
        </p>

        <eg><![CDATA[   <p class="cal:Vevent" id="xtech_conference_talk" about="#xtech_conference_talk">
        ...
   </p> 
]]></eg>

        <p>
            then, inside this event declaration, Jo can set up the event fields, reusing the existing HTML. For example, the event summary can be declared as:
        </p>

        <eg><![CDATA[       I'm giving <span property="cal:summary">a talk at the XTech Conference about web widgets</span>,
]]></eg>

        <p>
          The <att>property</att> attribute on the <el>span</el> element declares a data field that pertains to the closest declared <att>about</att>, in this case the <code>Vevent</code> declared in the <el>p</el>. Note how the existing rendered content, "a talk at the XTech Conference about web widgets", is the value of this field. Sometimes, this isn't the right thing. Specifically, the start time of the event should be rendered nicely &mdash; "May 8th" &mdash;, but should likely be represented in an easy, machine-parsable way, the standard iCal format: <code>20070508T1000+0200</code>. In this case, the markup needs only a slight modification:
        </p>
        
        <eg><![CDATA[       <span property="cal:dtstart" content="20070508T1000+0200">May 8th at 10am</span>
]]></eg>
  
  <p>
    In this case, the actual content of the <el>span</el> element, "May 8th at 10am", is ignored for structured data purposes: 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 Blog</title></head>
    <body>
...
    <p class="cal:Vevent" about="#xtech_conference_talk">
        I'm giving
        <span property="cal:summary">
            a talk at the XTech Conference about web widgets
        </span>,
        on 
        <span property="cal:dtstart" content="20070508T1000+0200">
            May 8th at 10am
        </span>.
    </p>
...
    </body>
</html>
]]></eg>
        
    <p>
        The above markup can be interpreted now as a set of RDF triples, the details of which we we explain in Section <specref ref="rdf-triples" />.
    </p>

    <p>
      Note that Jo could have used any other HTML element, not just <el>span</el>, to carry the structure of her data. In other words, when the structure of the data is already laid out in the HTML using elements such as <el>h1</el>, <el>em</el>, <el>div</el>, etc..., Jo can simply add the <att>property</att> attribute, and optionally the <att>content</att> attribute, to indicate the specific structure.
    </p>
    
    </div2>
    <div2 id="publishing-contact-info">
        <head>Publishing Contact Information</head>
        
        <p>
            Now that Jo has published an event using structured data, 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 for structured markup with RDFa:
        </p>
        
        <eg><![CDATA[...
    <p class="contactinfo">
        My name is Jo Smith. I'm a distinguished web engineer
        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
        appropriate <el>p</el> will be her vcard. She notes, however, 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 HTML pertain to
        Jo's designated URL. Note how the <att>about</att> attribute is
        inherited from parent elements in the HTML: the <att>about</att>
        attribute on the nearest ancestor applies to declared structured data.
        </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">
        My name is
        <span property="contact:fn">
            Jo Smith
        </span>.
        I'm a
        <span property="contact:title">
            distinguished web engineer
        </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 a <emph>relationship</emph> between the current URL, designated by <att>about</att>, and the target URL, designated by <att>href</att>. The exact meaning of this relationship is defined by the <att>rel</att>. In this case, <code>contact:org</code> indicates the relationship of "vCard organization", while <code>contact:email</code> indicates the relationship of "vCard email".
        </p>
        
    <p>
      The <att>rel</att> attribute is naturally paired with the <att>href</att> attribute, much like the <att>property</att> attribute is paired with the <att>content</att> attribute. The astute reader will notice that we have defined what happens when a <att>property</att> attribute is present without a <att>content</att> attribute, but not what happens when a <att>rel</att> attribute is present without its corresponding <att>href</att>. We explore this feature in Section <specref ref="foaf" />.
    </p>
        
    <p>
            (The above example slightly simplifies the vCard vocabulary where <code>email</code> is concerned, since vCard technically requires indicating the <emph>type</emph> of the email. This simplification is for clarity's sake.)
        </p>

    </div2>
    
    <div2>
        <head>The Complete HTML with RDFa</head>
        
        <p>
            Jo's complete HTML 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#">
...
    <p class="cal:Vevent" about="#xtech_conference_talk">
        I'm giving
        <span property="cal:summary">
            a talk at the XTech Conference about web widgets
        </span>,
        on
        <span property="cal:dtstart" content="20070508T1000+0200">
            May 8th at 10am
        </span>.
    </p>
...
    <p class="contactinfo" about="http://example.org/staff/jo">
        My name is
        <span property="contact:fn">
            Jo Smith
        </span>.
        I'm a
        <span property="contact:title">
            distinguished web engineer
        </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>
            Note how, if Jo changes her email address link, her organization, or the title of her talk, the RDFa approach 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>
            The RDF triples generated by the above markup are detailed in Section <specref ref="rdf-triples" />.
        </p>
    </div2>
    <div2>
        <head>RDFa with Limited HTML control</head>
        
        <p>
            What if Jo does not have complete control over the HTML 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 blogging 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 HTML element. Jo's HTML blog page could express the exact same structured data with the following markup:
        </p>

        <eg><![CDATA[<html>
...
    <p class="cal:Vevent" about="#xtech_conference_talk"
       xmlns:cal="http://www.w3.org/2002/12/cal/ical#">
        I'm giving
        <span property="cal:summary">
            a talk at the XTech Conference about web widgets
        </span>,
        on
        <span property="cal:dtstart" content="20070508T1000+0200">
            May 8th at 10am
        </span>.
    </p>
...
    <p class="contactinfo" about="http://example.org/staff/jo"
       xmlns:contact="http://www.w3.org/2001/vcard-rdf/3.0#">
        My name is
        <span property="contact:fn">
            Jo Smith
        </span>.
        I'm a
        <span property="contact:title">
            distinguished web engineer
        </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>
        Of course, just like in the case of the vocabularies defined on the top-level <el>html</el> tag, more than one vocabulary can be imported into any element. In this case, each <el>p</el> only needs one vocabulary: the first uses iCal, the second uses vCard. This approach helps with the desired ability to copy-and-paste HTML from one page to another: the closer the namespace declarations to their relevant statements, the easier it is to copy and paste the content.
    </p>
        
    </div2>
    
    <div2 id="rdf-triples">
        <head>The RDF Triples</head>
        
        <p>
	  RDFa is parsed to generate RDF triples, which we denote
            using N3 notation <bibref ref="N3" />. URIs are written
            using angle brackets,
            e.g. <code>&lt;http://example.org/foo/bar&gt;</code>,
            literals are written in quotation marks, e.g. "a talk",
            and QNames are written directly,
            e.g. <code>cal:summary</code>.
        </p>

	<p>
	  In Section <specref ref="publishing-an-event" />, Jo
          published an event. The RDF triples extracted from her markup are:
	</p>
        
        <eg><![CDATA[<http://jo-blog.example.org/blog/?p=123#xtech_conference_talk>
                         rdf:type cal:Vevent; 
                         cal:summary "a talk at the XTech Conference about web widgets"^^XMLLiteral;
                         cal:dtstart "20070508T1000+0200" .]]></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"^^XMLLiteral;
               contact:title "distinguished web engineer"^^XMLLiteral;
               contact:org <http://example.org>;
               contact:email <mailto:jo@example.org>.
        ]]></eg>

      <p>
        (The <code>^^XMLLiteral</code> notation, which denotes a datatype, will be explained shortly.)
      </p>

    </div2>
</div1>
      <div1>
    <head>A Second Scenario: Publishing Photos</head>
<!--        <p>
          <em>IMPORTANT NOTE:</em> The examples in this section
          (Section 3) that relate to <code>dc:creator</code> are
          incorrect according to TAG instructions and DC best
          practices. Specifically, the examples in this section
          use the same URI to refer to both a Person (or a group
          of people) and a document. The debate on how to solve
          this is on
          the <a
          href="http://lists.w3.org/Archives/Public/public-swbp-wg/2006Jan/0113.html">mailing
          list</a>.
        </p>
    -->
    <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"^^XMLLiteral .
<> dc:creator "Mark Birbeck"^^XMLLiteral .
]]></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 an XML 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 (note how the
        default datatype is <code>XMLLiteral</code>, which
        explains the first example above.):
      </p>

      <eg><![CDATA[<> dc:title "Vacation in the South of France"^^XMLLiteral .
<> dc:creator "Mark Birbeck"^^XMLLiteral .
<> 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
      well-enough 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> 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>.
      </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. </p>

      <p> In both cases, 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>

    </div2>
      </div1>
      <div1 id="beyond-current-document">
    <head>Beyond the Current Document</head>


    <p>
      The above examples casually swept under the rug the issue of
      the RDF subject: most of the triples expressed were about the
      current document representing a photo album. However, not
      all RDF triples in a given HTML document will be about
      that document itself. In RDFa, the default subject is the
      current document, but it can easily be overridden using
      the <att>about</att> attribute, which we briefly introduced in the very first example.
    </p>

    <div2>
      <head>Qualifying Other Documents</head>

      <p>
        Shutr may choose to present many photos in a given HTML
        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:
      </p>
      
      <eg><![CDATA[
<ul>
  <li> <img src="/user/markb/photo/23456" />,
    <span about="/user/markb/photo/23456" property="dc:title">
      Sunset in Nice
    </span>
  </li>

  <li> <img src="/user/markb/photo/34567" />,
    <span about="/user/markb/photo/34567" property="dc:title">
      W3C Meeting in Mandelieu
    </span>
  </li>
</ul>
]]></eg>

      <p>
        The above RDFa yields the following triples:
      </p>
      
      <eg><![CDATA[</user/markb/photo/23456> dc:title "Sunset in Nice"^^XMLLiteral .

</user/markb/photo/34567> dc:title "W3C Meeting in Mandelieu"^^XMLLiteral .
]]></eg>

      <p>
        This same approach applies to statements with URI
        objects. For example, each photo in the album has a
        creator and may have its own usage license.
      </p>

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

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

      <p>
        This yields the following triples:
      </p>

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

</user/markb/photo/34567>
        dc:title "W3C Meeting in Mandelieu"^^XMLLiteral .
</user/markb/photo/34567>
        dc:creator "Steven Pemberton"^^XMLLiteral .
</user/markb/photo/34567>
        cc:license <http://creativecommons.org/licenses/by/2.5/> .
]]></eg>

    </div2>
    <div2>
      <head>Inheriting <att>about</att></head>
      <p>
        At this point, Shutr might begin to worry about the
        fast-growing size of its HTML document, given that the
        photo's URI must be repeated in the <att>about</att>
        attribute for every RDF property expressed. To address
        this issue, RDFa allows the value of this attribute to be
        inherited from a parent or ancestor element. In other words, if an
        element carries a <att>rel</att> or <att>property</att>
        attribute, but no <att>about</att> attribute, an RDFa
        browser will determine the subject of the RDF statement by
        navigating up the parent hierarchy of that element until
        it finds an <att>about</att>, or until it gets to the root
        element, at which point the default
        is <code>about=""</code>.
      </p>

      <p>
        Thus, the markup for the above example can be
        simplified to:
      </p>

      <eg><![CDATA[
<ul>
  <li about="/user/markb/photo/23456">
    <img src="/user/markb/photo/23456" />
    <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/2.5/">
      Creative Commons Non-Commercial License
    </a>.
  </li>

  <li about="/user/markb/photo/34567">
    <img src="/user/markb/photo/34567" />
    <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/2.5/">
      Creative Commons Commercial License
    </a>.
  </li>
</ul>
]]></eg>

      <p>
        which yields the same triples as the previous example,
        though, in this case, one can easily see the parallel to
        the corresponding N3 shorthand:
      </p>

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

</user/markb/photo/34567> dc:title "W3C Meeting in Mandelieu"^^XMLLiteral ;
                          dc:creator "Steven Pemberton"^^XMLLiteral ;
                          cc:license <http://creativecommons.org/licenses/by/2.5/> .
]]></eg>

    </div2>

    <div2>
      <head>Qualifying Chunks of Documents</head>
      <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
        belong to a single user is the more likely scenario. For
        this purpose, RDFa provides ways to make structured data
        statements about chunks of documents using natural HTML
        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 HTML includes:
      </p>
      
      <eg><![CDATA[
<ul>
  <li id="nikon_d200"> Nikon D200, purchased on 2004-06-01.
  </li>

  <li id="canon_sd550"> Canon Powershot SD550, purchased on 2005-08-01.
  </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" />
    ...
    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" />
    ...
    using the <a rel="shutr:takenWith" 
         href="/user/markb/cameras#nikon_d200">Nikon D200</a>,
    ...
  </li>
...
</ul>
]]></eg>

      <p>
        which corresponds to:
      </p>

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

      <p>
        Then, the HTML 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" datatype="xsd:string">
      Nikon D200
    </span>
    purchased on
    <span property="dc:date" datatype="xsd:date">
      2004-06-01
    </span>
  </li>

  <li id="canon_sd550" about="#canon_sd550">
    <span property="dc:title" datatype="xsd:string">
      Canon Powershot SD550
    </span>
    purchased on
    <span property="dc:date" datatype="xsd:date">
      2005-08-01
    </span>
  </li>
</ul>
]]></eg>
      
      <p>
        which then yields the following triples:
      </p>

      <eg><![CDATA[<#nikon_d200> dc:title "Nikon D200"^^xsd:string ;
              dc:date "2004-06-01"^^xsd:date .

<#canon_sd550> dc:title "Canon SD550"^^xsd:string ;
               dc:date "2005-08-01"^^xsd:date .
]]></eg>

<!--
      <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>

<!--      <div2>
    <head>Compact URIs (CURIEs)</head>
    <p>
      For Shutr, as for many other web publishers, the
      introduction of RDFa attributes tends to increase the size
      of the HTML noticeably, sometimes unnecessarily so: there
      is significant data duplication with full expression of
      URIs. We have already shown how judicious use of
      the <att>about</att> attribute can reduce the number of
      times an RDF subject is expressed. We have also shown how
      the use of <el>link</el> and <el>meta</el> elements can
      further reduce the use of the <att>about</att> attribute
      when attaching structured data to particular HTML chunks.
      We now address URI duplication, RDFa's most significant
      data duplication issue, with <em>Compact URIs</em>, known as
      <em>CURIEs</em>.
      
    </p>
    
    <p>
        A CURIE, e.g. <code>dc:title</code> is
      composed of a prefix, e.g. <code>dc</code>, followed by a
      colon, followed by a suffix, e.g. <code>title</code>. The
      compact URI is resolved by
    </p>
      <ul>
        <li> resolving the prefix according to normal XML
      namespace resolution,</li>
        <li>resolving the suffix as a relative URI
      against the base URI defined by the resolved prefix.</li>
      </ul>

    <p>
      Note that QNames used for RDF properties are valid CURIEs,
      and resolve in exactly the same
      way. Thus <code>dc:title</code> and <code>cc:license</code>
      resolve as expected when <code>dc</code> and <code>cc</code>
      are correctly defined namespaces.
    </p>
      
    <p>
      The differences to note between CURIEs and QNames are:
    </p>
      <ul>
        <li>
          CURIEs allow any sequence of legal URI characters in
          the suffix, including, for example, digits only, dashes,
          slashes, etc...
        </li>
        <li>
          CURIEs allow the empty string as a prefix,
          e.g. <code>:next</code>, in which case the base URI
          defaults to the default XML namespace, which is usually
          <code>xhtml2</code> in our case. Note that this can also be expressed simply as <code>next</code> without the colon, which provides backwards compatibility for existing standard <el>rel</el> values.
        </li>
        <li>
          CURIEs allow the underscore character <code>_</code> as
          a prefix when referencing bnodes. More on this in the Advanced section.
        </li>
      </ul>

    <div3>
      <head>Mixing CURIEs and URIs</head>
      
      <p>
        One of the most important applications of CURIEs in RDFa
        is the use of a CURIE/URI attribute, where either a normal
        URI or a CURIE can be used interchangeably. In order to
        differentiate between the two types, square
        brackets <code>[]</code> are used around a CURIE, whereas
        a URI is written normally.
      </p>

      <p>
        For example, if Shutr wants to reference the Creative
        Commons
        license <code>http://creativecommons.org/licenses/by/2.5/</code>
        in an attribute that accepts both CURIEs and URIs, it can
        use either:
      </p>

      <eg><![CDATA[... attr="http://creativecommons.org/licenses/by/2.5/" ...
]]></eg>

      <p>
        or, assuming the namespace <code>cclicenses</code> has been properly defined:
      </p>

      <eg><![CDATA[... attr="[cclicenses:by/2.5/]" ...
]]></eg>
      
    </div3>

    <div3>
      <head>Which Attributes are Which?</head>
      
      <p>
        In RDFa, the property
        attributes <att>property</att>,<att>rel</att>,
        and <att>rev</att> are all CURIE-only, which ensures
        backwards compatibility with past uses of <att>rel</att>,
        e.g. <code>rel="next"</code>. The <att>about</att>
        and <att>href</att> attributes, on the other hand, accept
        mixed CURIE/URI datatypes. This ensures compatibility with
        browsers that expect clickability for the <att>href</att>,
        and consistency between subject and object.
      </p>
    </div3>

    <div3>
      <head>Back to Shutr</head>

      <p>
        Thus, getting back to Shutr's photo list:
      </p>

      <eg><![CDATA[
<ul>
  <li> <img src="/user/markb/photo/23456" />,
    Sunset in Nice,
    taken by
    <a href="/user/markb">
      Mark Birbeck
    </a>,
    licensed under a 
    <a href="http://creativecommons.org/licenses/by/2.5/">
      Creative Commons License
    </a>.
  </li>

  <li> <img src="/user/markb/photo/34567" />,
    W3C Meeting in Mandelieu
    taken by
    <a href="/user/stevenp">
      Steven Pemberton
    </a>,
    licensed under a 
    <a href="http://creativecommons.org/licenses/by-nc/2.5/">
      Creative Commons Non-Commercial License
    </a>.
  </li>
</ul>
]]></eg>

      <p>
        adding structured data to these photos with CURIEs can save
        significant space (over the non-CURIE use) as soon as
        there are a number of photos in the list:
      </p>

      <eg><![CDATA[
<ul xmlns:cclic="http://creativecommons.org/licenses/" xmlns:photos="/user/markb/photo/">
  <li about="[photos:23456]"> <img src="/user/markb/photo/23456" />,
    <span property="dc:title">
      Sunset in Nice
    </span>,
    taken by
    <a property="dc:creator" href="/user/markb">
      Mark Birbeck
    </a>,
    licensed under a 
    <a rel="cc:license"
       href="[cclic:by/2.5/]">
      Creative Commons License
    </a>.
  </li>

  <li about="[photos:34567]"> <img src="/user/markb/photo/34567" />,
    <span property="dc:title">
      W3C Meeting in Mandelieu
    </span>
    taken by 
    <a property="dc:creator" href="/user/stevenp">
      Steven Pemberton
    </a>,
    licensed under a 
    <a rel="cc:license"
       href="[cclic:by-nc/2.5/]">
      Creative Commons Non-Commercial License
    </a>.
  </li>
</ul>
]]></eg>

      <p>
        Of course, this assumes a browser that can parse CURIEs
        for clickable links. Initially, complete URIs may be
        preferable in the <att>href</att> attribute.
      </p>

    </div3>

      </div2>
    -->
  </div1>
  <div1 id="foaf">
    <head>More Complex Structured Data: Social Networking with FOAF</head>
      
    <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>Two Layers of Structured Data</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 class="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 class="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>

  </div2>
  <div2>
    <head>Additional Layers</head>
  <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 class="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>The RDF Triples</head>

    <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"^^XMLLiteral .
_:dd0 foaf:address_line_2 "MIT Room 32G-524"^^XMLLiteral .
_:dd0 foaf:city "Cambridge"^^XMLLiteral .
_:dd0 foaf:country "USA"^^XMLLiteral .
]]></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"^^XMLLiteral .
_:div0 foaf:address_line_2 "MIT Room 32G-524"^^XMLLiteral .
_:div0 foaf:city "Cambridge"^^XMLLiteral .
_:div0 foaf:country "USA"^^XMLLiteral .

_:dd1 foaf:address _:div1 .

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

  </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> without
      an <att>href</att> to designate the structured
      relationship. RDFa allows this as naturally as possible: if the
      element on which the <att>rel</att> is added has
      an <att>id</att> or an <att>about</att>, then the value of that
      attribute becomes the name of the node, and all triples are
      appropriately updated. <att>about</att> takes precedence
      over <att>id</att>, since it is an explicit RDFa statement.
    </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" id="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"^^XMLLiteral .
<#address> foaf:address_line_2 "MIT Room 32G-524"^^XMLLiteral .
<#address> foaf:city "Cambridge"^^XMLLiteral .
<#address> foaf:country "USA"^^XMLLiteral .
]]></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>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>
      <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, Steven Pemberton, and Ralph Swick. This work would not have been possible without the help of the Semantic Web Deployment and Best Practices Working Group, in particular chairs Guus Schreiber and David Wood. 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.
        </p>
      </div1>
    </body>
</spec>
