<?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 "RDF/A Primer">
    <!ENTITY version "1.0">
    <!ENTITY XFormsNS "http://www.w3.org/2002/xforms">
    <!ENTITY prev-dd "27">
    <!ENTITY prev-mm "10">
    <!ENTITY prev-year "2005">
    <!ENTITY dd "09">
    <!ENTITY MM "January">
    <!ENTITY mm "01">
    <!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 "§">
]>
<!-- "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>draft</w3c-doctype>
        <pubdate>
            <day>&dd;</day>
            <month>&MM;</month>
            <year>&year;</year>
        </pubdate>
        <!-- notice>Notice this!!</notice -->
        <publoc>
            <loc href="http://www.w3.org/2001/sw/BestPractices/HTML/2006-01-15-rdfa-primer">http://www.w3.org/2001/sw/BestPractices/HTML/2006-01-15-rdfa-primer</loc>
        </publoc>
        <prevlocs>
            <loc href="http://www.w3.org/2001/sw/BestPractices/HTML/2005-rdfa-primer">http://www.w3.org/2001/sw/BestPractices/HTML/2005-rdfa-primer</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@creativecommons.org">ben@creativecommons.org</email>
            </author>
        </authlist>
        <abstract>
            <p>
	      This document introduces the RDF/A syntax for expressing
              RDF metadata within XHTML. The reader is expected to be
              fairly familiar with XHTML, and somewhat familiar with
              RDF.
            </p>
        </abstract>
        <status>
          <p>This is an internal draft produced by the RDF-in-HTML
            task force <bibref ref="RDFHTML" />, a joint task force of
            the Semantic Web Best Practices and Deployment Working
            Group <bibref ref="SWBPD-WG" /> and HTML Working Group
            <bibref ref="HTML-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>
        <languages>
            <language>en</language>
        </languages>
        <revisiondesc>
            <p>
                <emph>Last Modified: $Id: 2006-01-15-rdfa-primer.xml,v 1.12 2006/10/09 15:50:14 adida Exp $</emph>
            </p>
        </revisiondesc>
    </header>
    <body>
      <div1>
	<head>Purpose of RDF/A and Preliminaries</head>
	<p>
	  RDF/A is a set of attributes used to embed RDF in XHTML. An
	  important goal of RDF/A is to achieve this RDF embedding
	  without repeating existing XHTML content when that
	  content <em>is</em> the metadata. Though RDF/A was initially
	  designed for XHTML2, one should be able to use RDF/A with
	  other XML dialects, e.g. XHTML1, SVG, given proper schema
	  additions.
	</p>

	<p>
	  We note that RDF/A 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.
	</p>
      </div1>
      <div1>
	<head>A Scenario: The Shutr Photo Management System</head>
	<p>
	  Consider a (fictional) photo management web site
	  called <em>Shutr</em>, whose web site
	  is <code>http://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 XHTML
	  it delivers. Since photos are contributed by users with
	  significant amount of built-in metadata (camera type,
	  exposure, etc...) and additional, explicitly provided
	  metadata (photo caption, license, photographer's name),
	  Shutr may benefit from using RDF to express this rich metadata.
	</p>

	<p>
	  We explore how Shutr might use RDF/A to express this RDF
	  metadata right in the XHTML it already publishes. We assume
	  an additional XML namespace, <code>shutr</code>, which
	  corresponds to URI <code>http://shutr.net/rdf/shutr#</code>.
	</p>
      </div1>
      <div1>
	<head>Simple Metadata</head>
	<p>
	  The simplest structured metadata 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 metadata for now, as that involves RDF
	  statements about an image, which is not an XHTML
	  document. We will, of course, get back to this soon.)
	</p>

	<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
	    metadata property.
	  </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://shutr.net/user/markb/album/12345</code>. The
	    XHTML document presented upon request of that URI includes
	    the following XHTML 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 XHTML contains elements of the
	    photo album's structured metadata. Using RDF/A, Shutr can
	    mark up this XHTML to indicate these structured metadata
	    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 RDF/A-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>
	    (The <code>^^XMLLiteral</code> notation, which denotes a datatype, will be explained shortly.)
	  </p>
	  <p>
	    One might wonder, given the above example, if
	    the <el>span</el> element is required to attach RDF
	    properties to rendered content. In fact, it is not:
	    the <att>property</att> attribute can be used on any
	    XHTML element. For example, if the original HTML did not
	    include the explicit words "Photo Album #12345":
	  </p>

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

	  <p>
	    Then the RDF/A might look like this:
	  </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>
	    and would yield the same RDF triples, of course.
	  </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 RDF/A, "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 2006-01-02</h2>
]]></eg>

	  <p>
	    A precise way to augment this HTML with RDF/A 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" type="xsd:date">2006-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 "2006-01-02"^^xsd:date .
]]></eg>
	  
	  <p>
	    Going further, Shutr realizes
	    that <code>2006-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 RDF/A:
	  </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" type="xsd:date"
           content="2006-01-02">
    January 2nd, 2006
     </span>
</h2>
]]></eg>

	  <p>
	    The above XHTML will render the date as "January 2nd,
	    2006" 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 metadata.
	  </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 XHTML document, all reachable via the
	    web.
	  </p>

	  <p>
	    As Mark Birbeck uploads many photo albums to Shutr, the
	    site decides to build a user-profile page for him, a page
	    that summarizes all of his albums and user profile
	    information for others to see. This profile lives
	    at <code>http://shutr.net/user/markb</code>. Thus,
	    the <code>dc:creator</code> property should probably
	    reference this URI. At the same time, Mark's name on the
	    Shutr site should consistently link to this same URI in a
	    clickable fashion.
	  </p>

	  <p>
	    The raw XHTML snippet might look like:
	  </p>

	  <eg><![CDATA[<h2>created by <a href="/user/markb">Mark Birbeck</a></h2>
]]></eg>

	  <p>
	    Using the <att>rel</att> attribute, one can easily update
	    this HTML to include an RDF/A statement:
	  </p>

	  <eg><![CDATA[<h2>created by <a rel="dc:creator" href="/user/markb">Mark Birbeck</a></h2>
]]></eg>

	  <p>
	    This would then yield the expected triple:
	  </p>

	  <eg><![CDATA[<> dc:creator </user/markb> .
]]></eg>
	  
	  <p>
	    Similarly, 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 XHTML snippet (currently -- January 2006 --
	    recommended by Creative Commons):
	  </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 semantic meaning: it
	    is the document's license. Using RDF/A can cement that
	    meaning within the XHTML 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 RDF/A yields the following triple:
	  </p>

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

	  <p>
	    Compared with other existing RDF mechanisms to indicate
	    Creative Commons licensing
	    -- e.g. a parallel RDF/XML file or inline RDF/XML within
	    XHTML comments --, the RDF/A approach provides Creative
	    Commons and Shutr with a significant integrity advantage:
	    the clickable link <em>is</em> is 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 XHTML
	    will carry through both the rendered and semantic data.
	  </p>

	  <p>
	    In both cases, the target URI may provide an XHTML
	    document which includes further RDF/A statements. The
	    Creative Commons license page, for example, may include
	    RDF/A statements about its legal details.
	  </p>

	</div2>
      </div1>
      <div1>
	<head>Beyond the Current Document</head>
	<p>
	  The above examples casually swept under the rug the issue of
	  the RDF subject: all the triples expressed were about the
	  current document representing a photo album. However, not
	  all RDF triples in a given XHTML2 document will be about
	  that document itself. In RDF/A, the default subject is the
	  current document, but it can easily be overriden using
	  the <att>about</att> attribute.
	</p>

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

	  <p>
	    Shutr may choose to present many photos in a given XHTML
	    page. In particular, at the
	    URI <code>http://shutr.net/user/markb/album/12345</code>,
	    all of the album's photos will appear inline. Metadata
	    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 RDF/A 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" 
       rel="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"
	  rel="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 </user/markb> .
</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 </user/stevenp> .
</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, RDF/A allows the value of this attribute to be
	    inherited from a parent element. In other words, if an
	    element carries a <att>rel</att> or <att>property</att>
	    attribute, but no <att>about</att> attribute, an RDF/A
	    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 rel="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 rel="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 </user/markb> ;
                          cc:license <http://creativecommons.org/licenses/by-nc/2.5/> .

</user/markb/photo/34567> dc:title "W3C Meeting in Mandelieu"^^XMLLiteral ;
                          dc:creator </user/stevenp> ;
                          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, RDF/A provides ways to make metadata
	    statements about chunks of documents using natural XHTML
	    constructs.
	  </p>

	  <p>
	    Consider the
	    page <code>http://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 RDF/A 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 generates the triple:
	  </p>

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

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

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

  <li id="canon_sd550" about="#canon_sd550">
    <span property="dc:title" type="xsd:string">
      Canon Powershot SD550
    </span>
    purchased on
    <span property="dc:date" type="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, RDF/A includes
	    elements <el>link</el> and <el>meta</el>, which behave in
	    a special way : 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" type="xsd:string">
      Nikon D200
    </span>
    purchased on
    <meta property="dc:date" type="xsd:date">
      2004-06-01
    </span>
  </li>

  <li id="canon_sd550">
    <meta property="dc:title" type="xsd:string">
      Canon Powershot SD550
    </span>
    purchased on
    <meta property="dc:date" type="xsd:date">
      2005-08-01
    </span>
  </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>Syntactic Sugar</head>
	  <em>@@TODO: finalize whether this is acceptable syntactic sugar</em>
	  
	  <p>
	    Extrapolating from the above examples, it's quite easy to
	    see how XHTML elements might represent RDF entities on a
	    regular basis. Thus, RDF/A offers syntactic sugar for
	    the <code>rdf:type</code> relationship, using the
	    well-established <att>class</att> attribute. The above
	    XHTML2 can thus be simplified to:
	  </p>

	  <eg><![CDATA[<section about="#person" class="[foaf:Person]">
   <meta property="[foaf:name]" content="Dan Brickley" />
   <link rel="[foaf:homepage]" href="" />
</section>
]]></eg>


	</div2> -->

<!--	<div2>
	  <head>Inline Objects</head>
	  <emph>@@TODO: this issue is not yet
	  resolved: <a href="2005-current-issues#src">Current
	  Issues</a>. And there are some weird consequences: the
	  inside of the <el>img</el> element is not rendered, so what
	  of renderable XHTML elements with metadata? We may want to
	  only enable <el>link</el> and <el>meta</el>...</emph>
	  
	  <p>
	    Images and Objects in XHTML2 are loaded from
	    the <att>src</att> attribute. Adding some metadata
	    relevant to these inline objects is a natural extension of
	    previous examples. In the absence of an <att>about</att>
	    attribute, the <att>src</att> attribute serves as the
	    subject. For example, the following XHTML with RDF/A:
	  </p>

	  <eg><![CDATA[
<img src="photo1.jpg">
   <link rel="cc:license" 
	 href="http://creativecommons.org/licenses/by-nc-nd/2.5/" />
   <meta property="dc:creator" content="Mark Birbeck" />
</img>
  ]]></eg>

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

	  <eg><![CDATA[
<photo1.jpg> cc:license <http://creativecommons.org/licenses/by-nc-nd/2.5/> ;
             dc:creator "Mark Birbeck" .
  ]]></eg>
	  

	</div2> -->

      <div2>
	<head>Compact URIs (CURIEs)</head>
	<p>
	  For Shutr, as for many other web publishers, the
	  introduction of RDF/A attributes tends to increase the size
	  of the XHTML 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 metadata to particular XHTML chunks.
	</p>

	<p>
	  We now address URI duplication, RDF/A's most significant
	  data duplication issue, with <em>Compact URIs</em>, known as
	  <em>CURIEs</em>. 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
	  <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>

	<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:
	  <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.
	    </li>
	    <li>
	      CURIEs allow the underscore character <code>_</code> as
	      a prefix when referencing bnodes. More on this in the Advanced section.
	    </li>
	  </ul>
	</p>

	<div3>
	  <head>Mixing CURIEs and URIs</head>
	  
	  <p>
	    One of the most important applications of CURIEs in RDF/A
	    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>
	    <em>@@TODO: this depends
	    on <a
	    href="http://w3.org/2001/sw/BestPractices/HTML/2005-current-issues#curies-in-predicates">issue
	    #12 in the current issues list</a>.</em>
	  </p>
-->

	  <p>
	    In RDF/A, 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 metadata 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 rel="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 rel="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>
        <head>Bibliography</head>
        <blist>
          <bibl id="RDFHTML" href="http://w3.org/2001/sw/BestPractices/HTML/">RDF-in-HTML Task Force</bibl>
          <bibl id="SWBPD-WG" href="http://w3.org/2001/sw/BestPractices/">Semantic Web Best Practices and Deployment Working Group</bibl>
          <bibl id="HTML-WG" href="http://w3.org/MarkUp/Group/">HTML Working Group</bibl>
        </blist>
      </div1>
    </body>
</spec>

