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.

Structured data : implementing RDFas and Microformats in web pages

Written on Mon, 21 Sep 2009
By Amy Varga

Amy Varga takes a quick look at implementing RDFas and Microformats in web pages and the advantages of structured data.

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:label>
<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

<p xmlns:dc="http://purl.org/dc/elements/1.1/" about="http://www.absoluteorange.com/blogs/structured data implementing RDFas and Microformats in web pages">
      In her latest blog
      <cite property="dc:title">Structured data : implementing RDFas and Microformats in web pages</cite>,
      <span property="dc:creator">Amy Varga</span>
      briefly discusses the RDFa and Microformat technologies for implementing structured data in web pagesas.  The blog is due to be published in
      <span property="dc:date" content="2009-09-01">September 2009</span>.
</p>

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 Wed 11th Nov 2009 00:47:39, Car Insurance Guy (balmer@trend-fusion.com) said:
Ah!!! at last I found what I was looking for. Somtimes it takes so much effort to find even tiny useful piece of information. Nice post. Thanks

At Wed 30th Dec 2009 06:05:31, viagra (jhon.lamad@gmail.com) said:
Of course, what a great site and informative posts, I will add backlink - bookmark this site? Regards, Reader.

At Wed 30th Dec 2009 09:26:10, generic viagra (jhon.lamad@gmail.com) said:
Hello Guru, what entice you to post an article. This article was extremely interesting, especially since I was searching for thoughts on this subject last Thursday.

At Tue 5th Jan 2010 04:07:47, Reseller Hosting (britnifreeman1@gmail.com) said:
Your blog keeps getting better and better! Your older articles are not as good as newer ones you have a lot more creativity and originality now keep it up!

At Tue 26th Jan 2010 08:49:49, ???????????? ????????? ?????? (gunnudcuabpqtfb@gmail.com) said:
Спасибо за пост. Позновательно.

At Tue 26th Jan 2010 22:39:54, ??????? ????????? (gunnudcuabpqtfb@gmail.com) said:
спасибо за инфу!

At Wed 3rd Feb 2010 16:46:16, amiliareotarm (bonvertonet@gmail.com) said:
loved las vegas? inquire the all unprecedented http://www.casinolasvegass.com - casino las vegas at www.casinolasvegass.com with during 75 changed manumit http://www.casinolasvegass.com - online casino games like slots, roulette, baccarat, craps and more and outdistance a big name in licit coins with our $400 not working bonus. we secure even-handed commonsensical b wealthier games then the superannuated online http://www.place-a-bet.net/ - casino www.place-a-bet.net!

At Wed 3rd Feb 2010 17:31:12, WP Themes (jonala234l@gawab.com) said:
Good dispatch and this fill someone in on helped me alot in my college assignement. Thank you seeking your information.

At Thu 4th Feb 2010 08:10:30, AdultTVOne (jordenwax93@gmail.com) said:
Kim Kardashian Tape? http://www.XXXBlender.com - Internet Adult TV

Add a comment

* denotes required fields