Sharing our knowledge

Nothing is more useful than the information you've been looking for.  Our blogs communicate our recent findings and expertise within our skillset.

Please select a blog from the menu.

Blog 5 of 10

  1. previous
  2. 1
  3. 2
  4. 3
  5. 4
  6. 5
  7. next

Structured data : RDFAs and Microformats

Written on Mon, 21st September 2009
By Amy Varga

The introduction of structured data on the web is nothing new. More recently however structured data has become a more pertinent issue with more emphasis on the ?semantic web? and ?linked data?, both initiatives which have been heavily promoted by the W3C.

RDFas (Resource descriptor framework attributes) and Microformats are 2 technologies which can be used to to structure data. More specifically, RDFas and Microformats are a set of (X)HTML attributes designed to augment human visible text by encoding semantic information read by machines. This information is typically hidden from users and provides metadata used by machines. This metadata can be used by applications that collect data about on-line resources such as browsers and desktop applications including search engines, e-mail clients, scheduling software, communication software and map software.

For more than a year Yahoo and, more recently, Google have been using RDFas and Microformats to structure data which is indexed to provide ?Rich Snippets?, a convenient summary of information about a web page displayed as a search result. Certainly, the use of structured data by search engines will see a huge leap in its implementation across the web.

In this blog I will briefly introduce Microformats and RDFas as well as give a simple of example of how to implement it in web pages.

Microformats

Microformats indicate the presence of metadata using the following attributes:

  • class
  • rel
    • These are wrapped in HTML elements with specific class names. Specific Microformats have been developed to semantically markup particular types of information. For example hCard has the following properties (class names)
  • vcard {1} : MUST be present exactly once
  • adr*
    • +type [work|home|pref|postal|dom|intl]?
    • +post-office-box?
    • +street-address*
    • +extended-address?
    • +region?
    • +locality?
    • +postal-code?
    • +country-name?
  • agent*
  • bday? (ISO date)
  • class? confidentiality/access classification of the entire hCard
  • category*
  • email*
    • +type?
    • +value?
  • fn {1} : MUST be present exactly once
  • geo?
    • +latitude?
    • +longitude?
  • key*
  • label*
  • logo*
  • mailer*
  • n?
    • +honorific-prefix*
    • +given-name*
    • +additional-name*
    • +family-name*
    • +honorific-suffix*
  • nickname*
  • note*
  • org*
    • +organization-name?
    • +organization-unit*
  • photo*
  • rev? datetime of the revision of the entire hCard
  • role*
  • sort-string?
  • sound*
  • title*
  • tel* (Note E.123 for formatting info.)
    • type [home|work|pref|fax|cell|pager]?
    • value?
  • tz? timezone of the person
  • uid? applies to the entire hCard
  • url*

Key
* = OPTIONAL, and MAY occur more than once
+ = MUST be present, and MAY occur more than once
? = OPTIONAL, but MUST NOT occur more than once
[square brackets] = list of common values
(parentheses) = data format
pref = preferred
dom = domestic
intl = international
cell = mobile

A simple example

<address class="vcard">
<a class="fn org url" href="http://www.absoluteorange.com/">Absolute Orange</a>
</address>

which is displayed as:

Absolute Orange

RDFa

RDFa became a W3C recommendation in October 2008. It is an extension to RDF, a lightweight multipurpose extensible metadata description and syndication format. Whilst RDFa is XML it can be used in HTML4 pages and whilst they will not alter the display of HTML pages, they may not validate. HTML 5 are working on a mechanism for embedding RDF in HTML. Perhaps the best time to use RDFa is when there is no supporting Microformat.

RDFa use the following attributes:

  • about : a URI or CURIE specifying the resource the metadata is about; in its absence it defaults to the current document
  • rel and rev : specifying a relationship or reverse-relationship with another resource
  • href, src and resource : specifying the partner 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 text specified for use with the property attribute
  • typeof : optional attribute that specifies the RDF type(s) of the subject (the resource that the metadata is about)

In RDFa when specifying terms within the property attribute, the meaning of the term must be linked to a vocabularly whose namespace must be included. There are a number of existing vocabularies for example the Dublin Core vocabulary which has the following properties:

<rdf:Description rdf:about=?http://purl.org/dc/elements/1.1/?>
+
<rdf:Property rdf:about=?http://purl.org/dc/elements/1.1/title?>
<rdfs:label xml:lang=?en-US?>Title</rdfs:label>
<rdfs:comment xml:lang=?en-US?>A name given to the resource.</rdfs:comment>
+
<rdf:Property rdf:about=?http://purl.org/dc/elements/1.1/creator?>
<rdfs:label xml:lang=?en-US?>Creator</rdfs:label>
<rdfs:comment xml:lang=?en-US?>An entity primarily responsible for making the resource.</rdfs:comment>
+
<rdf:Property rdf:about=?http://purl.org/dc/elements/1.1/subject?>
<rdfs:label xml:lang=?en-US?>Subject</rdfs:label>
<rdfs:comment xml:lang=?en-US?>The topic of the resource.</rdfs:comment>
+
<rdf:Property rdf:about=?http://purl.org/dc/elements/1.1/description?>
<rdfs:label xml:lang=?en-US?>Description</rdfs:label>
<rdfs:comment xml:lang=?en-US?>An account of the resource.</rdfs:comment>
+
<rdf:Property rdf:about=?http://purl.org/dc/elements/1.1/publisher?>
<rdfs:label xml:lang=?en-US?>Publisher</rdfs:label>
<rdfs:comment xml:lang=?en-US?>An entity responsible for making the resource available.</rdfs:comment>
+
<rdf:Property rdf:about=?http://purl.org/dc/elements/1.1/contributor?>
<rdfs:label xml:lang=?en-US?>Contributor</rdfs:label>
<rdfs:comment xml:lang=?en-US?>An entity responsible for making contributions to the resource.
</rdfs:comment>
+
<rdf:Property rdf:about=?http://purl.org/dc/elements/1.1/date?>
<rdfs:label xml:lang=?en-US?>Date</rdfs:label>
<rdfs:comment xml:lang=?en-US?>A point or period of time associated with an event in the lifecycle of the resource.</rdfs:comment>
+
<rdf:Property rdf:about=?http://purl.org/dc/elements/1.1/type?>
<rdfs:label xml:lang=?en-US?>Type <rdfs:comment xml:lang=?en-US?>The nature or genre of the resource.</rdfs:comment>
+
<rdf:Property rdf:about=?http://purl.org/dc/elements/1.1/format?>
<rdfs:label xml:lang=?en-US?>Format</rdfs:label>
<rdfs:comment xml:lang=?en-US?>The file format, physical medium, or dimensions of the resource.</rdfs:comment>
+
<rdf:Property rdf:about=?http://purl.org/dc/elements/1.1/identifier?>
<rdfs:label xml:lang=?en-US?>Identifier</rdfs:label>
<rdfs:comment xml:lang=?en-US?>An unambiguous reference to the resource within a given context.</rdfs:comment>
+
<rdf:Property rdf:about=?http://purl.org/dc/elements/1.1/source?>
<rdfs:label xml:lang=?en-US?>Source</rdfs:label>
<rdfs:comment xml:lang=?en-US?>A related resource from which the described resource is derived.</rdfs:comment>
+
<rdf:Property rdf:about=?http://purl.org/dc/elements/1.1/language?>
<rdfs:label xml:lang=?en-US?>Language</rdfs:label>
<rdfs:comment xml:lang=?en-US?>A language of the resource.</rdfs:comment>
+
<rdf:Property rdf:about=?http://purl.org/dc/elements/1.1/relation?>
<rdfs:label xml:lang=?en-US?>Relation</rdfs:label>
<rdfs:comment xml:lang=?en-US?>A related resource.</rdfs:comment>
+
<rdf:Property rdf:about=?http://purl.org/dc/elements/1.1/coverage?>
<rdfs:label xml:lang=?en-US?>Coverage</rdfs:label>
<rdfs:comment xml:lang=?en-US?>
The spatial or temporal topic of the resource, the spatial applicability of the resource, or the jurisdiction under which the resource is relevant.</rdfs:comment>
+
<rdf:Property rdf:about=?http://purl.org/dc/elements/1.1/rights?>
<rdfs:label xml:lang=?en-US?>Rights</rdfs:label>
<rdfs:comment xml:lang=?en-US?>Information about rights held in and over the resource.</rdfs:comment>

A simple example

In her latest blog Structured data : implementing RDFas and Microformats in web pages, Amy Varga briefly discusses the RDFa and Microformat technologies for implementing structured data in web pagesas. The blog is due to be published in September 2009.

Unfortunately it was impossible for me to display the above as it stands because Word Press would not allow the xmlns, about, property or content attributes within their HTML elements, presumably because they do not validate.

Conclusion

Whilst there may be much future development and improvement of structured data technologies and indeed the RDFa and Microformat technologies I believe it wise to start implementing these technologies in web pages now.

Comments

At Fri 20th May 2011 08:57:10, Kaylana (x.hokrec@novell.nl) said:
Real brain power on display. Thanks for that awsner!

Make your comment

* denotes required fields

Blog 5 of 10

  1. previous
  2. 1
  3. 2
  4. 3
  5. 4
  6. 5
  7. next