Schema.org and RDFa 1.1 Lite: how does it look now?

In his latest blog entry on the Schema.org, Dan Brickley announced that Schema.org would also process RDFa 1.1 Lite as an alternative syntax to encode Schema.org terms. As he emphasized:

This work opens up new possibilities also for developers who intend to work with schema.org data using RDF-based tools and Linked Data, and defines a simplified publisher-friendly ‘Lite’ view of RDFa.

However, one has to be careful about a detail: the RDFa 1.1 version that will be processed is not the latest “official” W3C draft; indeed, as a result of feedback’s and technical discussion, the next release of RDFa 1.1 will include some significant changes. As Dan emphasized in his blog, there are still some technical details to finalize before the Working Group would publish that new draft, but the changed version is already available as an editors’ draft. The most important new feature, as far as the Schema.org examples also go, is the changed behavior of the @property attribute: in the overwhelming percentage of RDFa usage, it becomes synonymous to @rel. (What essentially happens is that, in the presence of, say, an @href attribute, the value of that attribute is bound to @property instead of a possible literal.)

The Schema.org datamodel page has an early example showing some canonical Schema.org use cases in terms of RDFa 1.1. It encodes an earlier version of the example given on the Schema.org Product. Here is how the same example looks like in the new setting, i.e., RDFa 1.1. This example is also in RDFa 1.1 Lite, i.e., the simpler albeit strict subset of RDFa 1.1:

<div vocab="http://schema.org/" typeof="Product">
  <img property="image" src="dell-30in-lcd.jpg" />
  <span property="name">Dell UltraSharp 30" LCD Monitor</span>

  <div property="aggregateRating" typeof="AggregateRating">
    <span property="ratingValue">87</span>
    out of <span property="bestRating">100</span>
    based on <span property="ratingCount">24</span> user ratings

  <div property="offers" typeof="AggregateOffer">
	<span property="lowPrice">$1250</span>
	to <span property="highPrice">$1495</span>
	from <span property="offerCount">8</span> sellers

  <div property="offers" typeof="Offer" >
    <a property="url" href="save-a-lot-monitors.com/dell-30.html">
     Save A Lot Monitors - $1250</a>
  <div property="offers" typeof="http://schema.org/Offer">
    <a property="url" href="jondoe-gadgets.com/dell-30.html">
    Jon Doe's Gadgets - $1350</a>

This is clearly significantly simpler than the previous version. Indeed, the compelling reasons for the changes in RDFa 1.1 (compared to its previous versions) was to achieve that simplicity.

If you are interested in some of the technical details… Some of the notable differences, compared to the previous versions of RDFa 1.1 (and also shown on that example) are:

  • The behavior of @property has become richer. For example, when used on the <img> element, it results in a triple with an IRI reference as a subject, rather than a literal. This was (and still is!) the behavior of @rel but, in this case, @property can also be used with a similar result. (That is also the reason why @rel is not used in RDFa 1.1 Lite any more.)
  • The combination of @property and @typeof has also changed. @typeof generates a new blank node (it had a similar effect in RDFa 1.0 as well as in the earlier versions of RDFa 1.1, although some of the details have changed) but, and that is a new feature, this blank node is also used as an object for @property (again, instead of generating a literal). One could consider this combination as a shorthand for an extra @resource or @href attribute using a (new) blank node identifier.
  • Another feature bound to the combination of @property and @typeof: the generated blank node “chains”, i.e., is used as a subject for subsequent triples in the sub-tree. This makes a very frequent idiom (repeated several times in the example) simpler than before.

For reference, a portion of the generated RDF is as follows:

@prefix schema: <http://schema.org> .
[ a schema:Product ;
  schema:image <dell-30in-lcd.jpg> ;
  schema:name "Dell UltraSharp 30" LCD Monitor ;
  schema:aggregateRating [
    a schema:AggregateRating ;
    schema:ratingValue "87" ;
    schema:bestRating "100" ;
    schema:ratingCount "24" 
  ] ;
  schema:offers [
    a schema:AggregateOffer ;
    schema:lowPrice "$1250" ;
    schema:highPrice "$1495" ;
    schema:offerCount "8" 
  ] ;
  schema:offers [
    a schema:Offer ;
    schema:url <save-a-lot-monitors.com/dell-30.html> 
  ] ;

About Ivan Herman

Ivan Herman is the leader of the Digital Publishing Activity at W3C. For more details, see http://www.w3.org/People/Ivan/

2 thoughts on “Schema.org and RDFa 1.1 Lite: how does it look now?

  1. Interesting. One question regarding the example, though:

    &lt;div property="offers" typeof="Offer" &gt;
    &lt;div property="offers" typeof="http://schema.org/Offer"&gt;

    Is there any difference / reason for fully qualifying the second <div>?

    Thanks for the update :)

  2. Matti,

    yes, there is a reason: my own sloppiness:-)

    That being said: the code is correct: RDFa gives you the choice of using full URIs or “terms”, as it is called, ie, names that are concatenated to the vocabulary value to form a full URI. It is up to the author. This means, for example, that authors can also add a type that is not in the main vocabulary using a full URI (“also” because a @typeof attribute may contain several types), but it also works if the author forgets to refer to the vocabulary like I did…



Comments are closed.