Jump to content

RDFa

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by MichaelHausenblas (talk | contribs) at 13:52, 22 May 2007 (→‎References: updated references and added UC, Test Suite, and FAQ). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

RDFa is a set of extensions to XHTML being proposed by W3C. RDFa uses attributes from XHTML's meta and link elements, and generalises them so that they are usable on all elements. This allows you to annotate XHTML markup with semantics. A simple mapping is defined so that RDF triples may be extracted.

Essence

The essence of RDFa is to generalize the attributes (hence the a in RDFa) of the meta and link elements to allow them to be used on any element in an XHTML document.

These attributes are:

  • about - a URI specifying the resource the metadata is about; in its absence it defaults to the current document
  • rel, rev and href - specifying a relationship or reverse-relationship with another resource
  • property - specifying a property for the content of an element
  • content - optional attribute that overrides the content of the element when using the property attribute
  • datatype - optional attribute that specifies the datatype of the content.

Benefits of RDFa

Five "principles of interoperable metadata" met by RDFa.[1]

  • Publisher Independence - each site can use their own standards
  • Data Reuse - data is not duplicated. You do not need separate XML and HTML sections for the same content.
  • Self Containment - The HTML and the RDF are separated
  • Schema Modularity - The attributes are reusable
  • Evolvability - additional fields can be added and XML transforms can extract the semantics of the data from an XHTML file

Example of RDFa

The following is an example of adding Dublin core metadata to an HTML file. Dublin core data elements are data typically added to a book or article (title, author, subject etc.)

 
  <div xmlns:dc="http://purl.org/dc/elements/1.1/"
    about="http://www.example.com/books/wikinomics">
    <span property="dc:title">Wikinomics</span>
    <span property="dc:author">Don Tapscott</span>
    <span property="dc:date">2006-10-01</span>
  </div>
  

However, the real power of RDFa is in how it allows you to mark up running text with semantic values:

 
  <p xmlns:dc="http://purl.org/dc/elements/1.1/"
     about="http://www.example.com/books/wikinomics">
    In his latest book
    <em property="dc:title">Wikinomics</em>,
    <span property="dc:author">Don Tapscott</span>
    explains deep changes in technology,
    demographics and business.
    The book is due to be published in
    <span property="dc:date" content="2006-10-01">October 2006</span>.
  </p>
  

See also

References