XHTML+RDFa Tutorial


Overview

  XHTML+RDFa (Extensible Hypertext Markup Language + Resource Description Framework in attributes) is an extended version of the XHTML markup language for supporting RDF through a collection of attributes and processing rules in the form of well-formed XML documents. Since HTML5 is still a draft, this combination is one of the most advanced markup codes available today. XHTML+RDFa is one of the techniques used to develop Semantic Web content by embedding rich semantic markup. Version 1.1 of the language is a superset of XHTML 1.1, integrating the attributes according to RDFa Core 1.1. In other words, it is an RDFa support through XHTML Modularization.
  RDFa in XHTML became a World Wide Web Consortium (W3C) Recommendation on October 14, 2008.
  XHTML+RDFa can provide machine-readable metadata within the markup code which makes additional user functionalities available. Most important of all, actions can be performed automatically that enables up-to-date publishing, structured search and sharing . RDFa can serve as a bridge between the “human and data webs”. The potential in web documents enriched with RDFa is increasing since major search engines begin to process them while indexing. Yahoo indexes RDFa and microformats since 2008 and Google since 2009 . The RDFa attribute specifications make it possible to describe structured data in any markup language. The RDFa markup in XHTML+RDFa reuses the markup code, thus eliminating the need for unnecessary duplications.
Since the “a” in RDFa stands for attributes, it is straightforward to use CSS selectors to style the code.
  XHTML+RDFa is not widely distributed yet, probably due to the lack of support in authoring tools and content management systems. However, there is good tendency.

Sample XHTML+RDFa document

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:foaf="http://xmlns.com/foaf/0.1/"
      version="XHTML+RDFa 1.0"
      xml:lang="en">
  <head>
    <title>An XHTML+RDF example</title>
  </head>
  <body>
    <p>This is a paragraph with semantic content. 
	It was written by <span about="#sikos" property="foaf:name">Leslie Sikos</span>
	</p>
  </body>
</html>

The N3 notation of this subject (#sikos) – predicate (name) – object (Leslie Sikos) triple can be written as

@prefix foaf: <http://xmlns.com/foaf/0.1/> .
<#sikos> <foaf:name> "Leslie Sikos" .

The type of the object can be declared by the typeof attribute:

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:foaf="http://xmlns.com/foaf/0.1/"
      version="XHTML+RDFa 1.0"
      xml:lang="en">
  <head>
    <title>An XHTML+RDF example</title>
  </head>
  <body>
    <p>This is a paragraph with semantic content. 
	It was written by <span about="#sikos" typeof="foaf:Person" property="foaf:name">Leslie Sikos</span>
	</p>
  </body>
</html>

See also

Reply