<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xml:base="http://www.jenitennison.com/blog" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
 <title>rdfa</title>
 <link>http://www.jenitennison.com/blog/taxonomy/term/42</link>
 <description>The taxonomy view with a depth of 0.</description>
 <language>en</language>
<item>
 <title>Microdata and RDFa Living Together in Harmony</title>
 <link>http://www.jenitennison.com/blog/node/165</link>
 <description>&lt;p&gt;One of the options that the TAG put forward when it &lt;a href=&quot;http://lists.w3.org/Archives/Public/public-html/2011Jun/0366.html&quot;&gt;asked the W3C to put together task force on embedded data in HTML&lt;/a&gt; was the co-existence of RDFa and microdata. If &lt;a href=&quot;http://lists.w3.org/Archives/Public/www-tag/2011Aug/0050.html&quot;&gt;that&amp;#8217;s what we&amp;#8217;re headed for&lt;/a&gt;, what might make things easier for consumers and publishers who have to live in that world?&lt;/p&gt;

&lt;p&gt;In a situation where there are two competing standards, I think that developers &amp;#8212; both on the publication and consumption sides &amp;#8212; are going to want to hedge their bets. They will want to avoid being tied to one syntax in case it turns out that that syntax isn&amp;#8217;t supported by the majority of publishers/consumers in the long term and they have to switch.&lt;/p&gt;

&lt;p&gt;Publishers like us at &lt;a href=&quot;http://www.legislation.gov.uk/&quot;&gt;legislation.gov.uk&lt;/a&gt; who are aiming to share their data to whoever is interested in it (rather than having a particular consumer in mind) are also likely to want to publish in both microdata and RDFa, rather than force potential consumers to adopt a particular processing model, and will therefore need to mix the syntaxes within their pages.&lt;/p&gt;

&lt;p&gt;(Of course developers might just avoid embedded data altogether while they wait to see what happens, but let&amp;#8217;s assume that they want to press ahead regardless of the lack of consensus from the standardistas.)&lt;/p&gt;

&lt;p&gt;I&amp;#8217;ve therefore embarked on a task of trying:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;to identify the differences in approach and functionality of the two languages, which should help developers choose between them&lt;/li&gt;
&lt;li&gt;to identify any guidelines for developers of vocabularies for use with both languages&lt;/li&gt;
&lt;li&gt;to identify a subset of functionality that is common between the two languages, which developers might want to stick to to make switching and mixing easier&lt;/li&gt;
&lt;li&gt;to identify mapping rules that might be applied to automatically or manually map from one language to another if the simple subset is used&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I&amp;#8217;ve done this by looking at converting microdata examples to RDFa and vice versa, and the lessons to be drawn from that exercise. I&amp;#8217;ve broken down the result into three posts:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.jenitennison.com/blog/node/163&quot;&gt;converting microdata to RDFa&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.jenitennison.com/blog/node/164&quot;&gt;converting RDFa to microdata&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.jenitennison.com/blog/node/165&quot;&gt;lessons learned from this exercise&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is the last of these posts. It is probably the only one you will want to read :)&lt;/p&gt;

&lt;!--break--&gt;

&lt;p&gt;Please treat this as a draft on which I&amp;#8217;d welcome comments. I have based what&amp;#8217;s written here on the latest specifications of both microdata (in its &lt;a href=&quot;http://www.whatwg.org/specs/web-apps/current-work/multipage/microdata.html&quot;&gt;WHAT WG&lt;/a&gt; and &lt;a href=&quot;http://dev.w3.org/html5/md/Overview.html&quot;&gt;W3C&lt;/a&gt; variants) and &lt;a href=&quot;http://www.w3.org/2010/02/rdfa/drafts/2011/ED-rdfa-core-20110814/&quot;&gt;RDFa Core&lt;/a&gt; and &lt;a href=&quot;http://dev.w3.org/html5/rdfa/&quot;&gt;HTML+RDFa&lt;/a&gt; but I haven&amp;#8217;t consulted with anyone involved in these efforts and may well have got things wrong. Plus the specs are changing all the time. I have only here considered the syntax of the two languages, not the features such as DOM APIs or drag-and-drop support, where there are also clear differences.&lt;/p&gt;

&lt;p&gt;Please add comments if there are things that I&amp;#8217;ve missed or got wrong, or just to have your say.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://foolip.org/microdatajs/live/&quot;&gt;Philip Jägenstedt&amp;#8217;s Live Microdata service&lt;/a&gt; and &lt;a href=&quot;http://rdf.greggkellogg.net/distiller&quot;&gt;Gregg Kellogg&amp;#8217;s Distiller service&lt;/a&gt; have both proved invaluable for testing &amp;#8212; thank you to both for making these services available. I heartily recommend them.&lt;/p&gt;

&lt;h2&gt;Mapping Rules&lt;/h2&gt;

&lt;p&gt;The first problem is how to judge equivalence when microdata and RDFa have different data models. Microdata essentially uses a JSON data model: there are objects (items) with properties that have values that are strings, other objects, or arrays of strings or objects or both. RDFa naturally uses a RDF data model: there are resources with properties that have values that are literals (of some datatype or with a language) or other resources.&lt;/p&gt;

&lt;p&gt;Underlying both is the same basic entity-attribute-value pattern, but there are various mismatches between the models that make some mappings more complicated than others, or in other cases mean that information is necessarily lost on conversion.&lt;/p&gt;

&lt;p&gt;In performing the analysis, I&amp;#8217;ve tried to map microdata into sensible RDF and then match that RDF output using RDFa, and to map RDFa into sensible microdata+JSON and then match that microdata+JSON using microdata. The microdata-to-RDF mapping rules that I&amp;#8217;ve followed are basically those outlined in my post on &lt;a href=&quot;http://www.jenitennison.com/blog/node/162&quot;&gt;Microdata + RDF&lt;/a&gt;. To create microdata JSON from RDFa, I&amp;#8217;ve used the rule that the URI of the first type of a resource is processed to provide a namespace that is stripped from the URIs of the properties (to create simple names where possible). In addition, when a resource has no properties, it will be represented as a string (URI) value rather than as a nested item.&lt;/p&gt;

&lt;p&gt;These rules need to be formalised, obviously, but the basics above work well enough for the examples from the specs.&lt;/p&gt;

&lt;h2&gt;Mismatched Features&lt;/h2&gt;

&lt;p&gt;The following features are problematic when mapping from microdata to RDFa or vice versa. I&amp;#8217;ve described them roughly in an order from things where it might be relatively easy to address the problem by changing one or other specification, to places where the necessary changes would be difficult to make in the specs, which means that publishers and consumers need to be aware of the issue so that they can make an educated choice about how they proceed.&lt;/p&gt;

&lt;h3&gt;Local Property Names&lt;/h3&gt;

&lt;p&gt;Many of the microdata examples involve items with no type and local property names. I&amp;#8217;ve assumed in the analysis below that this generates properties whose URI is based on the document in which they are found, but this is not a helpful solution for data sharing: if a whole site uses short property names across its pages, those properties really need to be recognised as being the same across the site for any kind of useful processing to occur.&lt;/p&gt;

&lt;p&gt;What microdata actually creates here is a global namespace, shared by everyone, specifically for embedded data. There are three things that could be done at different levels here:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;In a mapping from microdata to RDF, any short property names on items that don&amp;#8217;t have a type could be assigned to a global namespace (eg &lt;code&gt;http://w3.org/ns/global/&lt;/code&gt;). Of course there will be clashes in semantics within this namespace, but that is true in microdata generally and not having to create a new namespace makes the initial experimentation easier for those starting with embedded data. The W3C (or whoever operates the namespace) could operate a wiki at that location that would operate as an informal registry for the property names.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;HTML+RDFa could change to use this global namespace as the default vocabulary URI (rather than not having one). This would make it a little easier for people to convert microdata to RDFa: if they don&amp;#8217;t use types for their items, there would then be no need for a &lt;code&gt;vocab&lt;/code&gt; attribute to be added to the HTML. It also makes it possible to use RDFa in a basic, lightweight way, which might help people get started with it.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Publishers can be advised to use &lt;code&gt;itemtype&lt;/code&gt; within their microdata, reusing existing classes or creating their own, if they want to ensure that the embedded data within their pages isn&amp;#8217;t misinterpreted by global consumers.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;Interpretation of &lt;code&gt;&amp;lt;time&amp;gt;&lt;/code&gt; Element&amp;#8217;s &lt;code&gt;datetime&lt;/code&gt; Attribute&lt;/h3&gt;

&lt;p&gt;Interpreting the &lt;code&gt;datetime&lt;/code&gt; attribute of the &lt;code&gt;&amp;lt;time&amp;gt;&lt;/code&gt; element to supply a value, rather than repeating that value in a &lt;code&gt;content&lt;/code&gt; attribute, is &lt;a href=&quot;http://www.w3.org/2010/02/rdfa/track/issues/97&quot;&gt;ISSUE-97&lt;/a&gt; on RDFa, and hopefully RDFa will be changed to use that value (or the content of the element if there is no &lt;code&gt;datetime&lt;/code&gt; attribute), add a seconds component if necessary, and work out an appropriate date/time datatype for it based on its syntax.&lt;/p&gt;

&lt;h3&gt;Content Overrides&lt;/h3&gt;

&lt;p&gt;In RDFa, publishers can provide a machine-readable version of the content of an element (or even an entirely different value) using the &lt;code&gt;content&lt;/code&gt; attribute. This can only be done for date/times in microdata. The ability to &lt;a href=&quot;http://www.w3.org/Bugs/Public/show_bug.cgi?id=13240&quot;&gt;annotate non-date/time content with machine-readable values&lt;/a&gt; is a current issue on HTML5. Resolving this in favour of providing such annotation would make using RDFa and microdata in concert, or converting between them, easier, particularly if HTML5 uses the attribute &lt;code&gt;content&lt;/code&gt; or RDFa adopts whatever attribute is introduced to HTML5.&lt;/p&gt;

&lt;h3&gt;&lt;code&gt;&amp;lt;link&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;meta&amp;gt;&lt;/code&gt; Elements in Flow Content&lt;/h3&gt;

&lt;p&gt;The ability to &lt;a href=&quot;http://dev.w3.org/html5/md/Overview.html#content-models&quot;&gt;use &lt;code&gt;&amp;lt;link&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;meta&amp;gt;&lt;/code&gt; elements in flow content&lt;/a&gt; is only supported in microdata: it&amp;#8217;s support that&amp;#8217;s added by the microdata specification (in the Editor&amp;#8217;s Draft since May 31st; the text allowing this didn&amp;#8217;t make it into the Last Call version of the spec), in which it&amp;#8217;s limited to &lt;code&gt;&amp;lt;link&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;meta&amp;gt;&lt;/code&gt; elements with an &lt;code&gt;itemprop&lt;/code&gt; attribute. &lt;/p&gt;

&lt;p&gt;It would be possible for the RDFa specification to similarly make the statement that &lt;code&gt;&amp;lt;link&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;meta&amp;gt;&lt;/code&gt; elements are allowed in flow content as long as they have particular attributes. This would ease the transition between the two formats, and works a lot better than empty &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt; elements which crop up fairly commonly in RDFa content.&lt;/p&gt;

&lt;p&gt;(One oddity here is that because date/time values have to be on a &lt;code&gt;&amp;lt;time&amp;gt;&lt;/code&gt; element in microdata, publishers cannot replace empty &lt;code&gt;&amp;lt;time&amp;gt;&lt;/code&gt; elements with &lt;code&gt;&amp;lt;meta&amp;gt;&lt;/code&gt; elements as they might an empty &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt;.)&lt;/p&gt;

&lt;h3&gt;Identifiers without Types&lt;/h3&gt;

&lt;p&gt;Many of the RDFa examples are of resources that have a URI identifier but for which no type is supplied. Microdata, on the other hand, states that &lt;code&gt;itemid&lt;/code&gt; is only allowed on elements that also have an &lt;code&gt;itemtype&lt;/code&gt; (and an &lt;code&gt;itemscope&lt;/code&gt;). The reason given is because the &lt;code&gt;itemid&lt;/code&gt; needs to be interpreted based on the &lt;code&gt;itemtype&lt;/code&gt;. This would be understandable if it held a string, but given that the &lt;code&gt;itemid&lt;/code&gt; provides a URI it seems a bit strange. Perhaps it&amp;#8217;s an attempt to avoid the whole &lt;a href=&quot;http://www.jenitennison.com/blog/node/159&quot;&gt;httpRange-14 / ambiguity in URIs issue&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If this restriction remains, the advice to RDFa users who might want to convert to microdata at a future date would be to always provide a type for your (non-blank-node) resources. It may be useful to define a &lt;code&gt;http://w3.org/ns/global/Thing&lt;/code&gt; within the vocabulary that I propose above, given that the URI for &lt;code&gt;rdfs:Resource&lt;/code&gt; is long and hard to recall.&lt;/p&gt;

&lt;h3&gt;Built-in Prefixes&lt;/h3&gt;

&lt;p&gt;The built-in &lt;a href=&quot;http://www.w3.org/profile/rdfa-1.1&quot;&gt;profile for RDFa&lt;/a&gt; defines a number of prefixes for vocabularies that are either coined by the W3C or coined elsewhere but in common use on the web. This, coupled with &lt;code&gt;vocab&lt;/code&gt; and the ability to directly use URIs in the relevant attributes, means that declaring prefixes within the document is increasingly unnecessary in RDFa.&lt;/p&gt;

&lt;p&gt;In contrast, using existing vocabularies, even popular ones, within microdata is relatively difficult, particularly when vocabularies are mixed on the same item.&lt;/p&gt;

&lt;p&gt;Most useful for publishers would be if both RDFa and microdata recognised the same set of prefixes. This would reduce the size of microdata created from existing RDFa content as well as making it easier to move between the languages. At the very least, it would be good to have &lt;code&gt;rdf:&lt;/code&gt;, &lt;code&gt;rdfs:&lt;/code&gt;, &lt;code&gt;xsd:&lt;/code&gt; and &lt;code&gt;xhv:&lt;/code&gt; built into both.&lt;/p&gt;

&lt;p&gt;The list of popular vocabularies is likely to change over time; for example a prefix for the schema.org vocabulary might be useful at some point in the near future. The problem is that publishers and consumers need to be synchronised in their use of prefixes: it&amp;#8217;s no good for a publisher to use the prefix &lt;code&gt;sch:&lt;/code&gt; if there might be processors for the page that don&amp;#8217;t recognise it. Equally, consumers shouldn&amp;#8217;t be reliant on a network connection to retrieve the latest set of prefix mappings in order to parse the page. It&amp;#8217;s not clear to me how best to manage this evolution, but even a fixed set of prefixes at the point the specs reach Recommendation is more usable than spelling out URIs all the time.&lt;/p&gt;

&lt;h3&gt;Literals Including Markup&lt;/h3&gt;

&lt;p&gt;RDFa supports literals that include markup (the &lt;code&gt;innerHTML&lt;/code&gt; of an element) as well as those that don&amp;#8217;t (the &lt;code&gt;textContent&lt;/code&gt; of an element), whereas microdata only supports creating values from particular attributes or the &lt;code&gt;textContent&lt;/code&gt; of the element. This makes it hard to create embedded microdata that includes values which contain things like mathematical or chemical formulae, ruby text, or multiple paragraphs.&lt;/p&gt;

&lt;p&gt;A solution would be for microdata to introduce an &lt;code&gt;itemhtml&lt;/code&gt; (or something) attribute that, when present, indicates that the value of the property should include markup. There is a current issue on microdata to &lt;a href=&quot;http://www.w3.org/Bugs/Public/show_bug.cgi?id=13468&quot;&gt;support HTML values&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;Itemref&lt;/h3&gt;

&lt;p&gt;RDFa can support a subset of &lt;code&gt;itemref&lt;/code&gt;&amp;#8217;s functionality, namely to have properties defined elsewhere in a document be associated with a given resource. What it doesn&amp;#8217;t support is the sharing of properties defined in one place by two or more resources.&lt;/p&gt;

&lt;p&gt;RDFa could add such support by adding an attribute that mirrors &lt;code&gt;itemref&lt;/code&gt; (eg &lt;code&gt;ref&lt;/code&gt;, I guess), with the referenced element being processed using the &lt;a href=&quot;http://www.w3.org/TR/rdfa-core/#evaluation-context&quot;&gt;evaluation context&lt;/a&gt; inherited by the referencing element (which means that attributes such as &lt;code&gt;vocab&lt;/code&gt; would sometimes have a scope that wasn&amp;#8217;t based on the document tree). This would make it easier to tackle the use case for &lt;code&gt;itemref&lt;/code&gt; using RDFa as well as making it easier to move between or mix RDFa and microdata.&lt;/p&gt;

&lt;h3&gt;Lists&lt;/h3&gt;

&lt;p&gt;It is easy for microdata to represent a property with a list of values, and really really hard to do the same in RDFa. This is in part because RDF views lists resources rather than a distinct data type, and in part because RDFa hasn&amp;#8217;t added any syntax sugar to make creating &lt;code&gt;rdf:List&lt;/code&gt; resources easy. Adding some syntax sugar for lists would make life a lot easier for anyone using RDFa, but especially if they are adapting existing microdata content to RDFa.&lt;/p&gt;

&lt;h3&gt;Datatypes&lt;/h3&gt;

&lt;p&gt;Microdata assumes that consumers will convert values to appropriate datatypes based on the property (which they understand) as a separate process after microdata processing, whereas RDFa supports the use of a &lt;code&gt;datatype&lt;/code&gt; attribute to explicitly indicate the datatype of each value. This mismatch means that information is lost when RDFa is converted to microdata, and has to be added when microdata is converted to RDFa.&lt;/p&gt;

&lt;p&gt;Bringing the languages completely into sync would mean either microdata adding a facility to support (at least some) datatypes, or deprecating the &lt;code&gt;datatype&lt;/code&gt; attribute in RDFa. Alternatively, this may simply be an area where the differences in behaviour between the two specifications doesn&amp;#8217;t matter because the data models that they use are distinct anyway.&lt;/p&gt;

&lt;h3&gt;Languages&lt;/h3&gt;

&lt;p&gt;Languages are similar to datatypes, in that RDF (and hence RDFa) supports annotating strings with the language that they are in whereas microdata doesn&amp;#8217;t within its core data model or its JSON serialisation. However, the elements that represent properties within the HTML, used within the DOM API access to microdata, will have a language.&lt;/p&gt;

&lt;p&gt;It may be that in practice consumers need to base their microdata processing on the DOM API rather than the core microdata data model or JSON extracted through a standalone process, and thus pick up the language from the property elements, I don&amp;#8217;t know. In any case, the microdata JSON serialisation, used for drag-and-drop, is lossy and could be extended to include the language of each value when available, at fairly substantial complexity cost.&lt;/p&gt;

&lt;p&gt;For publishers, it doesn&amp;#8217;t much matter either way; if they are dealing with multi-lingual text they will want to include a &lt;code&gt;lang&lt;/code&gt; attribute in the HTML anyway, regardless of the impact on embedded data.&lt;/p&gt;

&lt;h3&gt;Multiple Types&lt;/h3&gt;

&lt;p&gt;RDFa supports having multiple types named in the &lt;code&gt;typeof&lt;/code&gt; attribute whereas microdata only supports one type per item. In any mapping from RDFa to microdata, publishers have to choose which type is the primary type for the item and move the others to be expressed via &lt;code&gt;rdf:type&lt;/code&gt; properties. Consumers who want to support publishers who might not choose their type as the primary type have to detect items that have the type they are interested in within the &lt;code&gt;rdf:type&lt;/code&gt; property as well as those which have the type as the main type. Given that the &lt;code&gt;rdf:type&lt;/code&gt; URI is long and (naturally) associated with RDF, it might be better to define a property such as &lt;code&gt;http://w3.org/ns/global/type&lt;/code&gt; for this use.&lt;/p&gt;

&lt;p&gt;Microdata could be extended to allow multiple values in the &lt;code&gt;itemtype&lt;/code&gt; attribute, with the first being used to interpret any properties that aren&amp;#8217;t full URIs. This would make it easier for both consumers to detect when a type they were interested in was used and for publishers to use RDFa and microdata in tandem or move between them.&lt;/p&gt;

&lt;h3&gt;The &lt;code&gt;src&lt;/code&gt; Attribute&lt;/h3&gt;

&lt;p&gt;RDFa and microdata interpret the &lt;code&gt;src&lt;/code&gt; attribute in opposite ways. In RDFa, it provides the identifier for a new resource (equivalent to &lt;code&gt;itemid&lt;/code&gt; in microdata); in microdata, it provides a URL value of a property on elements that support it (equivalent to &lt;code&gt;resource&lt;/code&gt; or &lt;code&gt;href&lt;/code&gt; in RDFa).&lt;/p&gt;

&lt;p&gt;RDFa interprets &lt;code&gt;src&lt;/code&gt; in this way to make it easier to make assertions about an image, but it&amp;#8217;s of limited effect as even in RDFa its only possible to make three such assertions (through the &lt;code&gt;typeof&lt;/code&gt;, &lt;code&gt;rel&lt;/code&gt; and &lt;code&gt;property&lt;/code&gt; attributes). So, for example, you can specify the type of the image, link to its license and give the name of its creator, with:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;img src=&quot;photo1.jpg&quot; typeof=&quot;foaf:Image&quot;
  rel=&quot;license&quot; resource=&quot;http://creativecommons.org/licenses/by/2.0/&quot;
  property=&quot;dc:creator&quot; content=&quot;Mark Birbeck&quot;&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;but this won&amp;#8217;t help you if you &lt;em&gt;also&lt;/em&gt; want to give the title for the image and when it was created (say). At that point, the microdata and RDFa start to look similar:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div itemscope itemid=&quot;photo1.jpg&quot; itemtype=&quot;http://xmlns.com/foaf/0.1/Image&quot;&amp;gt;
  &amp;lt;link itemprop=&quot;license&quot; href=&quot;http://creativecommons.org/licenses/by/2.0/&quot;&amp;gt;
  &amp;lt;meta itemprop=&quot;http://purl.org/dc/terms/creator&quot; content=&quot;Mark Birbeck&quot;&amp;gt;
  &amp;lt;meta itemprop=&quot;http://purl.org/dc/terms/title&quot; content=&quot;Picture of Mark&quot;&amp;gt;
  &amp;lt;time itemprop=&quot;http://purl.org/dc/terms/created&quot; datetime=&quot;2009-03-17&quot;&amp;gt;&amp;lt;/time&amp;gt;
  &amp;lt;img src=&quot;photo1.jpg&quot;&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;or:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div about=&quot;photo1.jpg&quot; typeof=&quot;http://xmlns.com/foaf/0.1/Image&quot;&amp;gt;
  &amp;lt;span property=&quot;http://purl.org/dc/terms/title&quot; content=&quot;Picture of Mark&quot;&amp;gt;&amp;lt;/span&amp;gt;
  &amp;lt;time property=&quot;http://purl.org/dc/terms/created&quot; content=&quot;2009-03-17&quot; datatype=&quot;xsd:date&quot; datetime=&quot;2009-03-17&quot;&amp;gt;&amp;lt;/time&amp;gt;
  &amp;lt;img src=&quot;photo1.jpg&quot; typeof=&quot;foaf:Image&quot;
    rel=&quot;license&quot; resource=&quot;http://creativecommons.org/licenses/by/2.0/&quot;
    property=&quot;dc:creator&quot; content=&quot;Mark Birbeck&quot;&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;and really, to make the markup consistent, you may as well not use the &lt;code&gt;src&lt;/code&gt; of the image at all in the RDFa either:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div about=&quot;photo1.jpg&quot; typeof=&quot;http://xmlns.com/foaf/0.1/Image&quot;&amp;gt;
  &amp;lt;span rel=&quot;license&quot; href=&quot;http://creativecommons.org/licenses/by/2.0/&quot;&amp;gt;&amp;lt;/span&amp;gt;
  &amp;lt;span property=&quot;http://purl.org/dc/terms/creator&quot; content=&quot;Mark Birbeck&quot;&amp;gt;&amp;lt;/span&amp;gt;
  &amp;lt;span property=&quot;http://purl.org/dc/terms/title&quot; content=&quot;Picture of Mark&quot;&amp;gt;&amp;lt;/span&amp;gt;
  &amp;lt;time property=&quot;http://purl.org/dc/terms/created&quot; content=&quot;2009-03-17&quot; datatype=&quot;xsd:date&quot; datetime=&quot;2009-03-17&quot;&amp;gt;&amp;lt;/time&amp;gt;
  &amp;lt;img src=&quot;photo1.jpg&quot;&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;So it&amp;#8217;s not clear to me that interpreting the &lt;code&gt;src&lt;/code&gt; attribute as the subject of triples offers such a huge advantage that it&amp;#8217;s worth the inconvenience that it brings for the simple things, such as having to use:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;span rel=&quot;image&quot;&amp;gt;&amp;lt;img src=&quot;google-logo.png&quot; alt=&quot;Google&quot;&amp;gt;&amp;lt;/span&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;rather than:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;img property=&quot;image&quot; src=&quot;google-logo.png&quot; alt=&quot;Google&quot;&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;Link relations&lt;/h3&gt;

&lt;p&gt;This isn&amp;#8217;t so much a clash between RDFa and microdata as between the interpretation that RDFa has for the &lt;code&gt;rel&lt;/code&gt; attribute and that specified in HTML.&lt;/p&gt;

&lt;p&gt;The built-in &lt;code&gt;rel&lt;/code&gt; values in HTML are a bit of a mix. Some of them, like &lt;code&gt;alternate&lt;/code&gt;, &lt;code&gt;prev&lt;/code&gt; and &lt;code&gt;next&lt;/code&gt; encode relationships between the document in which the link appears and another document. Others, such as &lt;code&gt;bookmark&lt;/code&gt; and &lt;code&gt;help&lt;/code&gt;, create relationships between the context in which the link is found and the referenced document. Still others, like &lt;code&gt;nofollow&lt;/code&gt;, &lt;code&gt;noreferrer&lt;/code&gt; and &lt;code&gt;prefetch&lt;/code&gt;, are really instructions to the client about how to manage the act of traversing the link.&lt;/p&gt;

&lt;p&gt;It doesn&amp;#8217;t seem semantically correct to automatically create relationships based on the built-in HTML &lt;code&gt;rel&lt;/code&gt; values, unless you are deliberately trying to extract &lt;a href=&quot;http://lin-clark.com/blog/two-meanings-semantics-html5&quot;&gt;&lt;em&gt;document&lt;/em&gt; semantics&lt;/a&gt; from the page. This is a problem for RDFa, which reuses the &lt;code&gt;rel&lt;/code&gt; attribute to provide property values for the embedded &lt;em&gt;data&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;One thing that could be done would be for RDFa to consistently use the &lt;code&gt;property&lt;/code&gt; attribute everywhere rather than the &lt;code&gt;rel&lt;/code&gt; attribute. This would not only ease the overloading but also reduce the confusion for users, who currently have to work out which attribute to use based on whether the value is a resource or a literal.&lt;/p&gt;

&lt;h2&gt;Possible Subset of RDFa&lt;/h2&gt;

&lt;p&gt;When mapping from microdata to RDFa, the only attributes that are really needed are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;vocab&lt;/code&gt; to define a vocabulary for the types and properties within its scope (not technically necessary, but keeps the markup simple compared to spelling out URIs for everything)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;typeof&lt;/code&gt; to define the type of a resource or indicate a new blank node&lt;/li&gt;
&lt;li&gt;&lt;code&gt;about&lt;/code&gt; to provide a URI for a resource or a local identifier for a blank node&lt;/li&gt;
&lt;li&gt;&lt;code&gt;property&lt;/code&gt; and &lt;code&gt;rel&lt;/code&gt; to define property names (though see above for discussion about dropping &lt;code&gt;rel&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;href&lt;/code&gt;, &lt;code&gt;src&lt;/code&gt; and &lt;code&gt;content&lt;/code&gt; to provide values (and &lt;code&gt;datetime&lt;/code&gt; assuming that is supported)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In the mappings in the analysis below, I did also use the &lt;code&gt;resource&lt;/code&gt; attribute, but only to create a reference to a blank node that was described elsewhere, when replicating the functionality of &lt;code&gt;itemref&lt;/code&gt;. If RDFa were to enable &lt;code&gt;&amp;lt;link&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;meta&amp;gt;&lt;/code&gt; in content in the same way as microdata, &lt;code&gt;resource&lt;/code&gt; functionality could be replicated using &lt;code&gt;&amp;lt;link&amp;gt;&lt;/code&gt;; as it is, you can get away with using an empty &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; element.&lt;/p&gt;

&lt;p&gt;Similarly, I only used &lt;code&gt;datatype&lt;/code&gt; when providing a datatype for date/time values, something that could be done automatically by RDFa. But this isn&amp;#8217;t surprising given that microdata doesn&amp;#8217;t support datatypes at all and the examples I was using for the mapping were from the microdata specification.&lt;/p&gt;

&lt;p&gt;There was no need for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;prefix&lt;/code&gt; which defines prefixes to simplify references to properties and classes; this is hardly surprising as few of the microdata examples involved mixing namespaces, but it&amp;#8217;s notable that the built-in prefixes of &lt;code&gt;rdf:&lt;/code&gt; and &lt;code&gt;xsd:&lt;/code&gt; were useful&lt;/li&gt;
&lt;li&gt;&lt;code&gt;profile&lt;/code&gt; which is a pointer to an external document that defines a set of terms; this is being dropped from RDFa in any case&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I also kept to a simplified version of the syntax in which each property element only provided one value. This subset is basically:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;resource elements can have &lt;code&gt;about&lt;/code&gt; (equivalent to &lt;code&gt;itemid&lt;/code&gt;) and &lt;code&gt;typeof&lt;/code&gt; (equivalent to &lt;code&gt;itemtype&lt;/code&gt;) attributes on them&lt;/li&gt;
&lt;li&gt;property elements can have &lt;code&gt;property&lt;/code&gt; or &lt;code&gt;rel&lt;/code&gt; (equivalent to &lt;code&gt;itemprop&lt;/code&gt;), and a value-providing attribute on them such as &lt;code&gt;href&lt;/code&gt; or &lt;code&gt;content&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;no element is both a resource element and a property element; to provide a property whose value is a resource, nest the resource element within the property element (using &amp;#8220;hanging rel&amp;#8221; processing)&lt;/li&gt;
&lt;li&gt;no property element should provide more than one value for a property; in particular, a &amp;#8220;hanging rel&amp;#8221; should only have a single resource element child&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This simplified profile of RDFa is fairly easy to remember and maps easily to and from microdata: most attributes can be simply renamed; the only attribute that needs to be moved as well as renamed is the &amp;#8220;hanging rel&amp;#8221;, which moves onto the resource element and is renamed to &lt;code&gt;itemprop&lt;/code&gt;. Note that it also means avoiding using the &lt;code&gt;src&lt;/code&gt; attribute to encode embedded data.&lt;/p&gt;

&lt;p&gt;In addition to sticking to this subset of attributes, developers might be advised that using HTML link relations may lead to clashes with browser or search engine interpretation of the links in the page.&lt;/p&gt;

&lt;h2&gt;Possible Subset of Microdata&lt;/h2&gt;

&lt;p&gt;Microdata is pretty minimalistic already. The only feature that developers need to be warned about is &lt;code&gt;itemref&lt;/code&gt;, which has no RDFa equivalent at the moment.&lt;/p&gt;

&lt;h2&gt;Guidelines for Vocabulary Authors&lt;/h2&gt;

&lt;p&gt;There are a several guidelines that come out of this comparison for people putting together vocabularies that aim to be usable in both RDFa and microdata:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The classes in the vocabulary should be distinct, or subclasses created with any relevant combinations of superclasses, so that publishers don&amp;#8217;t have to assign more than one type to an item/resource. This restriction helps with using the vocabulary with microdata, which assumes that every item has a single type.&lt;/li&gt;
&lt;li&gt;Provide explicit classes for everything which you anticipate might be given an identifier, as microdata doesn&amp;#8217;t (currently) enable items to have an identifier without also having a type.&lt;/li&gt;
&lt;li&gt;Put classes and properties in the same namespace, but do not name classes and properties with the same local name; while this doesn&amp;#8217;t matter in microdata because the properties are interpreted relative to the class, standard conversions to RDF will create a class and a property with the same URI. URIs are case-sensitive to a simple way of ensuring that there aren&amp;#8217;t clashes is to follow the usual RDF convention of beginning class names with an upper-case letter and property names with a lower-case letter.&lt;/li&gt;
&lt;li&gt;Avoid property names that contain dots, as these aren&amp;#8217;t allowed in non-URI property names in microdata.&lt;/li&gt;
&lt;li&gt;Ensure that properties either only expect one type of value or expect values whose type can be sniffed based on the syntax of the value. If publishers use microdata, they will not be able to indicate the type of a value through the markup.&lt;/li&gt;
&lt;li&gt;Be aware that consumers of microdata using your vocabulary will have to use the DOM API to identify the language used in any strings, and that language information won&amp;#8217;t be carried through the standard microdata JSON serialisation (used by drag-and-drop, for example). If you anticipate multi-lingual use of your vocabulary, you may way to define a &lt;code&gt;MultiLingual&lt;/code&gt; class with &lt;code&gt;value&lt;/code&gt; and &lt;code&gt;language&lt;/code&gt; properties that people can use as nested items. (It may be useful for this class and properties to be defined in the proposed &amp;#8216;global&amp;#8217; W3C namespace so that it can be used anywhere.) If you know what languages will be used then provide separate properties for each language (eg for UK legislation I know the languages are English and Welsh so on a vocabulary for UK Legislation I could have &lt;code&gt;title-en&lt;/code&gt; and &lt;code&gt;title-cy&lt;/code&gt; properties).&lt;/li&gt;
&lt;li&gt;To make markup cleaner, only reuse properties from other vocabularies on your classes if they have built-in prefixes (eg unless &lt;code&gt;rdfs:&lt;/code&gt; is built-in to microdata as well as RDFa, don&amp;#8217;t use &lt;code&gt;rdfs:label&lt;/code&gt; to provide a label, but create your own &lt;code&gt;label&lt;/code&gt; property). On the other hand, do reuse classes from other vocabularies if you don&amp;#8217;t need to add any specialised properties to them. Note that avoiding reuse has the unfortunate side-effect of not enabling processors that understand these other vocabularies to process your data.&lt;/li&gt;
&lt;li&gt;Avoid having properties whose values need to be retrieved in order, as these are hard to represent in RDFa. Instead, use properties with distinct names when position is important. (Yes, I know this sucks.)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Choosing Between Microdata and RDFa&lt;/h2&gt;

&lt;p&gt;The choices developers make between microdata and RDFa will, I suspect, be largely dictated by what their consumers/toolsets/publishers will support. Nevertheless, there are some features that are better supported by one or other format and might therefore sway developers one way or another:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;multi-lingual embedded data&lt;/strong&gt; is better supported in RDF than microdata+JSON&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;explicit datatypes for values&lt;/strong&gt; can be provided by RDFa but not microdata&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;resources with multiple types&lt;/strong&gt; are a lot easier to describe in RDFa&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;property values that include markup&lt;/strong&gt; are a lot easier to write in RDFa&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;mixed vocabulary use&lt;/strong&gt; is a bit easier in RDFa than in microdata&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;HTML5 link relations&lt;/strong&gt; may be misinterpreted by RDFa processors&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;properties with list values&lt;/strong&gt; are much easier to support in microdata&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;common content&lt;/strong&gt; adopted by multiple entities is much easier in microdata&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Final Words&lt;/h2&gt;

&lt;p&gt;I have no doubt that developers would be better off if there were only one recommended way of embedding data in HTML (so long as it met their requirements of course). But realistically that is, and always has been, a long shot, given the entrenched positions of the microdata and RDFa communities.&lt;/p&gt;

&lt;p&gt;Regardless, there are lessons that RDFa and microdata could learn from each other, and changes to both languages that would help developers use them on their own, switch between them and mix them in the same document. I expect and welcome debate about the viability and effectiveness of the changes and guidelines that I&amp;#8217;ve suggested here.&lt;/p&gt;

&lt;p&gt;Investigating those lessons, documenting those changes and generating those guidelines was something that I had hoped the microdata/RDFa task force would be able to do. The other question to ask, given the argument that there shouldn&amp;#8217;t be a task force at all if it&amp;#8217;s not going to be able to bring the languages together, is whether this kind of analysis is worthwhile, and worth publishing as something more official than a blog post?&lt;/p&gt;
</description>
 <comments>http://www.jenitennison.com/blog/node/165#comments</comments>
 <category domain="http://www.jenitennison.com/blog/taxonomy/term/71">microdata</category>
 <category domain="http://www.jenitennison.com/blog/taxonomy/term/42">rdfa</category>
 <pubDate>Sat, 20 Aug 2011 16:39:11 +0000</pubDate>
 <dc:creator>Jeni</dc:creator>
 <guid isPermaLink="false">165 at http://www.jenitennison.com/blog</guid>
</item>
<item>
 <title>Mapping RDFa to Microdata</title>
 <link>http://www.jenitennison.com/blog/node/164</link>
 <description>&lt;p&gt;This post is part of a three-part series that analyses the differences in features and syntax between microdata and RDFa. The series attempts:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;to identify the differences in approach and functionality of the two languages, which should help developers choose between them&lt;/li&gt;
&lt;li&gt;to identify any guidelines for developers of vocabularies for use with both languages&lt;/li&gt;
&lt;li&gt;to identify a subset of functionality that is common between the two languages, which developers might want to stick to to make switching and mixing easier&lt;/li&gt;
&lt;li&gt;to identify mapping rules that might be applied to automatically or manually map from one language to another if the simple subset is used&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I&amp;#8217;ve done this by looking at converting microdata examples to RDFa and vice versa, and the lessons to be drawn from that exercise. The three posts are on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.jenitennison.com/blog/node/163&quot;&gt;converting microdata to RDFa&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.jenitennison.com/blog/node/164&quot;&gt;converting RDFa to microdata&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.jenitennison.com/blog/node/165&quot;&gt;lessons learned from this exercise&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This post is the second of these, which looks at how RDFa might be mapped to microdata.  In this case, I will aim to express the RDF created from the RDFa as the equivalent microdata JSON, and aim to create that JSON with the microdata.&lt;/p&gt;

&lt;!--break--&gt;

&lt;p&gt;To create the microdata JSON, I&amp;#8217;ve used the rule that the URI of the first type of a resource is processed to provide a namespace that is stripped from the URIs of the properties (to create simple names where possible). In addition, when a resource has no properties, it will be represented as a string (URI) value rather than as a nested item. Other than that I hope the mapping will be obvious; I&amp;#8217;ll point out where it involves a loss of information. I&amp;#8217;m assuming that the document is at &lt;code&gt;http://example.org/&lt;/code&gt; throughout.&lt;/p&gt;

&lt;p&gt;I have based what&amp;#8217;s written here on the latest specifications of both microdata (in its &lt;a href=&quot;http://www.whatwg.org/specs/web-apps/current-work/multipage/microdata.html&quot;&gt;WHAT WG&lt;/a&gt; and &lt;a href=&quot;http://dev.w3.org/html5/md/Overview.html&quot;&gt;W3C&lt;/a&gt; variants) and &lt;a href=&quot;http://www.w3.org/2010/02/rdfa/drafts/2011/ED-rdfa-core-20110814/&quot;&gt;RDFa Core&lt;/a&gt; and &lt;a href=&quot;http://dev.w3.org/html5/rdfa/&quot;&gt;HTML+RDFa&lt;/a&gt; but I haven&amp;#8217;t consulted with anyone involved in these efforts and may well have got things wrong. &lt;a href=&quot;http://foolip.org/microdatajs/live/&quot;&gt;Philip Jägenstedt&amp;#8217;s Live Microdata service&lt;/a&gt; has proved invaluable for testing, so many thanks to him for providing that service.&lt;/p&gt;

&lt;p&gt;The post is rather heavy going and you might want to just &lt;a href=&quot;http://www.jenitennison.com/blog/node/165&quot;&gt;skip to the summary&lt;/a&gt; instead of reading the whole thing.&lt;/p&gt;

&lt;p&gt;The post goes through the examples from the RDFa specification plus one additional example from the wild. I haven&amp;#8217;t included examples that don&amp;#8217;t illustrate anything new, so there are some that are skipped. Other examples would be welcome.&lt;/p&gt;

&lt;h2&gt;Page Metadata&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;When parsing begins, the current subject will be the IRI of the document being parsed, or a value as set by a Host Language-provided mechanism (e.g., the base element in (X)HTML). This means that by default any metadata found in the document will concern the document itself:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;html&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;title&amp;gt;Jo&#039;s Friends and Family Blog&amp;lt;/title&amp;gt;
    &amp;lt;link rel=&quot;foaf:primaryTopic&quot; href=&quot;#bbq&quot; /&amp;gt;
    &amp;lt;meta property=&quot;dc:creator&quot; content=&quot;Jo&quot; /&amp;gt;
  &amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    ...
  &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;The equivalent microdata JSON for this document that we&amp;#8217;d want to create is (&lt;strong&gt;note: invalid example&lt;/strong&gt;):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{ &quot;items&quot;: [
  {
    &quot;id&quot;: &quot;http://example.org/&quot; ,
    &quot;properties&quot;: {
      &quot;http://xmlns.com/foaf/0.1/primaryTopic&quot;: [ &quot;http://example.org/#bbq&quot; ],
      &quot;http://purl.org/dc/terms/creator&quot;: [ &quot;Jo&quot; ]
    }
  }
]}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;and we&amp;#8217;d want to create it with (&lt;strong&gt;note: invalid example&lt;/strong&gt;):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;html&amp;gt;
  &amp;lt;head itemscope itemid=&quot;.&quot;&amp;gt;
    &amp;lt;title&amp;gt;Jo&#039;s Friends and Family Blog&amp;lt;/title&amp;gt;
    &amp;lt;link itemprop=&quot;http://xmlns.com/foaf/0.1/primaryTopic&quot; href=&quot;#bbq&quot; /&amp;gt;
    &amp;lt;meta itemprop=&quot;http://purl.org/dc/terms/creator&quot; content=&quot;Jo&quot; /&amp;gt;
  &amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    ...
  &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;However, this is is not valid according to the microdata specification. In microdata, &lt;a href=&quot;http://www.whatwg.org/specs/web-apps/current-work/multipage/microdata.html#attr-itemid&quot;&gt;only items that have types are allowed to have identifiers&lt;/a&gt;. Rather than losing the identifier, we&amp;#8217;ll add a type; I&amp;#8217;m going to use &lt;code&gt;rdfs:Resource&lt;/code&gt;. It&amp;#8217;s not the nicest of URIs to type, but it&amp;#8217;s got something close to the correct semantics. So we&amp;#8217;ll aim for the microdata JSON:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{ &quot;items&quot;: [
  {
    &quot;type&quot;: &quot;http://www.w3.org/2000/01/rdf-schema#Resource&quot; ,
    &quot;id&quot;: &quot;http://example.org/&quot; ,
    &quot;properties&quot;: {
      &quot;http://xmlns.com/foaf/0.1/primaryTopic&quot;: [ &quot;http://example.org/#bbq&quot; ] ,
      &quot;http://purl.org/dc/terms/creator&quot;: [ &quot;Jo&quot; ]
    }
  }
]}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;which means we need:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;html&amp;gt;
  &amp;lt;head itemscope itemtype=&quot;http://www.w3.org/2000/01/rdf-schema#Resource&quot; itemid=&quot;.&quot;&amp;gt;
    &amp;lt;title&amp;gt;Jo&#039;s Friends and Family Blog&amp;lt;/title&amp;gt;
    &amp;lt;link itemprop=&quot;http://xmlns.com/foaf/0.1/primaryTopic&quot; href=&quot;#bbq&quot; /&amp;gt;
    &amp;lt;meta itemprop=&quot;http://purl.org/dc/terms/creator&quot; content=&quot;Jo&quot; /&amp;gt;
  &amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    ...
  &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Notes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;itemscope&lt;/code&gt; is necessary for the page to be recognised as containing any data at all.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;itemid&lt;/code&gt; can&amp;#8217;t just be empty: the &lt;code&gt;.&lt;/code&gt; is the shortest URI you can use to reference the page itself.&lt;/li&gt;
&lt;li&gt;I put the &lt;code&gt;itemscope&lt;/code&gt;, &lt;code&gt;itemtype&lt;/code&gt; and &lt;code&gt;itemid&lt;/code&gt; on the &lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt; element rather than the &lt;code&gt;&amp;lt;html&amp;gt;&lt;/code&gt; element so that they wouldn&amp;#8217;t be inherited into the &lt;code&gt;&amp;lt;body&amp;gt;&lt;/code&gt;: it seems to make sense for any data within the &lt;code&gt;&amp;lt;head&amp;gt;&lt;/code&gt; to be about the page itself.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;foaf:&lt;/code&gt; and &lt;code&gt;dc:&lt;/code&gt; prefixes are built-in to RDFa, so it&amp;#8217;s easy for people to use classes and properties in those common vocabularies without having to remember their full URI. In microdata, that URI and the one for the &lt;code&gt;rdfs:Resource&lt;/code&gt; class have to be spelled out in full.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Base URI&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;In (X)HTML the value of base may change the initial value of current subject:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;html&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;base href=&quot;http://www.example.org/jo/blog&quot; /&amp;gt;
    &amp;lt;title&amp;gt;Jo&#039;s Friends and Family Blog&amp;lt;/title&amp;gt;
    &amp;lt;link rel=&quot;foaf:primaryTopic&quot; href=&quot;#bbq&quot; /&amp;gt;
    &amp;lt;meta property=&quot;dc:creator&quot; content=&quot;Jo&quot; /&amp;gt;
  &amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    ...
  &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;This changes the id of the item generated:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{ &quot;items&quot;: [
  {
    &quot;type&quot;: &quot;http://www.w3.org/2000/01/rdf-schema#Resource&quot; ,
    &quot;id&quot;: &quot;http://www.example.org/jo/blog&quot; ,
    &quot;properties&quot;: {
      &quot;http://xmlns.com/foaf/0.1/primaryTopic&quot;: [ &quot;http://www.example.org/jo/blog#bbq&quot; ] ,
      &quot;http://purl.org/dc/terms/creator&quot;: [ &quot;Jo&quot; ]
    }
  }
]}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;In the microdata, the &lt;code&gt;itemid&lt;/code&gt; can still be &lt;code&gt;.&lt;/code&gt; as the base URI set by the &lt;code&gt;&amp;lt;base&amp;gt;&lt;/code&gt; element is used to resolve it:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;html&amp;gt;
  &amp;lt;head itemscope itemtype=&quot;http://www.w3.org/2000/01/rdf-schema#Resource&quot; itemid=&quot;.&quot;&amp;gt;
    &amp;lt;base href=&quot;http://www.example.org/jo/blog&quot; /&amp;gt;
    &amp;lt;title&amp;gt;Jo&#039;s Friends and Family Blog&amp;lt;/title&amp;gt;
    &amp;lt;link itemprop=&quot;http://xmlns.com/foaf/0.1/primaryTopic&quot; href=&quot;#bbq&quot; /&amp;gt;
    &amp;lt;meta itemprop=&quot;http://purl.org/dc/terms/creator&quot; content=&quot;Jo&quot; /&amp;gt;
  &amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    ...
  &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Explicit Subjects / ItemIds&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;To illustrate how this affects the statements, note in this markup how the properties inside the (X)HTML body element become part of a new calendar event object, rather than referring to the document as they do in the head of the document:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;html prefix=&quot;cal: http://www.w3.org/2002/12/cal/ical#&quot;&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;title&amp;gt;Jo&#039;s Friends and Family Blog&amp;lt;/title&amp;gt;
    &amp;lt;link rel=&quot;foaf:primaryTopic&quot; href=&quot;#bbq&quot; /&amp;gt;
    &amp;lt;meta property=&quot;dc:creator&quot; content=&quot;Jo&quot; /&amp;gt;
  &amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;p about=&quot;#bbq&quot; typeof=&quot;cal:Vevent&quot;&amp;gt;
      I&#039;m holding
      &amp;lt;span property=&quot;cal:summary&quot;&amp;gt;
        one last summer barbecue
      &amp;lt;/span&amp;gt;,
      on
      &amp;lt;span property=&quot;cal:dtstart&quot; content=&quot;2015-09-16T16:00:00-05:00&quot; 
            datatype=&quot;xsd:dateTime&quot;&amp;gt;
        September 16th at 4pm
      &amp;lt;/span&amp;gt;.
    &amp;lt;/p&amp;gt;
  &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;In microdata JSON, this would be:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{ &quot;items&quot;: [
  {
    &quot;type&quot;: &quot;http://www.w3.org/2000/01/rdf-schema#Resource&quot; ,
    &quot;id&quot;: &quot;http://example.org/&quot; ,
    &quot;properties&quot;: {
      &quot;http://xmlns.com/foaf/0.1/primaryTopic&quot;: [ &quot;http://example.org/#bbq&quot; ],
      &quot;http://purl.org/dc/terms/creator&quot;: [ &quot;Jo&quot; ]
    }
  } ,
  {
    &quot;type&quot;: &quot;http://www.w3.org/2002/12/cal/ical#Vevent&quot; ,
    &quot;id&quot;: &quot;http://example.org/#bbq&quot; ,
    &quot;properties&quot;: {
      &quot;summary&quot;: [ &quot;one last summer barbecue&quot; ] ,
      &quot;dtstart&quot;: [ &quot;2015-09-16T16:00:00-05:00&quot; ] ,
    }
  }
]}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Note that this mapping loses the fact that the value of the &lt;code&gt;dtstart&lt;/code&gt; property is a date-and-time. Processors of this JSON are expected to know that the &lt;code&gt;dtstart&lt;/code&gt; property takes a date/time value and would have to sniff the value to work out that it&amp;#8217;s a date-and-time rather than a date.&lt;/p&gt;

&lt;p&gt;In-browser microdata processors can identify the value as a date/time value because the property element itself is accessed through the &lt;code&gt;element.properties&lt;/code&gt; IDL attribute; processors that work with this DOM API can tell that it&amp;#8217;s a &lt;code&gt;&amp;lt;time&amp;gt;&lt;/code&gt; element, get hold of the date/time itself and access the content of the element for the human-readable representation used on the page. However, this information isn&amp;#8217;t part of the core &lt;a href=&quot;http://www.w3.org/TR/microdata/#the-microdata-model&quot;&gt;microdata data model&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;To create this JSON from microdata you need:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;html&amp;gt;
  &amp;lt;head itemscope itemtype=&quot;http://www.w3.org/2000/01/rdf-schema#Resource&quot; itemid=&quot;.&quot;&amp;gt;
    &amp;lt;title&amp;gt;Jo&#039;s Friends and Family Blog&amp;lt;/title&amp;gt;
    &amp;lt;link itemprop=&quot;http://xmlns.com/foaf/0.1/primaryTopic&quot; href=&quot;#bbq&quot; /&amp;gt;
    &amp;lt;meta itemprop=&quot;http://purl.org/dc/terms/creator&quot; content=&quot;Jo&quot; /&amp;gt;
  &amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;p itemscope itemid=&quot;#bbq&quot; itemtype=&quot;http://www.w3.org/2002/12/cal/ical#Vevent&quot;&amp;gt;
      I&#039;m holding
      &amp;lt;span itemprop=&quot;summary&quot;&amp;gt;
        one last summer barbecue
      &amp;lt;/span&amp;gt;,
      on
      &amp;lt;time itemprop=&quot;dtstart&quot; datetime=&quot;2015-09-16T16:00:00-05:00&quot;&amp;gt;
        September 16th at 4pm
      &amp;lt;/time&amp;gt;.
    &amp;lt;/p&amp;gt;
  &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Notes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;There are no prefix definitions in microdata, so the type has to be spelled out in full. However, with the mapping I&amp;#8217;m assuming from RDFa to microdata JSON, the properties in that same namespace for items in that class don&amp;#8217;t.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;itemscope&lt;/code&gt; has to be added despite the &lt;code&gt;&amp;lt;p&amp;gt;&lt;/code&gt; element having both an &lt;code&gt;itemid&lt;/code&gt; and an &lt;code&gt;itemtype&lt;/code&gt;; if the &lt;code&gt;itemscope&lt;/code&gt; is forgotten, the item isn&amp;#8217;t recognised.&lt;/li&gt;
&lt;li&gt;The original &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt; element has to be changed to a &lt;code&gt;&amp;lt;time&amp;gt;&lt;/code&gt; element because it isn&amp;#8217;t conformant microdata for a date/time value to be supplied by any other element.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Items from the &lt;code&gt;src&lt;/code&gt; Attribute&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;If @about is not present, then @src is next in priority order, for setting the subject of a statement. A typical use would be to indicate the licensing type of an image:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;img src=&quot;photo1.jpg&quot; rel=&quot;license&quot; 
     resource=&quot;http://creativecommons.org/licenses/by/2.0/&quot; /&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;This should generate the microdata JSON:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{ &quot;items&quot;: [
  {
    &quot;type&quot;: &quot;http://www.w3.org/2000/01/rdf-schema#Resource&quot; ,
    &quot;id&quot;: &quot;http://example.org/photo1.jpg&quot; ,
    &quot;properties&quot;: {
      &quot;http://www.w3.org/1999/xhtml/vocab#license&quot;: [ &quot;http://creativecommons.org/licenses/by/2.0/&quot; ] ,
    }
  }
]}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The &lt;code&gt;src&lt;/code&gt; attribute in microdata is only used for a value, so creating the microdata about the image means a wrapper &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt; element and a separate &lt;code&gt;&amp;lt;link&amp;gt;&lt;/code&gt; element:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt; &amp;lt;span itemscope itemtype=&quot;http://www.w3.org/2000/01/rdf-schema#Resource&quot; itemid=&quot;photo1.jpg&quot;&amp;gt;
   &amp;lt;img src=&quot;photo1.jpg&quot; /&amp;gt;
   &amp;lt;link itemprop=&quot;http://www.w3.org/1999/xhtml/vocab#license&quot; href=&quot;http://creativecommons.org/licenses/by/2.0/&quot; /&amp;gt;
 &amp;lt;/span&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Note:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;license&lt;/code&gt; property is part of the built-in set of link relationships in HTML, but there is no easy way to refer to that property from microdata; they have to be spelled out as full URLs.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Additional Properties for Images&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;Since there is no difference between @src and @about, then the information expressed in the last example in the section on @about (the creator of an image), could be expressed as follows:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;img src=&quot;photo1.jpg&quot;
  rel=&quot;license&quot; resource=&quot;http://creativecommons.org/licenses/by/2.0/&quot;
  property=&quot;dc:creator&quot; content=&quot;Mark Birbeck&quot;
/&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;This is a simple additional property in the microdata JSON:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{ &quot;items&quot;: [
  {
    &quot;type&quot;: &quot;http://www.w3.org/2000/01/rdf-schema#Resource&quot; ,
    &quot;id&quot;: &quot;http://example.org/photo1.jpg&quot; ,
    &quot;properties&quot;: {
      &quot;http://www.w3.org/1999/xhtml/vocab#license&quot;: [ &quot;http://creativecommons.org/licenses/by/2.0/&quot; ] ,
      &quot;http://purl.org/dc/terms/creator&quot;: [ &quot;Mark Birbeck&quot; ]
    }
  }
]}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;which can be created through a &lt;code&gt;&amp;lt;meta&amp;gt;&lt;/code&gt; element within the &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt;:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;span itemscope itemtype=&quot;http://www.w3.org/2000/01/rdf-schema#Resource&quot; itemid=&quot;photo1.jpg&quot;&amp;gt;
  &amp;lt;img src=&quot;photo1.jpg&quot; /&amp;gt;
  &amp;lt;link itemprop=&quot;http://www.w3.org/1999/xhtml/vocab#license&quot; href=&quot;http://creativecommons.org/licenses/by/2.0/&quot; /&amp;gt;
  &amp;lt;meta itemprop=&quot;http://purl.org/dc/terms/creator&quot; content=&quot;Mark Birbeck&quot; /&amp;gt;
&amp;lt;/span&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Nested Images&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;Since normal chaining rules will apply, the image IRI can also be used to complete hanging triples:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div about=&quot;http://www.blogger.com/profile/1109404&quot; rel=&quot;foaf:img&quot;&amp;gt;
  &amp;lt;img src=&quot;photo1.jpg&quot;
    rel=&quot;license&quot; resource=&quot;http://creativecommons.org/licenses/by/2.0/&quot;
    property=&quot;dc:creator&quot; content=&quot;Mark Birbeck&quot;
  /&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;This should generate the microdata JSON:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{ &quot;items&quot;: [
  {
    &quot;type&quot;: &quot;http://www.w3.org/2000/01/rdf-schema#Resource&quot; ,
    &quot;id&quot;: &quot;http://www.blogger.com/profile/1109404&quot; ,
    &quot;properties&quot;: {
      &quot;http://xmlns.com/foaf/0.1/img&quot;: [{
        &quot;type&quot;: &quot;http://www.w3.org/2000/01/rdf-schema#Resource&quot; ,
        &quot;id&quot;: &quot;http://example.org/photo1.jpg&quot; ,
        &quot;properties&quot;: {
          &quot;http://www.w3.org/1999/xhtml/vocab#license&quot;: [ &quot;http://creativecommons.org/licenses/by/2.0/&quot; ] ,
          &quot;http://purl.org/dc/terms/creator&quot;: [ &quot;Mark Birbeck&quot; ]
        }
      }]
    }
  }
]}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The microdata to generate this is:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div itemscope itemtype=&quot;http://www.w3.org/2000/01/rdf-schema#Resource&quot; 
     itemid=&quot;http://www.blogger.com/profile/1109404&quot;&amp;gt;
  &amp;lt;span itemprop=&quot;http://xmlns.com/foaf/0.1/img&quot; 
        itemscope itemtype=&quot;http://www.w3.org/2000/01/rdf-schema#Resource&quot; 
        itemid=&quot;photo1.jpg&quot;&amp;gt;
    &amp;lt;img src=&quot;photo1.jpg&quot; /&amp;gt;
    &amp;lt;link itemprop=&quot;http://www.w3.org/1999/xhtml/vocab#license&quot; href=&quot;http://creativecommons.org/licenses/by/2.0/&quot; /&amp;gt;
    &amp;lt;meta itemprop=&quot;http://purl.org/dc/terms/creator&quot; content=&quot;Mark Birbeck&quot; /&amp;gt;
  &amp;lt;/span&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Notes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The big gotcha in this conversion is that in microdata, the &lt;code&gt;foaf:img&lt;/code&gt; property has to be moved onto the item that is a value of that property; there&amp;#8217;s no equivalent to the &amp;#8220;hanging rel&amp;#8221; processing in RDFa. A disadvantage of this is that anyone copying-and-pasting the &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt; element to embed the same information about the image within their own page will have the &lt;code&gt;itemprop&lt;/code&gt; attribute carried along with the image, into a context where the &lt;code&gt;foaf:img&lt;/code&gt; property might not be relevant.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Types with Blank Nodes&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;For example, an author may wish to create markup for a person using the FOAF vocabulary, but without having a clear identifier for the item:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div typeof=&quot;foaf:Person&quot;&amp;gt;
  &amp;lt;span property=&quot;foaf:name&quot;&amp;gt;Albert Einstein&amp;lt;/span&amp;gt;
  &amp;lt;span property=&quot;foaf:givenName&quot;&amp;gt;Albert&amp;lt;/span&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;Now we have an explicit type, we can create microdata JSON that uses short names:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{ &quot;items&quot;: [
  {
    &quot;type&quot;: &quot;http://xmlns.com/foaf/0.1/Person&quot; ,
    &quot;properties&quot;: {
      &quot;name&quot;: [ &quot;Albert Einstein&quot; ] ,
      &quot;givenName&quot;: [ &quot;Albert&quot; ] ,
    }
  }
]}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This can be generated with the microdata:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div itemscope itemtype=&quot;http://xmlns.com/foaf/0.1/Person&quot;&amp;gt;
  &amp;lt;span itemprop=&quot;name&quot;&amp;gt;Albert Einstein&amp;lt;/span&amp;gt;
  &amp;lt;span itemprop=&quot;givenName&quot;&amp;gt;Albert&amp;lt;/span&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;which is nice and simple.&lt;/p&gt;

&lt;h2&gt;Inherited Subject&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;The most usual way that an inherited subject might get set would be when the parent statement has an object that is a resource. Returning to the earlier example, in which the long name for the German_Empire was added, the following markup was used:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div about=&quot;http://dbpedia.org/resource/Albert_Einstein&quot;&amp;gt;
  &amp;lt;span property=&quot;foaf:name&quot;&amp;gt;Albert Einstein&amp;lt;/span&amp;gt;
  &amp;lt;span property=&quot;dbp:dateOfBirth&quot; datatype=&quot;xsd:date&quot;&amp;gt;1879-03-14&amp;lt;/span&amp;gt;
  &amp;lt;div rel=&quot;dbp:birthPlace&quot; resource=&quot;http://dbpedia.org/resource/German_Empire&quot; /&amp;gt;
  &amp;lt;span about=&quot;http://dbpedia.org/resource/German_Empire&quot;
    property=&quot;dbp:conventionalLongName&quot;&amp;gt;the German Empire&amp;lt;/span&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;The equivalent microdata JSON for this would be:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{ &quot;items&quot;: [
  {
    &quot;type&quot;: &quot;http://www.w3.org/2000/01/rdf-schema#Resource&quot; ,
    &quot;id&quot;: &quot;http://dbpedia.org/resource/Albert_Einstein&quot; ,
    &quot;properties&quot;: {
      &quot;http://xmlns.com/foaf/0.1/name&quot;: [ &quot;Albert Einstein&quot; ] ,
      &quot;http://dbpedia.org/property/dateOfBirth&quot;: [ &quot;1879-03-14&quot; ] ,
      &quot;http://dbpedia.org/property/birthPlace&quot;: [ &quot;http://dbpedia.org/resource/German_Empire&quot; ]
    }
  } , {
    &quot;type&quot;: &quot;http://www.w3.org/2000/01/rdf-schema#Resource&quot; ,
    &quot;id&quot;: &quot;http://dbpedia.org/resource/German_Empire&quot; ,
    &quot;properties&quot;: {
      &quot;http://dbpedia.org/property/conventionalLongName&quot;: [ &quot;the German Empire&quot; ] ,
    }
  }
]}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Note that this microdata JSON could only be generated syntactically from the RDFa, not via RDF, because going via RDF would make it impossible to know whether to give the &lt;code&gt;dbp:birthPlace&lt;/code&gt; property a string (which is a URI) value or a nested item. We&amp;#8217;ll see the alternative version of the microdata RDF in the next example.&lt;/p&gt;

&lt;p&gt;To create this microdata JSON, we need:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div itemscope itemtype=&quot;http://www.w3.org/2000/01/rdf-schema#Resource&quot; 
     itemid=&quot;http://dbpedia.org/resource/Albert_Einstein&quot;&amp;gt;
  &amp;lt;span itemprop=&quot;http://xmlns.com/foaf/0.1/name&quot;&amp;gt;Albert Einstein&amp;lt;/span&amp;gt;
  &amp;lt;time itemprop=&quot;http://dbpedia.org/property/dateOfBirth&quot;&amp;gt;1879-03-14&amp;lt;/time&amp;gt;
  &amp;lt;link itemprop=&quot;http://dbpedia.org/property/birthPlace&quot; href=&quot;http://dbpedia.org/resource/German_Empire&quot; /&amp;gt;
  &amp;lt;span itemscope itemtype=&quot;http://www.w3.org/2000/01/rdf-schema#Resource&quot;  
        itemid=&quot;http://dbpedia.org/resource/German_Empire&quot;&amp;gt;
    &amp;lt;span itemprop=&quot;http://dbpedia.org/property/conventionalLongName&quot;&amp;gt;the German Empire&amp;lt;/span&amp;gt;
  &amp;lt;/span&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Notes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I&amp;#8217;ve had to change two elements here: the &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt; for the date of birth has become a &lt;code&gt;&amp;lt;time&amp;gt;&lt;/code&gt; element as the value of the property is a date, and the &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; for the birth place has become a &lt;code&gt;&amp;lt;link&amp;gt;&lt;/code&gt; element because the value of that property is a URL.&lt;/li&gt;
&lt;li&gt;I&amp;#8217;ve also had to add a nested &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt; element as it&amp;#8217;s not possible in microdata to have a single element describe both an item and a property for that item as it is in RDFa.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
  &lt;p&gt;In an earlier illustration the subject and object for the German Empire were connected by removing the @resource, relying on the @about to set the object:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div about=&quot;http://dbpedia.org/resource/Albert_Einstein&quot;&amp;gt;
  &amp;lt;span property=&quot;foaf:name&quot;&amp;gt;Albert Einstein&amp;lt;/span&amp;gt;
  &amp;lt;span property=&quot;dbp:dateOfBirth&quot; datatype=&quot;xsd:date&quot;&amp;gt;1879-03-14&amp;lt;/span&amp;gt;
  &amp;lt;div rel=&quot;dbp:birthPlace&quot;&amp;gt;
    &amp;lt;span about=&quot;http://dbpedia.org/resource/German_Empire&quot;
      property=&quot;dbp:conventionalLongName&quot;&amp;gt;the German Empire&amp;lt;/span&amp;gt;
  &amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;While this generates the same RDF as the previous example, the microdata JSON that it generates should probably be different: this time, the item for the German Empire is nested within the item for Albert Einstein:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{ &quot;items&quot;: [
  {
    &quot;type&quot;: &quot;http://www.w3.org/2000/01/rdf-schema#Resource&quot; ,
    &quot;id&quot;: &quot;http://dbpedia.org/resource/Albert_Einstein&quot; ,
    &quot;properties&quot;: {
      &quot;http://xmlns.com/foaf/0.1/name&quot;: [ &quot;Albert Einstein&quot; ] ,
      &quot;http://dbpedia.org/property/dateOfBirth&quot;: [ &quot;1879-03-14&quot; ] ,
      &quot;http://dbpedia.org/property/birthPlace&quot;: [{
        &quot;type&quot;: &quot;http://www.w3.org/2000/01/rdf-schema#Resource&quot; ,
        &quot;id&quot;: &quot;http://dbpedia.org/resource/German_Empire&quot; ,
        &quot;properties&quot;: {
          &quot;http://dbpedia.org/property/conventionalLongName&quot;: [ &quot;the German Empire&quot; ]
        }
      }
    }
  }
]}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;To create this, the microdata needs to look like:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div itemscope itemtype=&quot;http://www.w3.org/2000/01/rdf-schema#Resource&quot; 
     itemid=&quot;http://dbpedia.org/resource/Albert_Einstein&quot;&amp;gt;
  &amp;lt;span itemprop=&quot;http://xmlns.com/foaf/0.1/name&quot;&amp;gt;Albert Einstein&amp;lt;/span&amp;gt;
  &amp;lt;time itemprop=&quot;http://dbpedia.org/property/dateOfBirth&quot;&amp;gt;1879-03-14&amp;lt;/time&amp;gt;
  &amp;lt;div itemprop=&quot;http://dbpedia.org/property/birthPlace&quot; 
       itemscope itemtype=&quot;http://www.w3.org/2000/01/rdf-schema#Resource&quot;  
       itemid=&quot;http://dbpedia.org/resource/German_Empire&quot;&amp;gt;
    &amp;lt;span itemprop=&quot;http://dbpedia.org/property/conventionalLongName&quot;&amp;gt;the German Empire&amp;lt;/span&amp;gt;
  &amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Note that while this looks quite similar to the RDFa version, in fact the &lt;code&gt;itemid&lt;/code&gt; attribute that holds the URI for the German Empire is on a different element from the &lt;code&gt;about&lt;/code&gt; attribute in the RDFa.&lt;/p&gt;

&lt;p&gt;The third RDFa example around this same content is:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;but it is also possible for authors to achieve the same effect by removing the @about and leaving the @resource:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div about=&quot;http://dbpedia.org/resource/Albert_Einstein&quot;&amp;gt;
  &amp;lt;span property=&quot;foaf:name&quot;&amp;gt;Albert Einstein&amp;lt;/span&amp;gt;
  &amp;lt;span property=&quot;dbp:dateOfBirth&quot; datatype=&quot;xsd:date&quot;&amp;gt;1879-03-14&amp;lt;/span&amp;gt;
  &amp;lt;div rel=&quot;dbp:birthPlace&quot; resource=&quot;http://dbpedia.org/resource/German_Empire&quot;&amp;gt;
    &amp;lt;span property=&quot;dbp:conventionalLongName&quot;&amp;gt;the German Empire&amp;lt;/span&amp;gt;
  &amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;This should lead to the same microdata JSON, so I won&amp;#8217;t bother repeating the microdata. What&amp;#8217;s interesting is that this pattern: the wrapper element containing the property (&lt;code&gt;rel&lt;/code&gt;) and identifier for the item that is the value for that property (&lt;code&gt;resource&lt;/code&gt;) is a lot closer to the microdata pattern of expressing nested items. The big distinction here is that while in microdata, the &lt;code&gt;itemtype&lt;/code&gt; also resides on that element, if you tried adding a &lt;code&gt;typeof&lt;/code&gt; attribute to the inner &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; in RDFa, you&amp;#8217;d end up with a new blank node.&lt;/p&gt;

&lt;h2&gt;Anonymous Nested Resources&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;However, an author could just as easily say that Spinoza influenced something by the name of Albert Einstein, that was born on March 14th, 1879:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div about=&quot;http://dbpedia.org/resource/Baruch_Spinoza&quot; rel=&quot;dbp-owl:influenced&quot;&amp;gt;
  &amp;lt;div&amp;gt;
    &amp;lt;span property=&quot;foaf:name&quot;&amp;gt;Albert Einstein&amp;lt;/span&amp;gt;
    &amp;lt;span property=&quot;dbp:dateOfBirth&quot; datatype=&quot;xsd:date&quot;&amp;gt;1879-03-14&amp;lt;/span&amp;gt;
  &amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;This should generate the microdata JSON:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{ &quot;items&quot;: [
  {
    &quot;type&quot;: &quot;http://www.w3.org/2000/01/rdf-schema#Resource&quot; ,
    &quot;id&quot;: &quot;http://dbpedia.org/resource/Baruch_Spinoza&quot; ,
    &quot;properties&quot;: {
      &quot;http://dbpedia.org/ontology/influenced&quot;: [{
        &quot;properties&quot;: {
          &quot;http://xmlns.com/foaf/0.1/name&quot;: [ &quot;Albert Einstein&quot; ] ,
          &quot;http://dbpedia.org/property/dateOfBirth&quot;: [ &quot;1879-03-14&quot; ]
        }
      }]
    }
  }
]}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;which again means moving an attribute in microdata:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div itemscope itemtype=&quot;http://www.w3.org/2000/01/rdf-schema#Resource&quot;
     itemid=&quot;http://dbpedia.org/resource/Baruch_Spinoza&quot;&amp;gt;
  &amp;lt;div itemprop=&quot;http://dbpedia.org/ontology/influenced&quot;
       itemscope&amp;gt;
    &amp;lt;span itemprop=&quot;http://xmlns.com/foaf/0.1/name&quot;&amp;gt;Albert Einstein&amp;lt;/span&amp;gt;
    &amp;lt;time itemprop=&quot;http://dbpedia.org/property/dateOfBirth&quot;&amp;gt;1879-03-14&amp;lt;/time&amp;gt;
  &amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;It is generally harder to move to microdata from RDFa when the RDFa has an element that both provides a subject and provides a property.&lt;/p&gt;

&lt;p&gt;The RDFa spec provides a couple of additional methods of marking up the same content to give exactly the same RDF (and microdata JSON):&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Note that the div is superfluous, and an RDFa Processor will create the intermediate object even if the element is removed:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div about=&quot;http://dbpedia.org/resource/Baruch_Spinoza&quot; rel=&quot;dbp-owl:influenced&quot;&amp;gt;
  &amp;lt;span property=&quot;foaf:name&quot;&amp;gt;Albert Einstein&amp;lt;/span&amp;gt;
  &amp;lt;span property=&quot;dbp:dateOfBirth&quot; datatype=&quot;xsd:date&quot;&amp;gt;1879-03-14&amp;lt;/span&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
  
  &lt;p&gt;An alternative pattern is to keep the div and move the @rel onto it:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div about=&quot;http://dbpedia.org/resource/Baruch_Spinoza&quot;&amp;gt;
  &amp;lt;div rel=&quot;dbp-owl:influenced&quot;&amp;gt;
    &amp;lt;span property=&quot;foaf:name&quot;&amp;gt;Albert Einstein&amp;lt;/span&amp;gt;
    &amp;lt;span property=&quot;dbp:dateOfBirth&quot; datatype=&quot;xsd:date&quot;&amp;gt;1879-03-14&amp;lt;/span&amp;gt;
  &amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
  
  &lt;p&gt;From the point of view of the markup, this latter layout is to be preferred, since it draws attention to the &amp;#8216;hanging rel&amp;#8217;. But from the point of view of an RDFa Processor, all of these permutations need to be supported.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Interestingly, it&amp;#8217;s this latter permutation that is the one that&amp;#8217;s closest to the microdata method of expressing the data, though as we will see in the next section, the &amp;#8220;hanging rel&amp;#8221; is not exactly equivalent to the &lt;code&gt;itemprop&lt;/code&gt; on the wrapper element.&lt;/p&gt;

&lt;h2&gt;Hanging Rels&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;Note that each occurrence of @about will complete any incomplete triples. For example, to mark up the fact that Albert Einstein had a residence both in the German Empire and Switzerland, an author need only specify one @rel value that is then used with multiple @about values:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div about=&quot;http://dbpedia.org/resource/Albert_Einstein&quot; rel=&quot;dbp-owl:residence&quot;&amp;gt;
  &amp;lt;span about=&quot;http://dbpedia.org/resource/German_Empire&quot; /&amp;gt;
  &amp;lt;span about=&quot;http://dbpedia.org/resource/Switzerland&quot; /&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;The data embedded here gives two values for the &lt;code&gt;dbp-owl:residence&lt;/code&gt; property:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{ &quot;items&quot;: [
  {
    &quot;type&quot;: &quot;http://www.w3.org/2000/01/rdf-schema#Resource&quot; ,
    &quot;id&quot;: &quot;http://dbpedia.org/resource/Albert_Einstein&quot; ,
    &quot;properties&quot;: {
      &quot;http://dbpedia.org/ontology/residence&quot;: [
        &quot;http://dbpedia.org/resource/German_Empire&quot; ,
        &quot;http://dbpedia.org/resource/Switzerland&quot;
      ]
    }
  }
]}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;In microdata, the &lt;code&gt;itemprop&lt;/code&gt; attribute has to appear on both the nested elements to make it clear that they both provide values for that property:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div itemscope itemtype=&quot;http://www.w3.org/2000/01/rdf-schema#Resource&quot; 
     itemid=&quot;http://dbpedia.org/resource/Albert_Einstein&quot;&amp;gt;
 &amp;lt;link itemprop=&quot;http://dbpedia.org/ontology/residence&quot; 
       href=&quot;http://dbpedia.org/resource/German_Empire&quot; /&amp;gt;
 &amp;lt;link itemprop=&quot;http://dbpedia.org/ontology/residence&quot;
       href=&quot;http://dbpedia.org/resource/Switzerland&quot; /&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The next example illustrates this with nested items rather than strings:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;To illustrate, to indicate that Spinoza influenced both Einstein and Schopenhauer, the following markup could be used:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div about=&quot;http://dbpedia.org/resource/Baruch_Spinoza&quot;&amp;gt;
  &amp;lt;div rel=&quot;dbp-owl:influenced&quot;&amp;gt;
    &amp;lt;div typeof=&quot;foaf:Person&quot;&amp;gt;
      &amp;lt;span property=&quot;foaf:name&quot;&amp;gt;Albert Einstein&amp;lt;/span&amp;gt;
      &amp;lt;span property=&quot;dbp:dateOfBirth&quot; datatype=&quot;xsd:date&quot;&amp;gt;1879-03-14&amp;lt;/span&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;div typeof=&quot;foaf:Person&quot;&amp;gt;
      &amp;lt;span property=&quot;foaf:name&quot;&amp;gt;Arthur Schopenhauer&amp;lt;/span&amp;gt;
      &amp;lt;span property=&quot;dbp:dateOfBirth&quot; datatype=&quot;xsd:date&quot;&amp;gt;1788-02-22&amp;lt;/span&amp;gt;
    &amp;lt;/div&amp;gt;          
  &amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;This should generate:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{ &quot;items&quot;: [
  {
    &quot;type&quot;: &quot;http://www.w3.org/2000/01/rdf-schema#Resource&quot; ,
    &quot;id&quot;: &quot;http://dbpedia.org/resource/Baruch_Spinoza&quot; ,
    &quot;properties&quot;: {
      &quot;http://dbpedia.org/ontology/influenced&quot;: [{
        &quot;type&quot;: &quot;http://xmlns.com/foaf/0.1/Person&quot; ,
        &quot;properties&quot;: {
          &quot;name&quot;: [ &quot;Albert Einstein&quot; ] ,
          &quot;http://dbpedia.org/property/dateOfBirth&quot;: [ &quot;1879-03-14&quot; ]
        }
      }, {
        &quot;type&quot;: &quot;http://xmlns.com/foaf/0.1/Person&quot; ,
        &quot;properties&quot;: {
          &quot;name&quot;: [ &quot;Arthur Schopenhauer&quot; ] ,
          &quot;http://dbpedia.org/property/dateOfBirth&quot;: [ &quot;1788-02-22&quot; ]
        }
      }]
    }
  }
]}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;In this case, the &lt;code&gt;itemprop&lt;/code&gt; that is equivalent to the RDFa &lt;code&gt;rel&lt;/code&gt; has to move down onto the elements representing the items:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div itemscope itemtype=&quot;http://www.w3.org/2000/01/rdf-schema#Resource&quot;
     itemid=&quot;http://dbpedia.org/resource/Baruch_Spinoza&quot;&amp;gt;
  &amp;lt;div&amp;gt;
    &amp;lt;div itemprop=&quot;http://dbpedia.org/ontology/influenced&quot;
         itemscope itemtype=&quot;http://xmlns.com/foaf/0.1/Person&quot;&amp;gt;
      &amp;lt;span itemprop=&quot;name&quot;&amp;gt;Albert Einstein&amp;lt;/span&amp;gt;
      &amp;lt;time itemprop=&quot;http://dbpedia.org/property/dateOfBirth&quot;&amp;gt;1879-03-14&amp;lt;/time&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;div itemprop=&quot;http://dbpedia.org/ontology/influenced&quot;
         itemscope itemtype=&quot;http://xmlns.com/foaf/0.1/Person&quot;&amp;gt;
      &amp;lt;span itemprop=&quot;name&quot;&amp;gt;Arthur Schopenhauer&amp;lt;/span&amp;gt;
      &amp;lt;time itemprop=&quot;http://dbpedia.org/property/dateOfBirth&quot;&amp;gt;1788-02-22&amp;lt;/time&amp;gt;
    &amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The wrapper &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; around both items isn&amp;#8217;t necessary; I&amp;#8217;ve left it to stay as close to the markup of the original RDFa as possible.&lt;/p&gt;

&lt;h2&gt;Implicit Resources&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;Triples are also &amp;#8216;completed&amp;#8217; if any one of @property, @rel or @rev are present. However, unlike the situation when @about or @typeof are present, all predicates are attached to one bnode:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div about=&quot;http://dbpedia.org/resource/Baruch_Spinoza&quot; rel=&quot;dbp-owl:influenced&quot;&amp;gt;
  &amp;lt;span property=&quot;foaf:name&quot;&amp;gt;Albert Einstein&amp;lt;/span&amp;gt;
  &amp;lt;span property=&quot;dbp:dateOfBirth&quot; datatype=&quot;xsd:date&quot;&amp;gt;1879-03-14&amp;lt;/span&amp;gt;
  &amp;lt;div rel=&quot;dbp-owl:residence&quot;&amp;gt;
    &amp;lt;span about=&quot;http://dbpedia.org/resource/German_Empire&quot; /&amp;gt;
    &amp;lt;span about=&quot;http://dbpedia.org/resource/Switzerland&quot; /&amp;gt;
  &amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;To be equivalent to the RDF generated from this markup, the microdata JSON would be:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{ &quot;items&quot;: [
  {
    &quot;type&quot;: &quot;http://www.w3.org/2000/01/rdf-schema#Resource&quot; ,
    &quot;id&quot;: &quot;http://dbpedia.org/resource/Baruch_Spinoza&quot; ,
    &quot;properties&quot;: {
      &quot;http://dbpedia.org/ontology/influenced&quot;: [{
        &quot;properties&quot;: {
          &quot;http://xmlns.com/foaf/0.1/name&quot;: [ &quot;Albert Einstein&quot; ] ,
          &quot;http://dbpedia.org/property/dateOfBirth&quot;: [ &quot;1879-03-14&quot; ]
          &quot;http://dbpedia.org/ontology/residence&quot;: [
            &quot;http://dbpedia.org/resource/German_Empire&quot; ,
            &quot;http://dbpedia.org/resource/Switzerland&quot;
          ]
        }
      }]
    }
  }
]}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Microdata is a lot more explicit about when items get created, and consequently requires a bit more markup:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div itemscope itemtype=&quot;http://www.w3.org/2000/01/rdf-schema#Resource&quot;
     itemid=&quot;http://dbpedia.org/resource/Baruch_Spinoza&quot;&amp;gt;
  &amp;lt;div itemprop=&quot;http://dbpedia.org/ontology/influenced&quot; itemscope&amp;gt;
    &amp;lt;span itemprop=&quot;name&quot;&amp;gt;Albert Einstein&amp;lt;/span&amp;gt;
    &amp;lt;time itemprop=&quot;http://dbpedia.org/property/dateOfBirth&quot;&amp;gt;1879-03-14&amp;lt;/time&amp;gt;
    &amp;lt;div&amp;gt;
     &amp;lt;link itemprop=&quot;http://dbpedia.org/ontology/residence&quot; 
           href=&quot;http://dbpedia.org/resource/German_Empire&quot; /&amp;gt;
     &amp;lt;link itemprop=&quot;http://dbpedia.org/ontology/residence&quot;
           href=&quot;http://dbpedia.org/resource/Switzerland&quot; /&amp;gt;
    &amp;lt;/div&amp;gt;
  &amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Overriding Text Content&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;The value of @content is given precedence over any element content, so the following would give exactly the same triple as shown above:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;span about=&quot;http://internet-apps.blogspot.com/&quot;
      property=&quot;dc:creator&quot; content=&quot;Mark Birbeck&quot;&amp;gt;John Doe&amp;lt;/span&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;The equivalent microdata should generate the JSON:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{ &quot;items&quot;: [
  {
    &quot;type&quot;: &quot;http://www.w3.org/2000/01/rdf-schema#Resource&quot; ,
    &quot;id&quot;: &quot;http://internet-apps.blogspot.com/&quot; ,
    &quot;properties&quot;: {
      &quot;http://purl.org/dc/terms/creator&quot;: [ &quot;Mark Birbeck&quot; ]
    }
  }
]}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Only the &lt;code&gt;&amp;lt;time&amp;gt;&lt;/code&gt; element and links override the content of an element in microdata. So a mirror of this example needs a separate element:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;  &amp;lt;span itemscope itemtype=&quot;http://www.w3.org/2000/01/rdf-schema#Resource&quot;
        itemid=&quot;http://internet-apps.blogspot.com/&quot;&amp;gt;
    &amp;lt;meta itemprop=&quot;http://purl.org/dc/terms/creator&quot; content=&quot;Mark Birbeck&quot; /&amp;gt;
    John Doe
  &amp;lt;/span&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Language Support&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;In RDFa the Host Language may provide a mechanism for setting the language tag. In XHTML+RDFa [XHTML-RDFA], for example, the XML language attribute @xml:lang or the attribute @lang is used to add this information, whether the plain literal is designated by @content, or by the inline text of the element:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;meta about=&quot;http://example.org/node&quot;
  property=&quot;ex:property&quot; xml:lang=&quot;fr&quot; content=&quot;chat&quot; /&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;Like the datatype of a value, the language of a value isn&amp;#8217;t captured by the microdata data model or the JSON representation of that data model. So the fact that &amp;#8216;chat&amp;#8217; is French is lost:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{ &quot;items&quot;: [
  {
    &quot;type&quot;: &quot;http://www.w3.org/2000/01/rdf-schema#Resource&quot; ,
    &quot;id&quot;: &quot;http://example.org/node&quot; ,
    &quot;properties&quot;: {
      &quot;http://example.org/property&quot;: [ &quot;chat&quot; ]
    }
  }
]}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The equivalent microdata is thus:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;span itemscope itemtype=&quot;http://www.w3.org/2000/01/rdf-schema#Resource&quot;
      itemid=&quot;http://example.org/node&quot;
  &amp;lt;meta itemprop=&quot;ex:property&quot; xml:lang=&quot;fr&quot; content=&quot;chat&quot; /&amp;gt;
&amp;lt;/span&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;with the language only accessible if you are using the DOM to process the microdata.&lt;/p&gt;

&lt;h2&gt;Literals that Include Markup&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;RDFa therefore supports the use of normal markup to express XML literals, by using @datatype:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;h2 property=&quot;dc:title&quot; datatype=&quot;rdf:XMLLiteral&quot;&amp;gt;
  E = mc&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;: The Most Urgent Problem of Our Time
&amp;lt;/h2&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;The &lt;code&gt;datatype=&quot;rdf:XMLLiteral&quot;&lt;/code&gt; acts like a flag to indicate that the serialised content of the element (&lt;code&gt;innerHTML&lt;/code&gt;) needs to be used as the value of the property, rather than the &lt;code&gt;textContent&lt;/code&gt;, which includes markup, can be expressed in microdata JSON as follows:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{ &quot;http://purl.org/dc/terms/title&quot;: &quot;E = mc&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;: The Most Urgent Problem of Our Time&quot; }
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;There&amp;#8217;s no way to generate this in microdata except by repeating the escaped version of the content in a &lt;code&gt;content&lt;/code&gt; attribute:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;h2&amp;gt;
  E = mc&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;: The Most Urgent Problem of Our Time
  &amp;lt;meta itemprop=&quot;http://purl.org/dc/terms/title&quot;
    content=&quot;E = mc&amp;amp;lt;sup&amp;gt;2&amp;amp;lt;/sup&amp;gt;: The Most Urgent Problem of Our Time&quot; /&amp;gt;
&amp;lt;/h2&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This is hardly ideal. It&amp;#8217;s tedious enough with a short string like this one; for larger amounts of information such as long descriptions of an event, it would be very tedious.&lt;/p&gt;

&lt;h2&gt;The &lt;code&gt;resource&lt;/code&gt; Attribute&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;RDFa provides the @resource attribute as a way to set the object of statements. This is particularly useful when referring to resources that are not themselves navigable links:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;html&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;title&amp;gt;On Crime and Punishment&amp;lt;/title&amp;gt;
    &amp;lt;base href=&quot;http://www.example.com/candp.xhtml&quot; /&amp;gt;
  &amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;blockquote about=&quot;#q1&quot; rel=&quot;dc:source&quot; resource=&quot;urn:ISBN:0140449132&quot; &amp;gt;
      &amp;lt;p id=&quot;q1&quot;&amp;gt;
        Rodion Romanovitch! My dear friend! If you go on in this way
        you will go mad, I am positive! Drink, pray, if only a few drops!
      &amp;lt;/p&amp;gt;
    &amp;lt;/blockquote&amp;gt;
  &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;This should produce:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{ &quot;items&quot;: [
  {
    &quot;type&quot;: &quot;http://www.w3.org/2000/01/rdf-schema#Resource&quot; ,
    &quot;id&quot;: &quot;http://www.example.com/candp.xhtml#q1&quot; ,
    &quot;properties&quot;: {
      &quot;http://purl.org/dc/terms/source&quot;: [ &quot;urn:ISBN:0140449132&quot; ]
    }
  }
]}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;which is expressed through:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;html&amp;gt;
  &amp;lt;head&amp;gt;
    &amp;lt;title&amp;gt;On Crime and Punishment&amp;lt;/title&amp;gt;
    &amp;lt;base href=&quot;http://www.example.com/candp.xhtml&quot; /&amp;gt;
  &amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;blockquote itemscope itemtype=&quot;http://www.w3.org/2000/01/rdf-schema#Resource&quot; itemid=&quot;#q1&quot;&amp;gt;
      &amp;lt;link itemprop=&quot;http://purl.org/dc/terms/source&quot; href=&quot;urn:ISBN:0140449132&quot; /&amp;gt;
      &amp;lt;p id=&quot;q1&quot;&amp;gt;
        Rodion Romanovitch! My dear friend! If you go on in this way
        you will go mad, I am positive! Drink, pray, if only a few drops!
      &amp;lt;/p&amp;gt;
    &amp;lt;/blockquote&amp;gt;
  &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The property and value have to be moved onto a nested &lt;code&gt;&amp;lt;link&amp;gt;&lt;/code&gt;, but this is a more extensible pattern than the RDFa method as it enables other properties to be expressed in the same way.&lt;/p&gt;

&lt;h2&gt;Multiple Types&lt;/h2&gt;

&lt;p&gt;This last example comes from the wild rather than being an example in the specification. At &lt;a href=&quot;http://bitmunk.com/browse&quot;&gt;http://bitmunk.com/browse&lt;/a&gt; we find:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;span about=&quot;http://bitmunk.com/about#service&quot; 
      typeof=&quot;vcard:VCard commerce:Business gr:BusinessEntity&quot; 
      property=&quot;rdfs:label vcard:fn&quot;&amp;gt;Bitmunk&amp;lt;/span&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This shows the use of multiple types and of multiple properties with the same value, because the pages are attempting to use multiple vocabularies that cover the same domain (organisations) to different depths. In the equivalent microdata, we have to choose one of the types; I&amp;#8217;m going to assume that it should just use the first one from the &lt;code&gt;typeof&lt;/code&gt; attribute:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{ &quot;items&quot;: [
  {
    &quot;type&quot;: &quot;http://www.w3.org/2006/vcard/ns#VCard&quot; ,
    &quot;id&quot;: &quot;http://bitmunk.com/about#service&quot; ,
    &quot;properties&quot;: {
      &quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#type&quot;: [
        &quot;http://purl.org/commerce#Business&quot; ,
        &quot;http://purl.org/goodrelations/v1#BusinessEntity&quot;
      ] ,
      &quot;http://www.w3.org/2000/01/rdf-schema#label&quot;: [ &quot;Bitmunk&quot; ] ,
      &quot;fn&quot;: [ &quot;Bitmunk&quot; ]
    }
  }
]}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The microdata equivalent is:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;span itemscope itemid=&quot;http://bitmunk.com/about#service&quot; 
      itemtype=&quot;http://www.w3.org/2006/vcard/ns#VCard&quot;&amp;gt;
  &amp;lt;link itemprop=&quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#type&quot;
       href=&quot;http://purl.org/commerce#Business&quot; /&amp;gt;
  &amp;lt;link itemprop=&quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#type&quot;
       href=&quot;http://purl.org/goodrelations/v1#BusinessEntity&quot; /&amp;gt;
  &amp;lt;span itemprop=&quot;http://www.w3.org/2000/01/rdf-schema#label fn&quot;&amp;gt;Bitmunk&amp;lt;/span&amp;gt;
&amp;lt;/span&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Notes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Technically, the RDFa doesn&amp;#8217;t place any ordering on the three classes, but I&amp;#8217;m picking the first for the purpose of the microdata conversion. The other classes are harder to get at in the JSON: they have to be referenced via the &lt;code&gt;rdf:type&lt;/code&gt; microdata property rather than the &lt;code&gt;type&lt;/code&gt; JSON property. Consumers that are on the lookout for items of the type &lt;code&gt;gr:BusinessEntity&lt;/code&gt; wouldn&amp;#8217;t spot these items.&lt;/li&gt;
&lt;/ul&gt;
</description>
 <comments>http://www.jenitennison.com/blog/node/164#comments</comments>
 <category domain="http://www.jenitennison.com/blog/taxonomy/term/71">microdata</category>
 <category domain="http://www.jenitennison.com/blog/taxonomy/term/42">rdfa</category>
 <pubDate>Sat, 20 Aug 2011 16:38:38 +0000</pubDate>
 <dc:creator>Jeni</dc:creator>
 <guid isPermaLink="false">164 at http://www.jenitennison.com/blog</guid>
</item>
<item>
 <title>Mapping Microdata to RDFa</title>
 <link>http://www.jenitennison.com/blog/node/163</link>
 <description>&lt;p&gt;This post is part of a three-part series that analyses the differences in features and syntax between microdata and RDFa. The series attempts:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;to identify the differences in approach and functionality of the two languages, which should help developers choose between them&lt;/li&gt;
&lt;li&gt;to identify any guidelines for developers of vocabularies for use with both languages&lt;/li&gt;
&lt;li&gt;to identify a subset of functionality that is common between the two languages, which developers might want to stick to to make switching and mixing easier&lt;/li&gt;
&lt;li&gt;to identify mapping rules that might be applied to automatically or manually map from one language to another if the simple subset is used&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I&amp;#8217;ve done this by looking at converting microdata examples to RDFa and vice versa, and the lessons to be drawn from that exercise. The three posts are on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.jenitennison.com/blog/node/163&quot;&gt;converting microdata to RDFa&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.jenitennison.com/blog/node/164&quot;&gt;converting RDFa to microdata&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.jenitennison.com/blog/node/165&quot;&gt;lessons learned from this exercise&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This post is the first of these, which looks at how microdata might be mapped to RDFa, in terms of generating the same RDF according to the microdata-to-RDF mapping rules that I outlined in my post on &lt;a href=&quot;http://www.jenitennison.com/blog/node/162&quot;&gt;Microdata + RDF&lt;/a&gt;.&lt;/p&gt;

&lt;!--break--&gt;

&lt;p&gt;I have based what&amp;#8217;s written here on the latest specifications of both microdata (in its &lt;a href=&quot;http://www.whatwg.org/specs/web-apps/current-work/multipage/microdata.html&quot;&gt;WHAT WG&lt;/a&gt; and &lt;a href=&quot;http://dev.w3.org/html5/md/Overview.html&quot;&gt;W3C&lt;/a&gt; variants) and &lt;a href=&quot;http://www.w3.org/2010/02/rdfa/drafts/2011/ED-rdfa-core-20110814/&quot;&gt;RDFa Core&lt;/a&gt; and &lt;a href=&quot;http://dev.w3.org/html5/rdfa/&quot;&gt;HTML+RDFa&lt;/a&gt; but I haven&amp;#8217;t consulted with anyone involved in these efforts and may well have got things wrong. &lt;a href=&quot;http://rdf.greggkellogg.net/distiller&quot;&gt;Gregg Kellogg&amp;#8217;s Distiller service&lt;/a&gt; has proved invaluable for testing, so many thanks to him for providing that service.&lt;/p&gt;

&lt;p&gt;The post is rather heavy going and you might want to just &lt;a href=&quot;http://www.jenitennison.com/blog/node/165&quot;&gt;skip to the summary&lt;/a&gt; instead of reading the whole thing.&lt;/p&gt;

&lt;p&gt;The post goes through the examples from the microdata specification (most of them are in both versions, the only exceptions being those that use the vCard vocabulary). I haven&amp;#8217;t included examples that don&amp;#8217;t illustrate anything new, so there are some that are skipped. Other examples would be welcome.&lt;/p&gt;

&lt;h2&gt;Unidentified Items / Blank Node Subjects&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;Here there are two items, each of which has the property &amp;#8220;name&amp;#8221;:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div itemscope&amp;gt;
 &amp;lt;p&amp;gt;My name is &amp;lt;span itemprop=&quot;name&quot;&amp;gt;Elizabeth&amp;lt;/span&amp;gt;.&amp;lt;/p&amp;gt;
&amp;lt;/div&amp;gt;

&amp;lt;div itemscope&amp;gt;
 &amp;lt;p&amp;gt;My name is &amp;lt;span itemprop=&quot;name&quot;&amp;gt;Daniel&amp;lt;/span&amp;gt;.&amp;lt;/p&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;The first challenge is to map this into RDFa because the properties are tokens rather than URIs and there is no type for either of the items. What I&amp;#8217;ll assume here is that the &lt;code&gt;name&lt;/code&gt; properties are local to the document itself and thus the equivalent RDF is:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;[ &amp;lt;#name&amp;gt; &quot;Elizabeth&quot; ] .
[ &amp;lt;#name&amp;gt; &quot;Daniel&quot; ] .
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This can be achieved in RDFa through either:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div vocab=&quot;#&quot; about=&quot;_:elizabeth&quot;&amp;gt;
  &amp;lt;p&amp;gt;My name is &amp;lt;span property=&quot;name&quot;&amp;gt;Elizabeth&amp;lt;/span&amp;gt;.&amp;lt;/p&amp;gt;
&amp;lt;/div&amp;gt;

&amp;lt;div vocab=&quot;#&quot; about=&quot;_:daniel&quot;&amp;gt;
  &amp;lt;p&amp;gt;My name is &amp;lt;span property=&quot;name&quot;&amp;gt;Daniel&amp;lt;/span&amp;gt;.&amp;lt;/p&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;or:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div vocab=&quot;#&quot; typeof&amp;gt;
  &amp;lt;p&amp;gt;My name is &amp;lt;span property=&quot;name&quot;&amp;gt;Elizabeth&amp;lt;/span&amp;gt;.&amp;lt;/p&amp;gt;
&amp;lt;/div&amp;gt;

&amp;lt;div vocab=&quot;#&quot; typeof&amp;gt;
  &amp;lt;p&amp;gt;My name is &amp;lt;span property=&quot;name&quot;&amp;gt;Daniel&amp;lt;/span&amp;gt;.&amp;lt;/p&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Notes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;vocab=&quot;#&quot;&lt;/code&gt; sets the vocabulary to the location of the current document (plus an empty fragment identifier); this URI is then concatenated to the property token (&lt;code&gt;name&lt;/code&gt;) to create a URI that is unique to the document. In a document such as this it would make sense to put the &lt;code&gt;vocab=&quot;#&quot;&lt;/code&gt; attribute on the &lt;code&gt;&amp;lt;html&amp;gt;&lt;/code&gt; element rather than on every single item.&lt;/li&gt;
&lt;li&gt;With no type in sight, blank nodes can either be created by having an empty &lt;code&gt;typeof&lt;/code&gt; attribute or through an &lt;code&gt;about&lt;/code&gt; attributes whose value starts with &lt;code&gt;_:&lt;/code&gt;. The latter has the advantage of providing an identifier for the blank node that can be used elsewhere in the document, but the former is shorter so will be used where possible in the remaining examples of this post.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Values from the &lt;code&gt;src&lt;/code&gt; Attribute&lt;/h2&gt;

&lt;p&gt;The next example introduces the use of the &lt;code&gt;src&lt;/code&gt; attribute to set the value of the property.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;In this example, the item has one property, &amp;#8220;image&amp;#8221;, whose value is a URL:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div itemscope&amp;gt;
 &amp;lt;img itemprop=&quot;image&quot; src=&quot;google-logo.png&quot; alt=&quot;Google&quot;&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;This should probably be mapped to the RDF:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;[ &amp;lt;#image&amp;gt; &amp;lt;google-logo.png&amp;gt; ] .
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The difficulty with this is that in RDFa, the &lt;code&gt;src&lt;/code&gt; attribute is used for the &lt;em&gt;subject&lt;/em&gt; of a statement (equivalent to a microdata item) rather than the &lt;em&gt;object&lt;/em&gt; (equivalent to a microdata value). So we have two choices for equivalent RDFa. One is to use a similar pattern to that used above, but introduce a wrapper element that provides the property:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div vocab=&quot;#&quot; typeof&amp;gt;
 &amp;lt;span rel=&quot;image&quot;&amp;gt;&amp;lt;img src=&quot;google-logo.png&quot; alt=&quot;Google&quot;&amp;gt;&amp;lt;/span&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Another is to provide what would normally be an &lt;em&gt;object&lt;/em&gt; through a &lt;code&gt;resource&lt;/code&gt; attribute and then use a &lt;code&gt;rev&lt;/code&gt; attribute (rather than the usual &lt;code&gt;rel&lt;/code&gt;) attribute to reverse the relationship:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div vocab=&quot;#&quot;&amp;gt;
 &amp;lt;img resource=&quot;_:thing&quot; rev=&quot;image&quot; src=&quot;google-logo.png&quot; alt=&quot;Google&quot;&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This has three disadvantages over the first option:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the &lt;code&gt;resource&lt;/code&gt; attribute that creates the item is on the &lt;code&gt;&amp;lt;img&amp;gt;&lt;/code&gt; element rather than on the wrapper &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; which makes it hard to create other properties for that item&lt;/li&gt;
&lt;li&gt;we have to use a &lt;code&gt;rev&lt;/code&gt; attribute, reversing the normal flow of relationships; I (at least) find this hard to figure out when there&amp;#8217;s not a &lt;code&gt;rel&lt;/code&gt; attribute as well&lt;/li&gt;
&lt;li&gt;&lt;ins&gt;we have to make up an id for the blank node we want to generate&lt;/ins&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I&amp;#8217;ll note that it took me five or six failed attempts to generate the above options. If I hadn&amp;#8217;t had the &lt;a href=&quot;http://rdf.greggkellogg.net/distiller&quot;&gt;RDF Distiller&lt;/a&gt; to test with, I would have got it wrong. &lt;del&gt;Note that at least through the RDF Distiller, to be recognised, the &lt;code&gt;resource&lt;/code&gt; attribute has to have an (empty) value &amp;#8212; it is not enough for it to simply be present, unlike with the &lt;code&gt;typeof&lt;/code&gt; attribute.&lt;/del&gt; &lt;ins&gt;Note that the &lt;code&gt;resource&lt;/code&gt; attribute has to explicitly point to a blank node to create a blank node rather than having the property be associated with the document in which this appears.&lt;/ins&gt;&lt;/p&gt;

&lt;h2&gt;Values from the &lt;code&gt;datetime&lt;/code&gt; Attribute&lt;/h2&gt;

&lt;p&gt;The next example illustrates the use of the &lt;code&gt;&amp;lt;time&amp;gt;&lt;/code&gt; element to provide a date/time value for a property.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;In this example, the item has one property, &amp;#8220;birthday&amp;#8221;, whose value is a date:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div itemscope&amp;gt;
 I was born on &amp;lt;time itemprop=&quot;birthday&quot; datetime=&quot;2009-05-10&quot;&amp;gt;May 10th 2009&amp;lt;/time&amp;gt;.
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;I&amp;#8217;m assuming this should map to the RDF:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;[ &amp;lt;#birthday&amp;gt; &quot;2009-05-10&quot;^^&amp;lt;http://www.w3.org/2001/XMLSchema#date&amp;gt; ]
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;There is an open issue (&lt;a href=&quot;http://www.w3.org/2010/02/rdfa/track/issues/97&quot;&gt;ISSUE-97&lt;/a&gt;) about this on RDFa, which currently requires the use of the &lt;code&gt;content&lt;/code&gt; attribute to provide the value as follows:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div vocab=&quot;#&quot; typeof&amp;gt;
 I was born on &amp;lt;time property=&quot;birthday&quot; content=&quot;2009-05-10&quot; datatype=&quot;xsd:date&quot; datetime=&quot;2009-05-10&quot;&amp;gt;May 10th 2009&amp;lt;/time&amp;gt;.
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Note that the &lt;code&gt;xsd:&lt;/code&gt; prefix is built-in within RDFa so there&amp;#8217;s on need for any declaration for it, which makes it fairly easy to specify the standard date/time datatypes.&lt;/p&gt;

&lt;p&gt;If ISSUE-97 were resolved nicely it would be possible to instead do:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div vocab=&quot;#&quot; typeof&amp;gt;
 I was born on &amp;lt;time property=&quot;birthday&quot; datetime=&quot;2009-05-10&quot;&amp;gt;May 10th 2009&amp;lt;/time&amp;gt;.
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Notes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To make this work, RDFa processors would have to look at the syntax of the &lt;code&gt;datetime&lt;/code&gt; attribute to work out what datatype the value should be matched to.&lt;/li&gt;
&lt;li&gt;The syntax permitted in the &lt;code&gt;datetime&lt;/code&gt; attribute isn&amp;#8217;t exactly the same as that permitted by the XML Schema &lt;code&gt;time&lt;/code&gt; and &lt;code&gt;dateTime&lt;/code&gt; types usually used in RDF (and XML), in that the seconds component is optional within HTML. The resolution to ISSUE-97 will need to take this into account. Otherwise, anyone mapping from microdata to RDFa manually will need to ensure that the &lt;code&gt;content&lt;/code&gt; attribute includes the seconds component.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Nested Items / Object Properties&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;In this example, the outer item represents a person, and the inner one represents a band:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div itemscope&amp;gt;
 &amp;lt;p&amp;gt;Name: &amp;lt;span itemprop=&quot;name&quot;&amp;gt;Amanda&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
 &amp;lt;p&amp;gt;Band: &amp;lt;span itemprop=&quot;band&quot; itemscope&amp;gt; &amp;lt;span itemprop=&quot;name&quot;&amp;gt;Jazz Band&amp;lt;/span&amp;gt; (&amp;lt;span itemprop=&quot;size&quot;&amp;gt;12&amp;lt;/span&amp;gt; players)&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
  
  &lt;p&gt;The outer item here has two properties, &amp;#8220;name&amp;#8221; and &amp;#8220;band&amp;#8221;. The &amp;#8220;name&amp;#8221; is &amp;#8220;Amanda&amp;#8221;, and the &amp;#8220;band&amp;#8221; is an item in its own right, with two properties, &amp;#8220;name&amp;#8221; and &amp;#8220;size&amp;#8221;. The &amp;#8220;name&amp;#8221; of the band is &amp;#8220;Jazz Band&amp;#8221;, and the &amp;#8220;size&amp;#8221; is &amp;#8220;12&amp;#8221;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The equivalent RDF for this example would be:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;[
  &amp;lt;#name&amp;gt; &quot;Amanda&quot; ;
  &amp;lt;#band&amp;gt; [
    &amp;lt;#name&amp;gt; &quot;Jazz Band&quot; ;
    &amp;lt;#size&amp;gt; &quot;12&quot;
  ]
]
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Note that the &lt;code&gt;size&lt;/code&gt; property is just a plain literal value; unlike with date/times, there&amp;#8217;s no way to tell from the microdata that the value is a number.&lt;/p&gt;

&lt;p&gt;In RDFa this could be done with:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div vocab=&quot;#&quot; typeof&amp;gt;
 &amp;lt;p&amp;gt;Name: &amp;lt;span property=&quot;name&quot;&amp;gt;Amanda&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
 &amp;lt;p&amp;gt;Band: &amp;lt;span rel=&quot;band&quot;&amp;gt; &amp;lt;span property=&quot;name&quot;&amp;gt;Jazz Band&amp;lt;/span&amp;gt; (&amp;lt;span property=&quot;size&quot;&amp;gt;12&amp;lt;/span&amp;gt; players)&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This follows the microdata fairly closely but note that the nested resource doesn&amp;#8217;t need an empty &lt;code&gt;typeof&lt;/code&gt; attribute: it&amp;#8217;s only the top-level items that do. It might be easier, for consistency and extensibility, to always include an explicit nested element (with an empty &lt;code&gt;typeof&lt;/code&gt; attribute in this case) to represent the nested resource:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div vocab=&quot;#&quot; typeof&amp;gt;
 &amp;lt;p&amp;gt;Name: &amp;lt;span property=&quot;name&quot;&amp;gt;Amanda&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
 &amp;lt;p&amp;gt;Band: &amp;lt;span rel=&quot;band&quot;&amp;gt;&amp;lt;span typeof&amp;gt; &amp;lt;span property=&quot;name&quot;&amp;gt;Jazz Band&amp;lt;/span&amp;gt; (&amp;lt;span property=&quot;size&quot;&amp;gt;12&amp;lt;/span&amp;gt; players)&amp;lt;/span&amp;gt;&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The other thing that people have to watch out for is that because the value of the &lt;code&gt;band&lt;/code&gt; property is a resource rather than a literal, we have to use the &lt;code&gt;rel&lt;/code&gt; attribute rather than the &lt;code&gt;property&lt;/code&gt; attribute as we do elsewhere.&lt;/p&gt;

&lt;h2&gt;Itemref&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;This example is the same as the previous one, but all the properties are separated from their items:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div itemscope id=&quot;amanda&quot; itemref=&quot;a b&quot;&amp;gt;&amp;lt;/div&amp;gt;
&amp;lt;p id=&quot;a&quot;&amp;gt;Name: &amp;lt;span itemprop=&quot;name&quot;&amp;gt;Amanda&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
&amp;lt;div id=&quot;b&quot; itemprop=&quot;band&quot; itemscope itemref=&quot;c&quot;&amp;gt;&amp;lt;/div&amp;gt;
&amp;lt;div id=&quot;c&quot;&amp;gt;
 &amp;lt;p&amp;gt;Band: &amp;lt;span itemprop=&quot;name&quot;&amp;gt;Jazz Band&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
 &amp;lt;p&amp;gt;Size: &amp;lt;span itemprop=&quot;size&quot;&amp;gt;12&amp;lt;/span&amp;gt; players&amp;lt;/p&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;This should create the same RDF as the previous example:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;[
  &amp;lt;#name&amp;gt; &quot;Amanda&quot; ;
  &amp;lt;#band&amp;gt; [
    &amp;lt;#name&amp;gt; &quot;Jazz Band&quot; ;
    &amp;lt;#size&amp;gt; &quot;12&quot;
  ]
]
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;changing the markup as little as possible. The RDFa equivalent is:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div id=&quot;amanda&quot;&amp;gt;&amp;lt;/div&amp;gt;
&amp;lt;p vocab=&quot;#&quot; about=&quot;_:amanda&quot;&amp;gt;Name: &amp;lt;span property=&quot;name&quot;&amp;gt;Amanda&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
&amp;lt;div vocab=&quot;#&quot; about=&quot;_:amanda&quot; rel=&quot;band&quot; resource=&quot;_:c&quot;&amp;gt;&amp;lt;/div&amp;gt;
&amp;lt;div vocab=&quot;#&quot; about=&quot;_:c&quot;&amp;gt;
 &amp;lt;p&amp;gt;Band: &amp;lt;span property=&quot;name&quot;&amp;gt;Jazz Band&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
 &amp;lt;p&amp;gt;Size: &amp;lt;span property=&quot;size&quot;&amp;gt;12&amp;lt;/span&amp;gt; players&amp;lt;/p&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;In microdata, the &lt;code&gt;itemref&lt;/code&gt; attribute is a method of an item adopting name/value pairs described in a separate location within the page. In RDFa, the equivalent is to say that the name/value pairs are all related to the same resource by consistently referring to the resource as the subject of the statements. In the above case, there are two blank nodes labelled &lt;code&gt;_:amanda&lt;/code&gt; and &lt;code&gt;_:c&lt;/code&gt;, and the &lt;code&gt;about&lt;/code&gt; attribute is used on the same elements that provide the properties (or a wrapper element) to indicate the identity of the subject of the statements.&lt;/p&gt;

&lt;p&gt;Notes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;resource&lt;/code&gt; attribute has to be used to indicate the blank node for the band.&lt;/li&gt;
&lt;li&gt;As before, the &lt;code&gt;rel&lt;/code&gt; attribute has to be used for the &lt;code&gt;band&lt;/code&gt; property, rather than the &lt;code&gt;property&lt;/code&gt; attribute, because the object of the statement is a resource. The rule is that if you&amp;#8217;re using &lt;code&gt;resource&lt;/code&gt;, you should use &lt;code&gt;rel&lt;/code&gt;. (I used &lt;code&gt;property&lt;/code&gt; erroneously the first time I tried to write this mapping. I will never learn.)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There is another example of &lt;code&gt;itemref&lt;/code&gt; in use later in the microdata specification:&lt;/p&gt;

&lt;blockquote&gt;
&lt;pre&gt;&lt;code&gt;&amp;lt;!DOCTYPE HTML&amp;gt;
&amp;lt;html&amp;gt;
 &amp;lt;head&amp;gt;
  &amp;lt;title&amp;gt;Photo gallery&amp;lt;/title&amp;gt;
 &amp;lt;/head&amp;gt;
 &amp;lt;body&amp;gt;
  &amp;lt;h1&amp;gt;My photos&amp;lt;/h1&amp;gt;
  &amp;lt;figure itemscope itemtype=&quot;http://n.whatwg.org/work&quot; itemref=&quot;licenses&quot;&amp;gt;
   &amp;lt;img itemprop=&quot;work&quot; src=&quot;images/house.jpeg&quot; alt=&quot;A white house, boarded up, sits in a forest.&quot;&amp;gt;
   &amp;lt;figcaption itemprop=&quot;title&quot;&amp;gt;The house I found.&amp;lt;/figcaption&amp;gt;
  &amp;lt;/figure&amp;gt;
  &amp;lt;figure itemscope itemtype=&quot;http://n.whatwg.org/work&quot; itemref=&quot;licenses&quot;&amp;gt;
   &amp;lt;img itemprop=&quot;work&quot; src=&quot;images/mailbox.jpeg&quot; alt=&quot;Outside the house is a mailbox. It has a leaflet inside.&quot;&amp;gt;
   &amp;lt;figcaption itemprop=&quot;title&quot;&amp;gt;The mailbox.&amp;lt;/figcaption&amp;gt;
  &amp;lt;/figure&amp;gt;
  &amp;lt;footer&amp;gt;
   &amp;lt;p id=&quot;licenses&quot;&amp;gt;All images licensed under the &amp;lt;a itemprop=&quot;license&quot;
   href=&quot;http://www.opensource.org/licenses/mit-license.php&quot;&amp;gt;MIT
   license&amp;lt;/a&amp;gt;.&amp;lt;/p&amp;gt;
  &amp;lt;/footer&amp;gt;
 &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;This is equivalent to the RDF:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;[
  a &amp;lt;http://n.whatwg.org/work&amp;gt; ;
  &amp;lt;http://n.whatwg.org/license&amp;gt; &amp;lt;http://www.opensource.org/licenses/mit-license.php&amp;gt; ;
  &amp;lt;http://n.whatwg.org/work&amp;gt; &amp;lt;images/house.jpeg&amp;gt; ;
  &amp;lt;http://n.whatwg.org/title&amp;gt; &quot;The house I found.&quot; ;
] .
[
  a &amp;lt;http://n.whatwg.org/work&amp;gt; ;
  &amp;lt;http://n.whatwg.org/license&amp;gt; &amp;lt;http://www.opensource.org/licenses/mit-license.php&amp;gt; ;
  &amp;lt;http://n.whatwg.org/work&amp;gt; &amp;lt;images/mailbox.jpeg&amp;gt; ;
  &amp;lt;http://n.whatwg.org/title&amp;gt; &quot;The mailbox.&quot; ;
] .
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Note that the &lt;code&gt;license&lt;/code&gt; property is adopted by both the items in the microdata. In this particular example, the two items have the same type, and thus the &lt;code&gt;license&lt;/code&gt; property has the same meaning in each item. It&amp;#8217;s also possible for &lt;code&gt;itemref&lt;/code&gt; to be used on two items that have different types, pointing to the same element, in which case the shared properties defined within that element could mean different things for the two items.&lt;/p&gt;

&lt;p&gt;There is no way that I am aware of within RDFa to support shared use of portions of content. There could be a rough equivalent that would work in the case where the shared properties had the same semantics if RDFa allowed the &lt;code&gt;about&lt;/code&gt; attribute to take multiple values (&lt;strong&gt;note: invalid example&lt;/strong&gt;):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;!DOCTYPE HTML&amp;gt;
&amp;lt;html&amp;gt;
 &amp;lt;head&amp;gt;
  &amp;lt;title&amp;gt;Photo gallery&amp;lt;/title&amp;gt;
 &amp;lt;/head&amp;gt;
 &amp;lt;body vocab=&quot;http://n.whatwg.org/&quot;&amp;gt;
  &amp;lt;h1&amp;gt;My photos&amp;lt;/h1&amp;gt;
  &amp;lt;figure about=&quot;_:house&quot; typeof=&quot;work&quot;&amp;gt;
   &amp;lt;span rel=&quot;work&quot;&amp;gt;&amp;lt;img src=&quot;images/house.jpeg&quot; alt=&quot;A white house, boarded up, sits in a forest.&quot;&amp;gt;&amp;lt;/span&amp;gt;
   &amp;lt;figcaption property=&quot;title&quot;&amp;gt;The house I found.&amp;lt;/figcaption&amp;gt;
  &amp;lt;/figure&amp;gt;
  &amp;lt;figure about=&quot;_:mailbox&quot; typeof=&quot;work&quot;&amp;gt;
   &amp;lt;span rel=&quot;work&quot;&amp;gt;&amp;lt;img src=&quot;images/mailbox.jpeg&quot; alt=&quot;Outside the house is a mailbox. It has a leaflet inside.&quot;&amp;gt;&amp;lt;/span&amp;gt;
   &amp;lt;figcaption property=&quot;title&quot;&amp;gt;The mailbox.&amp;lt;/figcaption&amp;gt;
  &amp;lt;/figure&amp;gt;
  &amp;lt;footer&amp;gt;
   &amp;lt;p about=&quot;_:house _:mailbox&quot;&amp;gt;All images licensed under the &amp;lt;a rel=&quot;license&quot;
   href=&quot;http://www.opensource.org/licenses/mit-license.php&quot;&amp;gt;MIT
   license&amp;lt;/a&amp;gt;.&amp;lt;/p&amp;gt;
  &amp;lt;/footer&amp;gt;
 &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;but this wouldn&amp;#8217;t support the possibility of the same property having different semantics (and therefore different URIs) for the separate resources.&lt;/p&gt;

&lt;p&gt;It&amp;#8217;s also worth noting in this example that the mapping to RDF that I&amp;#8217;m assuming results, in this example, in &lt;code&gt;http://n.whatwg.org/work&lt;/code&gt; being both a class and a property. The creators of RDF vocabularies tend to name classes with an Uppercase initial letter and properties with a lowercase initial letter, and thus avoid these kinds of clashes. Vocabulary designers who are mindful of mappings to RDF may want to take the same approach.&lt;/p&gt;

&lt;h2&gt;Multiple Values&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;This example describes an ice cream, with two flavors:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div itemscope&amp;gt;
 &amp;lt;p&amp;gt;Flavors in my favorite ice cream:&amp;lt;/p&amp;gt;
 &amp;lt;ul&amp;gt;
  &amp;lt;li itemprop=&quot;flavor&quot;&amp;gt;Lemon sorbet&amp;lt;/li&amp;gt;
  &amp;lt;li itemprop=&quot;flavor&quot;&amp;gt;Apricot sorbet&amp;lt;/li&amp;gt;
 &amp;lt;/ul&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
  
  &lt;p&gt;This thus results in an item with two properties, both &amp;#8220;flavor&amp;#8221;, having the values &amp;#8220;Lemon sorbet&amp;#8221; and &amp;#8220;Apricot sorbet&amp;#8221;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This example highlights one of the real nightmares of RDF: lists. In microdata, the order of the values &amp;#8216;Lemon sorbet&amp;#8217; and &amp;#8216;Apricot sorbet&amp;#8217; is naturally retained. There are three possible mappings to RDF.&lt;/p&gt;

&lt;h3&gt;Creating Multiple Statements&lt;/h3&gt;

&lt;p&gt;If the order of the flavours of ice cream in this example don&amp;#8217;t actually matter, the equivalent RDF is:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;[ &amp;lt;#flavor&amp;gt; &quot;Lemon sorbet&quot; , &quot;Apricot sorbet&quot; ]
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;which is equivalent to:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;[ &amp;lt;#flavor&amp;gt; &quot;Apricot sorbet&quot; , &quot;Lemon sorbet&quot; ]
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;In this case, the RDFa is straight-forward:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div vocab=&quot;#&quot; typeof&amp;gt;
 &amp;lt;p&amp;gt;Flavors in my favorite ice cream:&amp;lt;/p&amp;gt;
 &amp;lt;ul&amp;gt;
  &amp;lt;li property=&quot;flavor&quot;&amp;gt;Lemon sorbet&amp;lt;/li&amp;gt;
  &amp;lt;li property=&quot;flavor&quot;&amp;gt;Apricot sorbet&amp;lt;/li&amp;gt;
 &amp;lt;/ul&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;It&amp;#8217;s surprising how common it is that order doesn&amp;#8217;t actually matter when there are multiple values for a property, such that this mapping is quite sufficient. But I&amp;#8217;m absolutely not going to pretend that order is never important&amp;#8230;&lt;/p&gt;

&lt;h3&gt;Creating an &lt;code&gt;rdf:Seq&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;If the order of the flavours does matter, there are two ways of representing that order using RDF. The first is to use an &lt;code&gt;rdf:Seq&lt;/code&gt; resource. This method was the original method of representing lists in RDF and is very natural to do in RDF/XML, but has largely fallen out of favour for the second method which I&amp;#8217;ll describe below.&lt;/p&gt;

&lt;p&gt;Using the &lt;code&gt;rdf:Seq&lt;/code&gt; method, the equivalent RDF for the microdata would be:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;@prefix rdf: &amp;lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&amp;gt; .
[
  &amp;lt;#flavor&amp;gt; [
    a rdf:Seq ;
    rdf:_1 &quot;Lemon sorbet&quot; ;
    rdf:_2 &quot;Apricot sorbet&quot;
  ]
]
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;which can be generated with:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div vocab=&quot;#&quot; typeof&amp;gt;
 &amp;lt;p&amp;gt;Flavors in my favorite ice cream:&amp;lt;/p&amp;gt;
 &amp;lt;div rel=&quot;flavor&quot;&amp;gt;
  &amp;lt;ul typeof=&quot;rdf:Seq&quot;&amp;gt;
   &amp;lt;li property=&quot;rdf:_1&quot;&amp;gt;Lemon sorbet&amp;lt;/li&amp;gt;
   &amp;lt;li property=&quot;rdf:_2&quot;&amp;gt;Apricot sorbet&amp;lt;/li&amp;gt;
  &amp;lt;/ul&amp;gt;
 &amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Notes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;There are various other ways in which the namespace for the &lt;code&gt;rdf:Seq&lt;/code&gt; could be created, but since the &lt;code&gt;rdf:&lt;/code&gt; prefix is built-in to RDFa 1.1, it seems easier to use that than anything that explicitly writes out the full (ugly) RDF namespace.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; wrapper for the &lt;code&gt;&amp;lt;ul&amp;gt;&lt;/code&gt; is needed in the same way as the wrapper &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt; element was needed in the &lt;code&gt;&amp;lt;img&amp;gt;&lt;/code&gt; example above. Whereas in microdata, the property element also describes the value of that property, in RDFa when the object of a statement is a resource the description of that resource is nested inside the property element (in a similar way to RDF/XML).&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;Creating a &lt;code&gt;rdf:List&lt;/code&gt;&lt;/h3&gt;

&lt;p&gt;The current recommended way to create a list in RDF is to use a &lt;code&gt;rdf:List&lt;/code&gt; resource. This essentially uses a &lt;a href=&quot;http://en.wikipedia.org/wiki/Linked_list&quot;&gt;linked list&lt;/a&gt; model to represent lists, with the &lt;code&gt;rdf:first&lt;/code&gt; item of a list being a value and the &lt;code&gt;rdf:rest&lt;/code&gt; being either another &lt;code&gt;rdf:List&lt;/code&gt; or &lt;code&gt;rdf:nil&lt;/code&gt;. Spelled out, the RDF would look like:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;@prefix rdf: &amp;lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#&amp;gt; .
[ 
  &amp;lt;#flavor&amp;gt; [
    a rdf:List ;
    rdf:first &quot;Lemon sorbet&quot; ;
    rdf:rest [
      rdf:first &quot;Apricot sorbet&quot; ;
      rdf:rest rdf:nil
    ]
  ]
]
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;but of course Turtle lets you write it:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;[] &amp;lt;#flavor&amp;gt; ( &quot;Lemon sorbet&quot; &quot;Apricot sorbet&quot; ) .
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Unfortunately, RDFa has no such syntax sugar. Which means:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div vocab=&quot;#&quot; typeof&amp;gt;
 &amp;lt;p&amp;gt;Flavors in my favorite ice cream:&amp;lt;/p&amp;gt;
 &amp;lt;div rel=&quot;flavor&quot;&amp;gt;
  &amp;lt;ul typeof=&quot;rdf:List&quot;&amp;gt;
   &amp;lt;li property=&quot;rdf:first&quot;&amp;gt;Lemon sorbet&amp;lt;/li&amp;gt;
   &amp;lt;li rel=&quot;rdf:rest&quot;&amp;gt;
    &amp;lt;span typeof=&quot;rdf:List&quot;&amp;gt;
     &amp;lt;span property=&quot;rdf:first&quot;&amp;gt;Apricot sorbet&amp;lt;/span&amp;gt;
     &amp;lt;a rel=&quot;rdf:rest&quot; href=&quot;rdf:nil&quot;&amp;gt;&amp;lt;/a&amp;gt;
    &amp;lt;/span&amp;gt;
   &amp;lt;/li&amp;gt;
  &amp;lt;/ul&amp;gt;
 &amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Yep, horrific. Verbose and easy to get wrong, and that&amp;#8217;s just for two items. If a third is added, the pattern is to add an &lt;code&gt;about&lt;/code&gt; attribute on the middle items of the list so that the &lt;code&gt;rdf:rest&lt;/code&gt; property which covers the next item in the list can be assigned to it. For example:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div vocab=&quot;#&quot; typeof&amp;gt;
 &amp;lt;p&amp;gt;Flavors in my favorite ice cream:&amp;lt;/p&amp;gt;
 &amp;lt;div rel=&quot;flavor&quot;&amp;gt;
  &amp;lt;ul typeof=&quot;rdf:List&quot;&amp;gt;
   &amp;lt;li property=&quot;rdf:first&quot;&amp;gt;Lemon sorbet&amp;lt;/li&amp;gt;
   &amp;lt;li rel=&quot;rdf:rest&quot;&amp;gt;
    &amp;lt;span about=&quot;_:2&quot; typeof=&quot;List&quot;&amp;gt;
     &amp;lt;span property=&quot;rdf:first&quot;&amp;gt;Apricot sorbet&amp;lt;/span&amp;gt;
    &amp;lt;/span&amp;gt;
   &amp;lt;/li&amp;gt;
   &amp;lt;li about=&quot;_:2&quot; rel=&quot;rdf:rest&quot;&amp;gt;
     &amp;lt;span typeof=&quot;rdf:List&quot;&amp;gt;
     &amp;lt;span property=&quot;rdf:first&quot;&amp;gt;Raspberry sorbet&amp;lt;/span&amp;gt;
     &amp;lt;a rel=&quot;rdf:rest&quot; href=&quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#nil&quot;&amp;gt;&amp;lt;/a&amp;gt;
     &amp;lt;/span&amp;gt;
   &amp;lt;/li&amp;gt;
  &amp;lt;/ul&amp;gt;
 &amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Note:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I&amp;#8217;ve used an empty &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; element with a &lt;code&gt;href&lt;/code&gt; attribute to point to the &lt;code&gt;rdf:nil&lt;/code&gt; resource. An alternative would be to use the &lt;code&gt;resource&lt;/code&gt; attribute, which would have the advantage of not having to spell out the full URI for &lt;code&gt;rdf:nil&lt;/code&gt;, but I&amp;#8217;m trying to stick to using as few attributes as possible.&lt;/li&gt;
&lt;li&gt;Using an empty &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; element for a link isn&amp;#8217;t ideal; it would be neater to use a &lt;code&gt;&amp;lt;link&amp;gt;&lt;/code&gt; element, but these aren&amp;#8217;t allowed in flow content within HTML5 (&lt;code&gt;&amp;lt;link&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;meta&amp;gt;&lt;/code&gt; are only permitted within the microdata specification, and then only if they have an &lt;code&gt;itemprop&lt;/code&gt; attribute). The RDFa specification could likewise allow them.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Multiple Properties Sharing a Value&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;Here we see an item with two properties, &amp;#8220;favorite-color&amp;#8221; and &amp;#8220;favorite-fruit&amp;#8221;, both set to the value &amp;#8220;orange&amp;#8221;:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div itemscope&amp;gt;
 &amp;lt;span itemprop=&quot;favorite-color favorite-fruit&quot;&amp;gt;orange&amp;lt;/span&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;This should map to the RDF:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;[
  &amp;lt;#favorite-color&amp;gt; &quot;orange&quot; ;
  &amp;lt;#favorite-fruit&amp;gt; &quot;orange&quot;
]
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Like &lt;code&gt;itemprop&lt;/code&gt;, &lt;code&gt;property&lt;/code&gt; can take multiple values, so the RDFa equivalent is simply:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div vocab=&quot;#&quot; typeof&amp;gt;
 &amp;lt;span property=&quot;favorite-color favorite-fruit&quot;&amp;gt;orange&amp;lt;/span&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Types&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;Here, the item&amp;#8217;s type is &amp;#8220;http://example.org/animals#cat&amp;#8221;:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;section itemscope itemtype=&quot;http://example.org/animals#cat&quot;&amp;gt;
 &amp;lt;h1 itemprop=&quot;name&quot;&amp;gt;Hedral&amp;lt;/h1&amp;gt;
 &amp;lt;p itemprop=&quot;desc&quot;&amp;gt;Hedral is a male american domestic
 shorthair, with a fluffy black fur with white paws and belly.&amp;lt;/p&amp;gt;
 &amp;lt;img itemprop=&quot;img&quot; src=&quot;hedral.jpeg&quot; alt=&quot;&quot; title=&quot;Hedral, age 18 months&quot;&amp;gt;
&amp;lt;/section&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
  
  &lt;p&gt;In this example the &amp;#8220;http://example.org/animals#cat&amp;#8221; item has three properties, a &amp;#8220;name&amp;#8221; (&amp;#8220;Hedral&amp;#8221;), a &amp;#8220;desc&amp;#8221; (&amp;#8220;Hedral is&amp;#8230;&amp;#8221;), and an &amp;#8220;img&amp;#8221; (&amp;#8220;hedral.jpeg&amp;#8221;).&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I&amp;#8217;ll assume that this should be mapped to the RDF:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;[
  a &amp;lt;http://example.org/animals#cat&amp;gt; ;
  &amp;lt;http://example.org/animals#name&amp;gt; &quot;Hedral&quot; ;
  &amp;lt;http://example.org/animals#desc&amp;gt; &quot;Hedral is a male american domestic shorthair, with a fluffy black fur with white paws and belly.&quot; ;
  &amp;lt;http://example.org/animals#img&amp;gt; &amp;lt;hedral.jpeg&amp;gt;
]
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;In this case, the &lt;code&gt;vocab&lt;/code&gt; can be set to &lt;code&gt;http://example.org/animals#&lt;/code&gt; and both the &lt;code&gt;itemtype&lt;/code&gt; and the various &lt;code&gt;property&lt;/code&gt; and &lt;code&gt;rel&lt;/code&gt; attributes will use that as the basis for their identifying URIs:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;section vocab=&quot;http://example.org/animals#&quot; typeof=&quot;cat&quot;&amp;gt;
 &amp;lt;h1 property=&quot;name&quot;&amp;gt;Hedral&amp;lt;/h1&amp;gt;
 &amp;lt;p property=&quot;desc&quot;&amp;gt;Hedral is a male american domestic
 shorthair, with a fluffy black fur with white paws and belly.&amp;lt;/p&amp;gt;
 &amp;lt;div rel=&quot;img&quot;&amp;gt;&amp;lt;img src=&quot;hedral.jpeg&quot; alt=&quot;&quot; title=&quot;Hedral, age 18 months&quot;&amp;gt;&amp;lt;/div&amp;gt;
&amp;lt;/section&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Global Identifiers&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;Here, an item is talking about a particular book:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;dl itemscope
    itemtype=&quot;http://vocab.example.net/book&quot;
    itemid=&quot;urn:isbn:0-330-34032-8&quot;&amp;gt;
 &amp;lt;dt&amp;gt;Title
 &amp;lt;dd itemprop=&quot;title&quot;&amp;gt;The Reality Dysfunction
 &amp;lt;dt&amp;gt;Author
 &amp;lt;dd itemprop=&quot;author&quot;&amp;gt;Peter F. Hamilton
 &amp;lt;dt&amp;gt;Publication date
 &amp;lt;dd&amp;gt;&amp;lt;time itemprop=&quot;pubdate&quot; datetime=&quot;1996-01-26&quot;&amp;gt;26 January 1996&amp;lt;/time&amp;gt;
&amp;lt;/dl&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;Here, the item has an identifier so unlike the previous examples, the subject of the statements in the RDF is no longer a blank node:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;@prefix xsd: &amp;lt;http://www.w3.org/2001/XMLSchema#&amp;gt; .
&amp;lt;urn:isbn:0-330-34032-8&amp;gt;
  a &amp;lt;http://vocab.example.net/book&amp;gt; ;
  &amp;lt;http://vocab.example.net/title&amp;gt; &quot;The Reality Dysfunction\n &quot; ;
  &amp;lt;http://vocab.example.net/author&amp;gt; &quot;Peter F. Hamilton\n &quot; ;
  &amp;lt;http://vocab.example.net/pubdate&amp;gt; &quot;1996-01-26&quot;^^xsd:date ;
  .
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;In RDFa, the subject is provided using the &lt;code&gt;about&lt;/code&gt; attribute:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;dl vocab=&quot;http://vocab.example.net/&quot;
    typeof=&quot;book&quot;
    about=&quot;urn:isbn:0-330-34032-8&quot;&amp;gt;
 &amp;lt;dt&amp;gt;Title
 &amp;lt;dd property=&quot;title&quot;&amp;gt;The Reality Dysfunction
 &amp;lt;dt&amp;gt;Author
 &amp;lt;dd property=&quot;author&quot;&amp;gt;Peter F. Hamilton
 &amp;lt;dt&amp;gt;Publication date
 &amp;lt;dd&amp;gt;&amp;lt;time property=&quot;pubdate&quot; content=&quot;1996-01-26&quot; datatype=&quot;xsd:date&quot; datetime=&quot;1996-01-26&quot;&amp;gt;26 January 1996&amp;lt;/time&amp;gt;
&amp;lt;/dl&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Global Property Names&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;Here, an item is an &amp;#8220;http://example.org/animals#cat&amp;#8221;, and most of the properties have names that are words defined in the context of that type. There are also a few additional properties whose names come from other vocabularies.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;section itemscope itemtype=&quot;http://example.org/animals#cat&quot;&amp;gt;
 &amp;lt;h1 itemprop=&quot;name http://example.com/fn&quot;&amp;gt;Hedral&amp;lt;/h1&amp;gt;
 &amp;lt;p itemprop=&quot;desc&quot;&amp;gt;Hedral is a male american domestic
 shorthair, with a fluffy &amp;lt;span
 itemprop=&quot;http://example.com/color&quot;&amp;gt;black&amp;lt;/span&amp;gt; fur with &amp;lt;span
 itemprop=&quot;http://example.com/color&quot;&amp;gt;white&amp;lt;/span&amp;gt; paws and belly.&amp;lt;/p&amp;gt;
 &amp;lt;img itemprop=&quot;img&quot; src=&quot;hedral.jpeg&quot; alt=&quot;&quot; title=&quot;Hedral, age 18 months&quot;&amp;gt;
&amp;lt;/section&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;The RDF equivalent to this is:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;[
  a &amp;lt;http://example.org/animals#cat&amp;gt; ;
  &amp;lt;http://example.org/animals#name&amp;gt; &quot;Hedral&quot; ;
  &amp;lt;http://example.com/fn&amp;gt; &quot;Hedral&quot; ;
  &amp;lt;http://example.org/animals#desc&amp;gt; &quot;Hedral is a male american domestic shorthair, with a fluffy black fur with white paws and belly.&quot; ;
  &amp;lt;http://example.com/color&amp;gt; &quot;black&quot; , &quot;white&quot; ;
  &amp;lt;http://example.org/animals#img&amp;gt; &amp;lt;hedral.jpeg&amp;gt;
]
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;To create this, we need the RDFa:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;section vocab=&quot;http://example.org/animals#&quot; typeof=&quot;cat&quot;&amp;gt;
 &amp;lt;h1 property=&quot;name http://example.com/fn&quot;&amp;gt;Hedral&amp;lt;/h1&amp;gt;
 &amp;lt;p property=&quot;desc&quot;&amp;gt;Hedral is a male american domestic
 shorthair, with a fluffy &amp;lt;span
 property=&quot;http://example.com/color&quot;&amp;gt;black&amp;lt;/span&amp;gt; fur with &amp;lt;span
 property=&quot;http://example.com/color&quot;&amp;gt;white&amp;lt;/span&amp;gt; paws and belly.&amp;lt;/p&amp;gt;
 &amp;lt;span rel=&quot;img&quot;&amp;gt;&amp;lt;img src=&quot;hedral.jpeg&quot; alt=&quot;&quot; title=&quot;Hedral, age 18 months&quot;&amp;gt;&amp;lt;/span&amp;gt;
&amp;lt;/section&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;Link Relations&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;Here is an example of a page that uses the vEvent vocabulary to mark up an event:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;body itemscope itemtype=&quot;http://microformats.org/profile/hcalendar#vevent&quot;&amp;gt;
 ...
 &amp;lt;h1 itemprop=&quot;summary&quot;&amp;gt;Bluesday Tuesday: Money Road&amp;lt;/h1&amp;gt;
 ...
 &amp;lt;time itemprop=&quot;dtstart&quot; datetime=&quot;2009-05-05T19:00:00Z&quot;&amp;gt;May 5th @ 7pm&amp;lt;/time&amp;gt;
 (until &amp;lt;time itemprop=&quot;dtend&quot; datetime=&quot;2009-05-05T21:00:00Z&quot;&amp;gt;9pm&amp;lt;/time&amp;gt;)
 ...
 &amp;lt;a href=&quot;http://livebrum.co.uk/2009/05/05/bluesday-tuesday-money-road&quot;
    rel=&quot;bookmark&quot; itemprop=&quot;url&quot;&amp;gt;Link to this page&amp;lt;/a&amp;gt;
 ...
 &amp;lt;p&amp;gt;Location: &amp;lt;span itemprop=&quot;location&quot;&amp;gt;The RoadHouse&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
 ...
 &amp;lt;p&amp;gt;&amp;lt;input type=button value=&quot;Add to Calendar&quot;
           onclick=&quot;location = getCalendar(this)&quot;&amp;gt;&amp;lt;/p&amp;gt;
 ...
 &amp;lt;meta itemprop=&quot;description&quot; content=&quot;via livebrum.co.uk&quot;&amp;gt;
&amp;lt;/body&amp;gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;This example is interesting because it contains, in the natural markup of the page, a &lt;code&gt;rel&lt;/code&gt; attribute with the value &lt;a href=&quot;http://www.w3.org/TR/html5/links.html#link-type-bookmark&quot;&gt;&lt;code&gt;bookmark&lt;/code&gt;&lt;/a&gt;, which is used for links that go to the page or section of the page within which the link is found. In this case, it&amp;#8217;s the page. The RDF that should be generated from the page is:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;[
  a &amp;lt;http://microformats.org/profile/hcalendar#vevent&amp;gt; ;
  &amp;lt;http://microformats.org/profile/hcalendar#summary&amp;gt; &quot;Bluesday Tuesday: Money Road&quot; ;
  &amp;lt;http://microformats.org/profile/hcalendar#dtstart&amp;gt; &quot;2009-05-05T19:00:00Z&quot;^^xsd:dateTime ;
  &amp;lt;http://microformats.org/profile/hcalendar#dtend&amp;gt; &quot;2009-05-05T21:00:00Z&quot;^^xsd:dateTime ;
  &amp;lt;http://microformats.org/profile/hcalendar#url&amp;gt; &amp;lt;http://livebrum.co.uk/2009/05/05/bluesday-tuesday-money-road&amp;gt; ;
  &amp;lt;http://microformats.org/profile/hcalendar#location&amp;gt; &quot;The RoadHouse&quot; ;
  &amp;lt;http://microformats.org/profile/hcalendar#description&amp;gt; &quot;via livebrum.co.uk&quot;
] .
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The following statement could legitimately be generated as well:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;&amp;gt; 
  &amp;lt;http://www.w3.org/1999/xhtml/vocab#bookmark&amp;gt; &amp;lt;http://livebrum.co.uk/2009/05/05/bluesday-tuesday-money-road&amp;gt; ;
  .
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;but the item representing the event should definitely not have the &lt;code&gt;http://www.w3.org/1999/xhtml/vocab#bookmark&lt;/code&gt; property.&lt;/p&gt;

&lt;p&gt;Achieving this without significantly changing the HTML markup is problematic in RDFa because RDFa uses the &lt;code&gt;rel&lt;/code&gt; attribute to provide properties for the resources that it describes within the page, overloading its standard use in HTML which is to describe properties of the page or sections within the page. The following involves the least amount of repetition:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;body vocab=&quot;http://microformats.org/profile/hcalendar#&quot;&amp;gt;
 &amp;lt;div typeof=&quot;vevent&quot;&amp;gt;
  ...
  &amp;lt;h1 property=&quot;summary&quot;&amp;gt;Bluesday Tuesday: Money Road&amp;lt;/h1&amp;gt;
  ...
  &amp;lt;time property=&quot;dtstart&quot; content=&quot;2009-05-05T19:00:00Z&quot; datatype=&quot;xsd:dateTime&quot; 
        datetime=&quot;2009-05-05T19:00:00Z&quot;&amp;gt;May 5th @ 7pm&amp;lt;/time&amp;gt;
  (until &amp;lt;time property=&quot;dtend&quot; content=&quot;2009-05-05T21:00:00Z&quot; datatype=&quot;xsd:dateTime&quot; 
               datetime=&quot;2009-05-05T21:00:00Z&quot;&amp;gt;9pm&amp;lt;/time&amp;gt;)
  ...
  &amp;lt;a rel=&quot;url&quot; href=&quot;http://livebrum.co.uk/2009/05/05/bluesday-tuesday-money-road&quot;&amp;gt;&amp;lt;/a&amp;gt;
  &amp;lt;a about href=&quot;http://livebrum.co.uk/2009/05/05/bluesday-tuesday-money-road&quot;
     rel=&quot;bookmark&quot;&amp;gt;Link to this page&amp;lt;/a&amp;gt;
  ...
  &amp;lt;p&amp;gt;Location: &amp;lt;span property=&quot;location&quot;&amp;gt;The RoadHouse&amp;lt;/span&amp;gt;&amp;lt;/p&amp;gt;
  ...
  &amp;lt;p&amp;gt;&amp;lt;input type=button value=&quot;Add to Calendar&quot;
            onclick=&quot;location = getCalendar(this)&quot;&amp;gt;&amp;lt;/p&amp;gt;
  ...
  &amp;lt;span property=&quot;description&quot; content=&quot;via livebrum.co.uk&quot;&amp;gt;&amp;lt;/span&amp;gt;
 &amp;lt;/div&amp;gt;
&amp;lt;/body&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Notes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In the above, the &lt;code&gt;typeof&lt;/code&gt; attribute has been moved onto a wrapper &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; that encompasses the entirety of the page because if it resides on the &lt;code&gt;&amp;lt;body&amp;gt;&lt;/code&gt; element, it&amp;#8217;s assumed to apply to the document itself rather than a blank node. An alternative mapping would use &lt;code&gt;about=&quot;_:event&quot;&lt;/code&gt; to create a blank node for the event.&lt;/li&gt;
&lt;li&gt;There&amp;#8217;s no way to avoid creating a statement for the &lt;code&gt;rel=&quot;bookmark&quot;&lt;/code&gt; link, so the best we can do is make sure that the statement is accurate, and relates the current document to the provided URI. Unfortunately, that means creating a separate element for the &lt;code&gt;url&lt;/code&gt; property, repeating that URL within the page, and adding an empty &lt;code&gt;about&lt;/code&gt; attribute; here I&amp;#8217;ve used an empty &lt;code&gt;&amp;lt;a&amp;gt;&lt;/code&gt; element to express the relationship; a &lt;code&gt;&amp;lt;link&amp;gt;&lt;/code&gt; element would do the same job if it were allowed in flow content.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;&amp;lt;meta&amp;gt;&lt;/code&gt; element in the original has been mapped to an empty &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt; element as it isn&amp;#8217;t allowed in flow content without an &lt;code&gt;itemprop&lt;/code&gt; attribute.&lt;/li&gt;
&lt;/ul&gt;
</description>
 <comments>http://www.jenitennison.com/blog/node/163#comments</comments>
 <category domain="http://www.jenitennison.com/blog/taxonomy/term/71">microdata</category>
 <category domain="http://www.jenitennison.com/blog/taxonomy/term/42">rdfa</category>
 <pubDate>Sat, 20 Aug 2011 16:35:28 +0000</pubDate>
 <dc:creator>Jeni</dc:creator>
 <guid isPermaLink="false">163 at http://www.jenitennison.com/blog</guid>
</item>
<item>
 <title>Microdata + RDF</title>
 <link>http://www.jenitennison.com/blog/node/162</link>
 <description>&lt;p&gt;As part of the ongoing discussion about how to reconcile RDFa and microdata (if at all), &lt;a href=&quot;http://webr3.org/blog/&quot;&gt;Nathan Rixham&lt;/a&gt; has put together a suggested &lt;a href=&quot;http://www.w3.org/wiki/Microdata_RDFa_Merge&quot;&gt;Microdata RDFa Merge&lt;/a&gt; which brings together parts of &lt;a href=&quot;http://www.whatwg.org/specs/web-apps/current-work/multipage/microdata.html&quot;&gt;microdata&lt;/a&gt; and parts of &lt;a href=&quot;http://www.w3.org/TR/rdfa-core/&quot;&gt;RDFa&lt;/a&gt;, creating a completely new set of attributes, but a parsing model that more or less follows microdata&amp;#8217;s.&lt;/p&gt;

&lt;p&gt;I want here to put forward another possibility to the debate. I should say that this is just some noodling on my part as a way of exploring options, not any kind of official position on the behalf of the W3C or the TAG or any other body that you might associate me with, nor even a decided position on my part.&lt;/p&gt;

&lt;!--break--&gt;

&lt;h2&gt;Simplifying RDFa&lt;/h2&gt;

&lt;p&gt;As &lt;a href=&quot;http://www.jenitennison.com/blog/node/103&quot;&gt;I&amp;#8217;ve said before&lt;/a&gt;, RDFa, in my experience, is complicated not primarily because of the whole namespaces/CURIEs issue but because its processing model tries to be too clever. RDFa was designed to largely fit in with existing markup and turn it into embedded data &amp;#8220;just&amp;#8221; by adding a few attributes here and there. Thus a simple image like:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;img src=&quot;photo1.jpg&quot;&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;is first marked up to indicate that it&amp;#8217;s an image:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;img src=&quot;photo1.jpg&quot; typeof=&quot;foaf:Image&quot;&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;then to provide its license:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;img src=&quot;photo1.jpg&quot; typeof=&quot;foaf:Image&quot;
  rel=&quot;license&quot; resource=&quot;http://creativecommons.org/licenses/by/2.0/&quot;&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;and finally to add a title:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;img src=&quot;photo1.jpg&quot; typeof=&quot;foaf:Image&quot;
  rel=&quot;license&quot; resource=&quot;http://creativecommons.org/licenses/by/2.0/&quot;
  property=&quot;dc:title&quot; content=&quot;A Pretty Picture&quot;&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;all by adding attributes to the one &lt;code&gt;&amp;lt;img&amp;gt;&lt;/code&gt; element. The trouble with this approach is that the rules about how statements are made become extremely complex, dependent on context (eg what other attributes are present, what the parent element has on it, what content it has) and default in ways that are hard to remember.&lt;/p&gt;

&lt;p&gt;Even having written an RDFa parser, having written code to mark up documents with RDFa, having &lt;em&gt;taught&lt;/em&gt; it, I still cannot write RDFa past a trivial example and be 100% sure that it will produce what I was aiming to produce.&lt;/p&gt;

&lt;p&gt;If we were to look at really simplifying RDFa, rather than making cosmetic changes, we need to address this complexity. It would certainly mean backwards-incompatible changes, such as dropping the use of particular attributes and revising the way the processing model works, such that future RDFa processors couldn&amp;#8217;t be used on RDFa 1.0. There are two possible ways of approaching this:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;retaining some backwards compatibility, and aiming for a simplified subset of RDFa 1.0 such that RDFa 1.0 processor will still get the intended triples out of data marked up with RDFa 1.1&lt;/li&gt;
&lt;li&gt;dropping backwards compatibility entirely and using completely different attributes, essentially creating a new language&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I do not know which of these routes is the best one to take.&lt;/p&gt;

&lt;p&gt;My instinct is that the first will be hard to do. For example, there are already certain simplifications in RDFa 1.1 &amp;#8212; such as assuming an element with no &lt;code&gt;datatype&lt;/code&gt; attribute is giving a string value rather than looking to see if there are any non-text-nodes in the content of the element &amp;#8212; which lead to markup that will not be processed correctly by RDFa 1.0 processors. Perhaps that could be addressed by rewriting history: creating a RDFa 1.0 Second Edition that includes any changes that are needed to make a simple subset viable.&lt;/p&gt;

&lt;p&gt;What I want to explore here is what the second route &amp;#8212; using entirely different attributes from those currently used in RDFa 1.0 &amp;#8212; might mean. I think that in this case the substantial difference between microdata and this new language would be support for that much-derided requirement: decentralised extensibility.&lt;/p&gt;

&lt;h2&gt;Adding Decentralised Extensibility to Microdata&lt;/h2&gt;

&lt;p&gt;As I discussed &lt;a href=&quot;http://www.jenitennison.com/blog/node/161&quot;&gt;earlier in the week&lt;/a&gt;, microdata is simply not designed for use in a web where publishers might want to use multiple vocabularies to mark up the same thing for different consumers. This focus is very probably the right one for the majority of uses, where publishers address single consumers or everyone has standardised on a single vocabulary. It&amp;#8217;s certainly an assumption that keeps the markup simple.&lt;/p&gt;

&lt;p&gt;However, there is a larger data web out there. It&amp;#8217;s not just browsers and search engines who might look for and process data embedded within a page. Unlike with HTML, those few, large consumers don&amp;#8217;t have to understand a particular vocabulary for other consumers to get valuable information from it. If you operate in a world of multiple consumers with different requirements, you need decentralised extensibility. And support for decentralised extensibility is RDF&amp;#8217;s niche as a data model, its unique selling point.&lt;/p&gt;

&lt;p&gt;Given that a new language would have to use a different processing model from RDFa 1.0, I would suggest that it simply uses microdata&amp;#8217;s as a starting point. Using attributes from RDFa 1.0 would only cause conflicts with RDFa 1.0 processors. Microdata processing is there, already defined, already implemented. It isn&amp;#8217;t going to go away. And you know, &lt;em&gt;it&amp;#8217;s pretty good&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;The &amp;#8216;new language&amp;#8217; would then not so much a &amp;#8216;new language&amp;#8217; as an enhancement on something that already exists. It would be a set of additions that augment the data that is generated from normal microdata processing with a few extra features that are useful in a world where there are multiple vocabularies for the same domain, where publishers have to provide data to multiple consumers, where an RDF view of data is useful. Call it microdata+RDF.&lt;/p&gt;

&lt;p&gt;So what would we need to add? Well, there are three things, I think, that make microdata hard to use in a decentralised world, and make it hard to generate good RDF from microdata markup:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;lack of support for multiple types&lt;/li&gt;
&lt;li&gt;scoping of properties by type&lt;/li&gt;
&lt;li&gt;lack of datatypes&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;We would need to find a way to add these for use within the RDF extracted from the microdata markup such that a basic microdata parser would still generate the same JSON, and such that microdata&amp;#8217;s DOM API would work as specified in the microdata spec. So we can&amp;#8217;t change the types of values that are possible in microdata&amp;#8217;s attributes or how they&amp;#8217;re interpreted in the DOM API.&lt;/p&gt;

&lt;h3&gt;Multiple Types&lt;/h3&gt;

&lt;p&gt;Because of the restrictions I just mentioned in not touching microdata itself, we can&amp;#8217;t simply make &lt;code&gt;itemtype&lt;/code&gt; take multiple URLs. We could rely on &lt;code&gt;itemprop=&quot;http://www.w3.org/1999/02/22-rdf-syntax-ns#type&quot;&lt;/code&gt; as a mechanism of providing types for use by RDF processors, but I think that the types of something is such a fundamental property that it makes sense to have a dedicated attribute.&lt;/p&gt;

&lt;p&gt;I suggest &lt;code&gt;itemclass&lt;/code&gt;. It would only be allowed on elements with an &lt;code&gt;itemscope&lt;/code&gt; attribute and would take a space-separated set of values in exactly the same way as the &lt;code&gt;itemprop&lt;/code&gt; attribute. The values would be turned into URIs in the same way as for the &lt;code&gt;itemprop&lt;/code&gt; attribute, which I&amp;#8217;ll describe below.&lt;/p&gt;

&lt;p&gt;Microdata+RDF would add a method to the existing microdata DOM API to enable people to access items by class rather than their single type. So:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;document . getItemsByClass( classes )
Returns a NodeList of the elements in the Document that create items, that are not 
part of other items, and that have one or more of the types or classes given in the 
argument.

The classes argument is interpreted as a space-separated list of classes.
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Note that for simplicity, because they are interpreted in the same way within the RDF model, this returns items whose &lt;code&gt;itemtype&lt;/code&gt; is listed in the argument list of classes as well as those whose &lt;code&gt;itemclass&lt;/code&gt; is listed.&lt;/p&gt;

&lt;p&gt;Within the DOM API, the &lt;code&gt;itemClass&lt;/code&gt; IDL attribute on HTML elements would reflect the &lt;code&gt;itemclass&lt;/code&gt; attribute.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;itemclass&lt;/code&gt; attribute would be ignored for the purpose of creating JSON from microdata, and only be used when creating RDF.&lt;/p&gt;

&lt;p&gt;An example would be:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;li class=&quot;conference&quot; itemscope itemid=&quot;/2011/oscon/&quot;
    itemtype=&quot;http://schema.org/Event&quot;
    itemclass=&quot;http://microformats.org/profile/hcalendar#vevent /vocab/Conference&quot;&amp;gt;
  ...
&amp;lt;/li&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The JSON generated from this would look like:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{
  &quot;type&quot;: &quot;http://schema.org/Event&quot; ,
  &quot;id&quot;: &quot;http://lanyrd.com/2011/oscon/&quot;,
  &quot;properties&quot;: {}
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The RDF would look like:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;http://lanyrd.com/2011/oscon&amp;gt;
  a &amp;lt;http://schema.org/Event&amp;gt; ,
    &amp;lt;http://microformats.org/profile/hcalendar#vevent&amp;gt; ,
    &amp;lt;http://lanyrd.com/vocab/Conference&amp;gt; ;
  .
&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;Disambiguating Properties&lt;/h3&gt;

&lt;p&gt;To work with the RDF model, properties have to have URIs. We need to have a way of easily creating the URIs for the short-name properties without people changing their existing microdata markup.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Note: I&amp;#8217;ve substantially revised this section following discussion with &lt;a href=&quot;http://blog.foolip.org/&quot;&gt;Philip Jägenstedt&lt;/a&gt;. Old text is struck through, new text underlined.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The way that this is done in RDFa 1.1 is through a &lt;code&gt;vocab&lt;/code&gt; attribute, which provides a URI prefix that is concatenated to any short-name properties or types. &lt;strike&gt;We could use the same approach here, but call the attribute &lt;code&gt;itemvocab&lt;/code&gt; to fit in with the general method of naming attributes in microdata.&lt;/strike&gt; &lt;u&gt;Using this with microdata would be tedious for users however, and it would be easy for the &lt;code&gt;itemtype&lt;/code&gt; and &lt;code&gt;itemvocab&lt;/code&gt; to get out of sync in weird ways.&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;&lt;strike&gt;&lt;code&gt;itemvocab&lt;/code&gt; would only be allowed on elements with an &lt;code&gt;itemscope&lt;/code&gt;. The scope of &lt;code&gt;itemvocab&lt;/code&gt; would be limited to the item itself, so that it&amp;#8217;s not forgotten when it&amp;#8217;s needed, particularly in copy-and-paste scenarios. However, to make it easier to use I think it should probably be given a default value if it isn&amp;#8217;t present, as follows:&lt;/strike&gt;&lt;/p&gt;

&lt;p&gt;&lt;u&gt;Instead, the vocabulary for the properties could be identified as follows:&lt;/u&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;set &lt;em&gt;vocab&lt;/em&gt; to the &lt;code&gt;itemtype&lt;/code&gt; of the item if it is present, and the URL of the document if not&lt;/li&gt;
&lt;li&gt;use a substring of &lt;em&gt;vocab&lt;/em&gt;:
&lt;ol&gt;&lt;li&gt;if &lt;em&gt;vocab&lt;/em&gt; contains a &lt;code&gt;#&lt;/code&gt;, the substring of &lt;em&gt;vocab&lt;/em&gt; up to and including the &lt;code&gt;#&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;otherwise, the substring of &lt;em&gt;vocab&lt;/em&gt; up to and including its final &lt;code&gt;/&lt;/code&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;For example, if you have:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;li class=&quot;conference&quot; itemscope itemid=&quot;/2011/oscon/&quot;
    itemtype=&quot;http://schema.org/Event&quot;
    itemclass=&quot;http://microformats.org/profile/hcalendar#vevent /vocab/Conference&quot;&amp;gt;
  ...
&amp;lt;/li&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;then &lt;strike&gt;&lt;code&gt;itemvocab&lt;/code&gt;&lt;/strike&gt; &lt;u&gt;the item vocabulary&lt;/u&gt; would default to &lt;code&gt;http://schema.org/&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strike&gt;There could be an extra restriction that if &lt;code&gt;itemtype&lt;/code&gt; is specified, &lt;code&gt;itemvocab&lt;/code&gt; must be in the same domain as that type; that could help prevent the weird situation where in the generated RDF the properties would be interpreted as being in a completely different vocabulary from the &lt;code&gt;itemtype&lt;/code&gt;.&lt;/strike&gt;&lt;/p&gt;

&lt;p&gt;&lt;strike&gt;Within the DOM API, the &lt;code&gt;itemVocab&lt;/code&gt; IDL attribute on HTML elements would reflect the &lt;code&gt;itemvocab&lt;/code&gt; attribute.&lt;/strike&gt;&lt;/p&gt;

&lt;p&gt;&lt;u&gt;Note: the following example has been altered in place.&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;For example, take the following markup:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;li class=&quot;conference&quot; itemscope itemid=&quot;/2011/oscon/&quot;
    itemtype=&quot;http://schema.org/Event&quot; 
    itemclass=&quot;SocialEvent BusinessEvent EducationEvent&quot;&amp;gt;
  &amp;lt;h3&amp;gt;
    &amp;lt;a itemprop=&quot;url&quot; href=&quot;/2011/oscon/&quot;&amp;gt;
      &amp;lt;span itemprop=&quot;name&quot;&amp;gt;OSCON 2011&amp;lt;/span&amp;gt;
    &amp;lt;/a&amp;gt;
  &amp;lt;/h3&amp;gt;
  &amp;lt;p itemprop=&quot;location&quot; itemscope itemid=&quot;/places/portland/&quot;
     itemtype=&quot;http://schema.org/Place&quot;&amp;gt;
    &amp;lt;span itemprop=&quot;name&quot;&amp;gt;&amp;lt;a href=&quot;/places/usa/&quot;&amp;gt;United States&amp;lt;/a&amp;gt; / &amp;lt;a itemprop=&quot;url&quot; href=&quot;/places/portland/&quot;&amp;gt;Portland&amp;lt;/a&amp;gt;&amp;lt;/span&amp;gt;
  &amp;lt;/p&amp;gt;
  &amp;lt;p class=&quot;date&quot;&amp;gt;
    &amp;lt;time itemprop=&quot;startDate&quot; datetime=&quot;2011-07-25&quot;&amp;gt;25th&amp;lt;/time&amp;gt;–
    &amp;lt;time itemprop=&quot;endDate&quot; datetime=&quot;2011-07-29&quot;&amp;gt;29th July 2011&amp;lt;/time&amp;gt;
  &amp;lt;/p&amp;gt;
  ...
&amp;lt;/li&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The vocabulary for the &lt;code&gt;&amp;lt;li&amp;gt;&lt;/code&gt; element defaults to &lt;code&gt;http://schema.org/&lt;/code&gt; based on the value of the &lt;code&gt;itemtype&lt;/code&gt;. The short-named properties and classes within that item are turned into URIs by pre-pending &lt;code&gt;http://schema.org/&lt;/code&gt; to their name. Similarly, the properties on the nested &lt;code&gt;http://schema.org/Place&lt;/code&gt; are pre-pended with &lt;code&gt;http://schema.org/Place/&lt;/code&gt;. The resulting RDF would be:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;@prefix s: &amp;lt;http://schema.org/&amp;gt;

&amp;lt;/2011/oscon/&amp;gt;
  a s:Event ,
    s:SocialEvent ,
    s:BusinessEvent ,
    s:EducationEvent ;
  s:url &amp;lt;http://lanyrd.com/2011/oscon/&amp;gt; ;
  s:name &quot;OSCON 2011&quot; ;
  s:location &amp;lt;/places/portland/&amp;gt; ;
  s:startDate &quot;2011-07-25&quot;^^xsd:date ;
  s:endDate &quot;2011-07-29&quot;^^xsd:date ;
  .

&amp;lt;/places/portland/&amp;gt;
  a s:Place ;
  s:url &amp;lt;http://lanyrd.com/places/portland/&amp;gt; ;
  s:name &quot;United States / Portland&quot; ;
  .
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Note: see below for how the values are created in this example.&lt;/p&gt;

&lt;p&gt;The JSON would be just the same as from a standard microdata processor; there&amp;#8217;s no mapping to URIs for that output:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{
  &quot;type&quot;: &quot;http://schema.org/Event&quot;,
  &quot;id&quot;: &quot;http://lanyrd.com/2011/oscon/&quot;,
  &quot;properties&quot;: {
    &quot;url&quot;: [
      &quot;http://lanyrd.com/2011/oscon/&quot;
    ],
    &quot;name&quot;: [
      &quot;OSCON 2011&quot;
    ],
    &quot;location&quot;: [
      {
        &quot;type&quot;: &quot;http://schema.org/Place&quot;,
        &quot;id&quot;: &quot;http://lanyrd.com/places/portland/&quot;,
        &quot;properties&quot;: {
          &quot;name&quot;: [
            &quot;United States / Portland&quot;
          ],
          &quot;url&quot;: [
            &quot;http://lanyrd.com/places/portland/&quot;
          ]
        }
      }
    ],
    &quot;startDate&quot;: [
      &quot;2011-07-25&quot;
    ],
    &quot;endDate&quot;: [
      &quot;2011-07-29&quot;
    ]
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;Adding Datatypes&lt;/h3&gt;

&lt;p&gt;How to manage datatypes in RDF generated from microdata is something where the best approach is not at all clear to me. A couple of years ago I talked about some &lt;a href=&quot;http://www.jenitennison.com/blog/node/120&quot;&gt;frustrations with RDF datatyping&lt;/a&gt;, and datatypes in RDF still frustrate me by being hard to use in sensible ways throughout the RDF toolchain. Nevertheless, it&amp;#8217;s what we have. &lt;/p&gt;

&lt;p&gt;The possibilities I can see for microdata+RDF are:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Use plain literals for everything, including URIs, equivalent to using strings as microdata does. This makes things simple for the publisher and keeps the markup in the page clean, but makes it difficult for consumers who are using RDF toolchains: they will &lt;em&gt;usually&lt;/em&gt; have to do some kind of processing of the RDF generated from microdata+RDF to add appropriate datatypes to the values. There are two issues with this approach:&lt;/p&gt;

&lt;ul&gt;&lt;li&gt;I have a feeling that microdata+RDF processors will make up their own rules to add datatypes to the data extracted from a page (using rules like those described below and/or sniffing of values and/or using information from known built-in vocabularies), in an effort to add value for their users. But if different processors do that in different ways, we have an interoperability problem.&lt;/li&gt;
&lt;li&gt;In some vocabularies, the datatype of a value is not derivable from the property. The most important/common example of this is &lt;a href=&quot;http://www.w3.org/TR/skos-reference/#notations&quot;&gt;&lt;code&gt;skos:notation&lt;/code&gt;&lt;/a&gt;, which uses values with different datatypes to supply different identifiers from different identification schemes for a given concept.&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Assign datatypes based on the element type in the HTML. If the property value has come from a URL attribute, assume that it&amp;#8217;s a resource rather than a literal; if the element is a &lt;code&gt;&amp;lt;time&amp;gt;&lt;/code&gt; element, work out the datatype based on the syntax of the &lt;code&gt;datetime&lt;/code&gt; attribute; otherwise assume it&amp;#8217;s a string and give it a language in the case that one is specified. This gives some information but leads to a somewhat strange situation where you can mark up something as a date/time but not as a number.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Supplement the processing described in 2. with some basic datatype sniffing. Basically, if the value looks like a number or a boolean value then assign it a numeric or boolean datatype based on its syntax. This could reuse the &lt;a href=&quot;http://www.w3.org/TeamSubmission/turtle/#literal&quot;&gt;rules for recognising different literals from Turtle&lt;/a&gt;. This wouldn&amp;#8217;t be perfect; in particular, it would guess that strings that consist purely of numbers such as zip codes were numbers. I&amp;#8217;m inclined not to go down this path.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Supplement the processing described in 2. with a &lt;code&gt;itemvaltype&lt;/code&gt; attribute that takes a token from the list of &lt;a href=&quot;http://www.w3.org/TR/xmlschema-2/#built-in-datatypes&quot;&gt;built-in XML Schema Datatypes&lt;/a&gt; or the token &amp;#8216;&lt;code&gt;literal&lt;/code&gt;&amp;#8217;. The &amp;#8216;&lt;code&gt;literal&lt;/code&gt;&amp;#8217; token would be used to override the normal processing of URL attributes in the case where those really should be literals rather than resources. In this design, it would be easy to create literals using one of the most usual datatypes, but not possible to use datatypes that are specific to a given vocabulary.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Supplement the processing described in 4. by allowing the &lt;code&gt;itemvaltype&lt;/code&gt; to take either a token or a URL. The thing I don&amp;#8217;t like about this design is that the token would be interpreted as being within the XML Schema Datatypes vocabulary rather than the vocabulary specified for &lt;code&gt;itemvocab&lt;/code&gt; (used for tokens in &lt;code&gt;itemprop&lt;/code&gt; and &lt;code&gt;itemclass&lt;/code&gt;). This seems like it might turn into a source of confusion, but if we went the other way and had &lt;code&gt;itemvaltype&lt;/code&gt; being interpreted based on &lt;code&gt;itemvocab&lt;/code&gt;, it would be harder to give a value the more common datatypes such as numbers and boolean values.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;My inclination, somewhat reluctantly as it&amp;#8217;s the most complex, would be to use the last of these, because it provides for decentralised extensibility of datatypes, and support for decentralised extensibility is the core aim of these extensions. In other words, have a &lt;code&gt;itemvaltype&lt;/code&gt; attribute that can hold either a token, which must be one of &lt;code&gt;literal&lt;/code&gt; or the local name of an XML Schema datatype, or a URL. On a &lt;code&gt;&amp;lt;time&amp;gt;&lt;/code&gt; element, this would default to the appropriate type based on the syntax of the value of the &lt;code&gt;datetime&lt;/code&gt; attribute.&lt;/p&gt;

&lt;p&gt;To be conformant, the &lt;code&gt;itemvaltype&lt;/code&gt; would have to be an allowed value type for the properties given in &lt;code&gt;itemprop&lt;/code&gt; and the value of the property must be a legal value for the datatype. (In keeping with the style of the microdata specification, the mechanisms for working out what value types are allowed and what the legal values are for non-XML Schema datatypes would be left undefined &amp;#8212; a consuming application would look at the definition of the vocabulary.)&lt;/p&gt;

&lt;p&gt;Within the DOM API, the &lt;code&gt;itemValType&lt;/code&gt; IDL attribute on HTML elements would reflect the &lt;code&gt;itemvaltype&lt;/code&gt; attribute. The value of &lt;code&gt;itemvaltype&lt;/code&gt; &lt;em&gt;wouldn&amp;#8217;t&lt;/em&gt; change the types of the values returned by &lt;code&gt;element.itemValue&lt;/code&gt; or in the JSON mapping from microdata; it would purely be used when generating RDF from that data.&lt;/p&gt;

&lt;p&gt;For example, if someone started with some markup like:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div itemscope itemtype=&quot;http://schema.org/AggregateOffer&quot;&amp;gt;
  Priced from: &amp;lt;span itemprop=&quot;lowPrice&quot;&amp;gt;$35&amp;lt;/span&amp;gt;
  &amp;lt;span itemprop=&quot;offerCount&quot;&amp;gt;1938&amp;lt;/span&amp;gt; tickets left
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;it might be supplemented with some type information like:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div itemscope itemtype=&quot;http://schema.org/AggregateOffer&quot;&amp;gt;
  Priced from: &amp;lt;span itemprop=&quot;lowPrice&quot; itemvaltype=&quot;http://schema.org/Price&quot;&amp;gt;$35&amp;lt;/span&amp;gt;
  &amp;lt;span itemprop=&quot;offerCount&quot; itemvaltype=&quot;integer&quot;&amp;gt;1938&amp;lt;/span&amp;gt; tickets left
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;which would generate RDF like:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;@prefix s: &amp;lt;http://schema.org/&amp;gt;

[] a s:AggregateOffer ;
  s:lowPrice &quot;$35&quot;^^s:Price ;
  s:offerCount 1938 ;
  .
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;(Note: Here I&amp;#8217;m assuming that schema.org defines a &lt;code&gt;http://schema.org/Price&lt;/code&gt; datatype which includes a currency and a number. They don&amp;#8217;t currently.)&lt;/p&gt;

&lt;p&gt;The JSON would still be:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;{
  &quot;type&quot;: &quot;http://schema.org/AggregateOffer&quot;,
  &quot;properties&quot;: {
    &quot;lowPrice&quot;: [
      &quot;$35&quot;
    ],
    &quot;offerCount&quot;: [
      &quot;1938&quot;
    ]
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;Non-Additions&lt;/h3&gt;

&lt;p&gt;When I wrote a couple of years ago about &lt;a href=&quot;http://www.jenitennison.com/blog/node/103&quot;&gt;what microdata can&amp;#8217;t do&lt;/a&gt;, one of the things that I identified was not being able to express XML Literals. Having thought about this more, what&amp;#8217;s actually missing isn&amp;#8217;t to do with RDF, but is the ability to use the &lt;a href=&quot;http://www.whatwg.org/specs/web-apps/current-work/multipage/content-models.html#innerhtml&quot;&gt;&lt;code&gt;innerHTML&lt;/code&gt;&lt;/a&gt; of an element to provide a value for a property rather than its &lt;a href=&quot;http://www.whatwg.org/specs/web-apps/current-work/multipage/infrastructure.html#textcontent&quot;&gt;&lt;code&gt;textContent&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;For example, the description of an event might run over several paragraphs, or even in a single paragraph include other markup such as emphasised text, ruby markup, or links to additional information. People who are working from the DOM API can capture this information when they need it by getting the &lt;code&gt;innerHTML&lt;/code&gt; of the element rather than its &lt;code&gt;itemValue&lt;/code&gt;, but in the JSON mapping, the value is always the &lt;code&gt;itemValue&lt;/code&gt; &amp;#8212; the text content of the element.&lt;/p&gt;

&lt;p&gt;So this is a general microdata simplifying limitation. I&amp;#8217;d argue that we shouldn&amp;#8217;t add any special handling to plug this hole at the microdata+RDF level. If it turns out that having values that contain markup is useful then it will be added to microdata, and the microdata+RDF mapping would then be extended to create &lt;code&gt;rdf:XMLLiteral&lt;/code&gt;s or HTML literals (for which there is no defined datatype in RDF at the moment) for such values.&lt;/p&gt;

&lt;p&gt;Similarly, I haven&amp;#8217;t said anything in this post about providing machine-readable values to override the text content of an element. There is &lt;a href=&quot;http://www.w3.org/Bugs/Public/show_bug.cgi?id=13240&quot;&gt;an open bug&lt;/a&gt; about whether and how that capability might be added to HTML/microdata. I happen to think that it&amp;#8217;s useful, but that utility isn&amp;#8217;t limited to RDF processing. Whichever route is chosen there, I think it&amp;#8217;s important to keep the property values used by basic microdata and microdata+RDF aligned.&lt;/p&gt;

&lt;h2&gt;Summary&lt;/h2&gt;

&lt;p&gt;To summarise, one direction that we could take in aligning microdata and RDFa would be to define an extension to microdata to add support for decentralised extensibility and the RDF data model. I think that would entail adding attributes such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;itemclass&lt;/code&gt; to make it easy to define multiple types for an item&lt;/li&gt;
&lt;li&gt;&lt;code&gt;itemvocab&lt;/code&gt; and some default processing to provide nice mappings for short-name properties into URIs&lt;/li&gt;
&lt;li&gt;&lt;code&gt;itemvaltype&lt;/code&gt; and some default processing to assign datatypes to values&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For publishers and consumers, a single language with optional extensions greatly simplifies the use of embedded data. Property names don&amp;#8217;t have to be repeated or balancing acts made between different processing models.&lt;/p&gt;

&lt;p&gt;RDFa proponents get a syntax that can be used to generate a natural RDF model against which they can build RDF-oriented APIs and map to other formats such as JSON-LD.&lt;/p&gt;

&lt;p&gt;For microdata proponents, this approach doesn&amp;#8217;t pollute microdata with requirements that they see as superfluous, and doesn&amp;#8217;t change the behaviour of core microdata processors. Browsers, search engines and other consumers can continue to use the JSON output and only those who really want to support RDF need to do so.&lt;/p&gt;

&lt;p&gt;I&amp;#8217;m sure that there are things that I&amp;#8217;ve missed in my outline above, issues that I haven&amp;#8217;t thought of. But if there is to be any kind of convergence between microdata/RDFa, this layered approach seems to me to be the kind of convergence that is most likely to eventually result in one language for embedding data in HTML rather than two or three.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note: if you prefer to comment on Google+, please add your comment to &lt;a href=&quot;https://plus.google.com/u/0/112095156983892490612/posts/aUqGQSLzDPv&quot;&gt;my announcement post there&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;
</description>
 <comments>http://www.jenitennison.com/blog/node/162#comments</comments>
 <category domain="http://www.jenitennison.com/blog/taxonomy/term/71">microdata</category>
 <category domain="http://www.jenitennison.com/blog/taxonomy/term/31">rdf</category>
 <category domain="http://www.jenitennison.com/blog/taxonomy/term/42">rdfa</category>
 <pubDate>Sun, 31 Jul 2011 19:55:44 +0000</pubDate>
 <dc:creator>Jeni</dc:creator>
 <guid isPermaLink="false">162 at http://www.jenitennison.com/blog</guid>
</item>
<item>
 <title>My Experience of Web Standards</title>
 <link>http://www.jenitennison.com/blog/node/160</link>
 <description>&lt;p&gt;One of the things that&amp;#8217;s been niggling at the back of my mind since the &lt;a href=&quot;http://schema.org&quot;&gt;schema.org&lt;/a&gt; announcement is how small a role search engine results plays in the wider data sharing efforts that I&amp;#8217;m more familiar with in my work on &lt;a href=&quot;http://www.legislation.gov.uk/&quot;&gt;legislation.gov.uk&lt;/a&gt;, and more generally how my day job experience differs from (what seem to be) more common experiences of development on the web. In this post, I&amp;#8217;m going to talk about that experience, and about the particular problems that I see with the coexistence of microdata and RDFa as a result.&lt;/p&gt;

&lt;!--break--&gt;

&lt;p&gt;My day job (the one I actually get paid for) is web development. The site I spend most of my time and effort on is &lt;a href=&quot;http://www.legislation.gov.uk/&quot;&gt;legislation.gov.uk&lt;/a&gt;. This deals with complex content (UK legislation) that has to be presented in multiple formats (users love PDFs of legislation). Our aim is to make the data as reusable as possible by third parties through good, RESTful, web architecture, and we want to use open standards and open source technologies as part of the &lt;a href=&quot;http://www.cabinetoffice.gov.uk/resource-library/open-source-open-standards-and-re-use-government-action-plan&quot;&gt;UK government&amp;#8217;s general strategy&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;legislation.gov.uk is not a global website like Amazon or eBay, but it&amp;#8217;s not small either: it covers 60,000 changing items of legislation, providing point-in-time views for many of them, and with more added every day. It&amp;#8217;s one of the top ten most used UK Government websites, with 2 million visits (about 10-12 million page views) each month and typically about 120 requests/second during the active times of the day. Legislation might sound like a highly specialist interest, but if you &lt;a href=&quot;http://twitter.com/search/legislation.gov.uk&quot;&gt;search for legislation.gov.uk on Twitter&lt;/a&gt; you&amp;#8217;ll see it being referenced over and over by people who want to share what the law says.&lt;/p&gt;

&lt;p&gt;I do not by any means claim that my experience is representative of the wider web. I know that there are large numbers of sites that deal only in data, not documents, and certainly not documents with the kind of rich semantic structure that legislation has. I offer the following discussion as a data point, partly because I can&amp;#8217;t quite believe that legislation.gov.uk is &lt;em&gt;completely&lt;/em&gt; unique in its requirements and partly because obviously my perspective on a bunch of issues arises from this experience.&lt;/p&gt;

&lt;h2&gt;Technology Stacks&lt;/h2&gt;

&lt;p&gt;Legislation items are complex, semi-structured documents. Their natural fit is XML (well, that&amp;#8217;s not quite true &amp;#8212; their natural fit would be something that allowed overlapping markup &amp;#8212; but XML is the closest that we have). So we store it in XML in a native XML database and we use an XML toolset to query it (XQuery) and transform it (XSLT) into various formats including rendering it as PDF (through XSL-FO).&lt;/p&gt;

&lt;p&gt;Our next step for the development of the site involves looking at legislative effects. These form a graph: one item of legislation affects other items of legislation which may in turn affect other items and so on. There are all sorts of other links between items of legislation in terms of commencements, conferred powers and so on. Particularly because we already have well-thought-through URIs for legislation, the natural fit is to use RDF to represent this graph. We already offer a SPARQL endpoint for accessing some aspects of our data, but we expect to expand and develop this over the next few months and to use it as a layer under the website and exposed for reusers, in much the same way as we use the XML database.&lt;/p&gt;

&lt;p&gt;As a government site, we have fairly strict limits on what we can do within our web pages: we have to make sure that they&amp;#8217;re accessible by everyone who wants to view them. We aren&amp;#8217;t able to use technologies that are only available in the latest browsers, but that&amp;#8217;s OK because with the kind of content we deal with, we don&amp;#8217;t have to do anything fancy anyway. So we use pretty basic HTML and CSS and Javascript, because that&amp;#8217;s how you deliver content to end-users on the web (as well as exposing the underlying XML and RDF, to enable others to reuse the data).&lt;/p&gt;

&lt;p&gt;In other words, we use three web stacks for delivering legislation.gov.uk:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;the XML stack, which is great for single-source publishing of documents that have more semantic structures than those supported by HTML&lt;/li&gt;
&lt;li&gt;the RDF stack, which is well-suited for metadata about things that are identified by URIs&lt;/li&gt;
&lt;li&gt;the HTML stack, which is absolutely necessary for delivering human-accessible content on the web&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;What bemuses me, because of this experience, is that sometimes it appears that the narrative around these technologies is framed in terms of an exclusive choice between them. For example, &lt;a href=&quot;http://twitter.com/mattur/status/89331716430372864&quot;&gt;@mattur asked&lt;/a&gt;:&lt;/p&gt;

&lt;p style=&quot;text-align:center;&quot;&gt;
  &lt;a href=&quot;http://twitter.com/mattur/status/89331716430372864&quot;&gt;&lt;img src=&quot;/blog/files/mattur-tweet.jpg&quot; alt=&quot;@gimsieke @JeniT how may TAG members believe RDF(a) and X(HT)ML are way forward? How many think they aren&#039;t?&quot; /&gt;&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;It is as if, if you use XML you &lt;em&gt;cannot&lt;/em&gt; appreciate the utility of error-handling in HTML; or if you use RDF you &lt;em&gt;cannot&lt;/em&gt; understand the need to represent documents in XML; or if you want to utilise HTML fully, you &lt;em&gt;cannot&lt;/em&gt; adopt RDF&amp;#8217;s view of data on the web. That&amp;#8217;s simply not my experience. They each have their role on the web; supporting the use of one does not necessitate rejecting the use of the others.&lt;/p&gt;

&lt;p&gt;It&amp;#8217;s interesting that some of the standards that are most reviled are those that arise at the intersections, where it appears that one technology is trying to encroach on the space of another:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;XHTML at the border of XML and HTML&lt;/li&gt;
&lt;li&gt;RDF/XML at the border of RDF and XML&lt;/li&gt;
&lt;li&gt;RDFa at the border of all three&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;At the same time, within legislation.gov.uk, we publish XHTML (because it&amp;#8217;s the natural output from an XML toolchain) and create and process RDF/XML (because it gives us access to that data from within the XML toolchain). We use a small bit of RDFa in the XHTML to indicate the rights under which our information is avaialble, and don&amp;#8217;t yet, but are thinking about using RDFa to mark up non-document semantics within our XML (to enable the XML markup to focus on the document structures that it&amp;#8217;s good at). For all their imperfections, these intersection technologies are useful for managing cross-overs; the problems arise when they overstep their remit and people start to think that &lt;em&gt;all&lt;/em&gt; HTML must be XHTML or &lt;em&gt;all&lt;/em&gt; XML must be RDF/XML or &lt;em&gt;all&lt;/em&gt; RDF must be RDFa.&lt;/p&gt;

&lt;h2&gt;Sharing Scenarios&lt;/h2&gt;

&lt;p&gt;The second thing that I wanted to explore is the experience from legislation.gov.uk of what it&amp;#8217;s like to be a publisher who actively wants to share their data. We need to operate simultaneously at three levels in our data sharing efforts.&lt;/p&gt;

&lt;h3&gt;Large-Scale Consumer-Driven Data Sharing&lt;/h3&gt;

&lt;p&gt;The first target for our data sharing efforts are the search engines. Obviously we&amp;#8217;re not selling anything, but we want people to be able to locate legislation easily when they want it, and we want people who have done the search to be able to see some information about the legislation so that they know that they&amp;#8217;ve located the right item.&lt;/p&gt;

&lt;p&gt;This is large-scale consumer (search engine) driven data sharing, typified by schema.org and Facebook&amp;#8217;s &lt;a href=&quot;http://developers.facebook.com/docs/opengraph/&quot;&gt;Open Graph Protocol&lt;/a&gt; (OGP). There are a few very big data consumers (Google, Microsoft, Yahoo!, Facebook etc) who need to consume data from large numbers of data providers. These consumers obviously can&amp;#8217;t understand &lt;em&gt;everything&lt;/em&gt;, so they determine and document what syntaxes and vocabularies they &lt;em&gt;do&lt;/em&gt; understand and expect publishers to follow.&lt;/p&gt;

&lt;p&gt;The benefits that publishers get from a particular consumer determines which syntax/vocabulary they use; publishers who are particularly keen to show up prettily within search results will target schema.org whereas those who want to be sharable within Facebook will target OGP. Many publishers will want to target both. There is probably a driver towards eventual convergence:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;publishers might push back about inserting two lots of very similar data in their pages&lt;/li&gt;
&lt;li&gt;consumers might want to include data from publishers who haven&amp;#8217;t specifically targeted them&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;although there&amp;#8217;s likely to be a period where they coexist, much as there was for VHS and Betamax (and &lt;a href=&quot;http://en.wikipedia.org/wiki/Video_2000&quot;&gt;V2000&lt;/a&gt;, I know, dad) during the early days of video players.&lt;/p&gt;

&lt;p&gt;As &lt;a href=&quot;http://www.jenitennison.com/blog/node/157&quot;&gt;I discussed previously&lt;/a&gt;, these large-scale consumers will be driven by the data that they find in the wild, in all its messy variety. They get relatively little benefit directly from using a generic &lt;em&gt;syntax&lt;/em&gt;, as they are really interested in only a few, pretty generic, &lt;em&gt;vocabularies&lt;/em&gt; for which they have hardwired processing. Indirectly, adopting a generic syntax has benefits in that publishers might find it easier to find tools that enable them to generate it, tutorials about how to use it, and feel that they aren&amp;#8217;t being quite as locked in to something proprietary. However, rejecting data that isn&amp;#8217;t marked up properly using that syntax has no benefit for consumers except in so far as it makes them feel that they are being good community members. &lt;/p&gt;

&lt;p&gt;This is the pattern we see with schema.org (which accepts microdata but, based on its documentation, won&amp;#8217;t reject data that isn&amp;#8217;t fully compliant with it) and with OGP (which accepts a subset of RDFa but doesn&amp;#8217;t reject data that hasn&amp;#8217;t got prefixes properly bound, for example).&lt;/p&gt;

&lt;p&gt;Another point to mention is that there is very little trust in this scenario. The communication between consumers and publishers is very limited, and the consumers will want to protect themselves against accidental or malicious errors that are evident in mismatches between explicit metadata and that which is parsed from the visible content of the page.&lt;/p&gt;

&lt;p&gt;The parallels to HTML and browser vendors are very strong in this type of data sharing.&lt;/p&gt;

&lt;h3&gt;Small-Scale Consumer-Driven Data Sharing&lt;/h3&gt;

&lt;p&gt;A second type of data sharing is again driven by consumers, but this time at a lot smaller and more specialised scale. For legislation.gov.uk, these are services such as &lt;a href=&quot;http://www.glin.gov/&quot;&gt;GLIN&lt;/a&gt;, which is a global legislation registry. Other examples are the recent work that we&amp;#8217;ve done to publish &lt;a href=&quot;http://data.gov.uk/organogram&quot;&gt;UK Government organograms&lt;/a&gt; or &lt;a href=&quot;http://countculture.wordpress.com/&quot;&gt;Chris Taggart&lt;/a&gt;&amp;#8217;s &lt;a href=&quot;http://openelectiondata.org/&quot;&gt;Open Election Data&lt;/a&gt; project. In these cases, there&amp;#8217;s a single, relatively small and specialised consumer and a small number of publishers which are closely coordinated together.&lt;/p&gt;

&lt;p&gt;As in the large-scale case, the consumer ultimately determines the syntax/vocabulary that it recognises, and communicates that to the publishers. However, small-scale consumers typically have close coordination with the publishers, which has a number of side-effects:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;consumers may be more able to both apply pressure to and help publishers to do well in their markup&lt;/li&gt;
&lt;li&gt;publishers have the opportunity to feed back directly to the consumer any suggestions that they have about changes to the syntax/vocabulary&lt;/li&gt;
&lt;li&gt;publishers are likely to gain an immediate and tangible benefit from their cooperation, such as visualisations of their data that they otherwise wouldn&amp;#8217;t have seen&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Another noteworthy point about small-scale consumers is that they&amp;#8217;re unlikely to have the engineering capability to create a custom parser for a particular syntax, but will instead want to use something off-the-shelf to extract data from pages and into their own backend systems. This, coupled with the closer coordination with publishers, means that they&amp;#8217;re much more likely to stick to a specification, assuming that the off-the-shelf tools do.&lt;/p&gt;

&lt;h3&gt;Publisher-Driven Data Sharing&lt;/h3&gt;

&lt;p&gt;The final type of data sharing is driven by publishers. At legislation.gov.uk, we&amp;#8217;re motivated to make our data available for reuse for transparency/accountability reasons (to help citizens understand the law), efficiency reasons (to help parliament and government departments to publish new legislation better) and economic reasons (to foster innovation in legal publishing). We don&amp;#8217;t have any individual consumers in mind when we publish our data, but have found that simply by publishing it well, we foster reuse.&lt;/p&gt;

&lt;p&gt;In this case, we as publishers are highly motivated to ensure that the data we publish is easily parsed with something off-the-shelf, since that lowers the barrier for potential consumers. Publishers like us are very likely to have unique, specialised, content and need to use a vocabulary that fits closely to our internal data structures as this lowers implementation cost. Consumers can also trust publishers like us: we simply have no motivation to lie in the data that we provide for reuse.&lt;/p&gt;

&lt;h2&gt;Mixed Markup&lt;/h2&gt;

&lt;p&gt;As I&amp;#8217;ve outlined above, publishers like legislation.gov.uk need to target several potential consumers at the same time:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;large-scale consumers such as search engines&lt;/li&gt;
&lt;li&gt;small-scale consumers that provide us with a useful service&lt;/li&gt;
&lt;li&gt;specialist consumers that are interested specifically in our data&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We cannot use a single vocabulary for all these different purposes. (Well, we could write our own vocabulary and describe mappings to other vocabularies using RDFS, but search engines wouldn&amp;#8217;t read it.)&lt;/p&gt;

&lt;p&gt;We must therefore use a mix of vocabularies:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;generic vocabularies about things that search engines care about&lt;/li&gt;
&lt;li&gt;specialised vocabularies for particular small consumers&lt;/li&gt;
&lt;li&gt;site-specific vocabularies for sharing our unique data&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It&amp;#8217;s repetitive, but it&amp;#8217;s manageable so long as we have a syntax that enables us to say that an item of legislation is a &lt;code&gt;http://scheme.org/CreativeWork&lt;/code&gt; and a &lt;code&gt;http://purl.org/dc/dcmitype/Text&lt;/code&gt; and a &lt;code&gt;http://www.legislation.gov.uk/def/legislation/Legislation&lt;/code&gt; and allows us to give multiple properties the same value.&lt;/p&gt;

&lt;p&gt;The way things are going at the moment, we might well end up having to use multiple &lt;em&gt;syntaxes&lt;/em&gt; on the same page, as some consumers understand microdata, others consume RDFa, and still others will parse microformats. This leads to more repetition: adding &lt;code&gt;itemprop&lt;/code&gt; for microdata, &lt;code&gt;property&lt;/code&gt; for RDFa and specialised &lt;code&gt;class&lt;/code&gt; attributes for microformats. But worse (much worse), each of the syntaxes uses a different parsing model to create an entity-property-value structure, so not only do we have to learn substantially different markup patterns but our pages quickly become some kind of hideous polyglot mess trying to balance between them.&lt;/p&gt;

&lt;h2&gt;Looking Forward&lt;/h2&gt;

&lt;p&gt;As I said at the start, I&amp;#8217;m fairly sure that my experience at legislation.gov.uk isn&amp;#8217;t representative of the wider web, but I don&amp;#8217;t have a clear idea about just how unrepresentative it is, in terms of technology use or motivations around data sharing. When I read my twitter stream or blogs, there&amp;#8217;s a massive sampling bias, both in terms of who I follow and what I read, but also about who talks about what they&amp;#8217;re doing. (I&amp;#8217;m reminded of &lt;a href=&quot;http://www.codinghorror.com/blog/&quot;&gt;Jeff Atwood&lt;/a&gt;&amp;#8217;s post on the &lt;a href=&quot;http://www.codinghorror.com/blog/2007/11/the-two-types-of-programmers.html&quot;&gt;Two Types of Programmers&lt;/a&gt;: the vast majority of web developers don&amp;#8217;t make a noise about what they do.)&lt;/p&gt;

&lt;p&gt;Taking part in web standardisation today often feels like being part on an ongoing cold war between distinct camps rather than a community working towards common aims. The underlying question seems to be &amp;#8220;who&amp;#8217;s side are you on?&amp;#8221; Every decision and activity is cast as a victory or defeat. Time is wasted on attack and defence, or on raking over past slights and stupidities, rather than on progress. Valid criticism from outside a group cannot be listened to for fear of giving ground, cannot be made within a group where it seems like betrayal.&lt;/p&gt;

&lt;p&gt;It is the &lt;a href=&quot;http://en.wikipedia.org/wiki/Realistic_conflict_theory#The_Robbers_Cave_Experiment&quot;&gt;Robbers Cave Experiment&lt;/a&gt; played out in web standards. As a psychologist, I find it fascinating. As a developer, and particularly one who doesn&amp;#8217;t self-identify with any single group, it is frustrating. As a TAG member, trying to work for the longer-term good of the web, it is worrying, because situations of intergroup conflict lead to &lt;a href=&quot;http://en.wikipedia.org/wiki/Groupthink&quot;&gt;groupthink&lt;/a&gt; and non-optimal solutions.&lt;/p&gt;

&lt;p&gt;As I described above, a non-optimal outcome seems to be the most likely result of the particular microdata vs RDFa conflict for us at legislation.gov.uk. While I know we are not generally representative, I believe that it will be similarly bad for other developers: publishers, consumers and tool implementers.&lt;/p&gt;

&lt;p&gt;This is a problem for all who want to foster data sharing on the web using open standards; it is not one that any one group can fix on their own. It&amp;#8217;s my hope that a balanced task force of individuals with a variety of experience and backgrounds can provide a focus for us all to work together to solve it. If we can&amp;#8217;t, then we have let our prejudice and bias overcome our judgement.&lt;/p&gt;
</description>
 <comments>http://www.jenitennison.com/blog/node/160#comments</comments>
 <category domain="http://www.jenitennison.com/blog/taxonomy/term/14">xml</category>
 <category domain="http://www.jenitennison.com/blog/taxonomy/term/44">html5</category>
 <category domain="http://www.jenitennison.com/blog/taxonomy/term/71">microdata</category>
 <category domain="http://www.jenitennison.com/blog/taxonomy/term/31">rdf</category>
 <category domain="http://www.jenitennison.com/blog/taxonomy/term/42">rdfa</category>
 <pubDate>Sun, 24 Jul 2011 16:24:00 +0000</pubDate>
 <dc:creator>Jeni</dc:creator>
 <guid isPermaLink="false">160 at http://www.jenitennison.com/blog</guid>
</item>
<item>
 <title>TAG F2F, June 2011</title>
 <link>http://www.jenitennison.com/blog/node/158</link>
 <description>&lt;p&gt;As you may know, I accepted an appointment to the &lt;a href=&quot;http://www.w3.org/2001/tag/&quot;&gt;W3C&amp;#8217;s Technical Architecture Group&lt;/a&gt; earlier this year. Last week was the first face-to-face meeting that I attended, hosted in the &lt;a href=&quot;http://en.wikipedia.org/wiki/Ray_and_Maria_Stata_Center&quot;&gt;Stata Center&lt;/a&gt; at MIT. As you can tell from the &lt;a href=&quot;http://www.w3.org/2001/tag/2011/06/06-agenda&quot;&gt;agenda&lt;/a&gt; (which was in fact revised as we went along) it was a packed three days.&lt;/p&gt;

&lt;p&gt;What I intend to do here is to briefly report on the major areas that we discussed and give a tiny bit of my own personal take on them. In no way should any of what I write here be judged as revealing the official opinion of the TAG, it&amp;#8217;s just me saying what I think, and I&amp;#8217;m not going to go into anything in depth because they&amp;#8217;re all incredibly gnarly and contentious topics and I&amp;#8217;d not only be here all year but also end up in a tar pit.&lt;/p&gt;

&lt;!--break--&gt;

&lt;h2&gt;Role of the TAG&lt;/h2&gt;

&lt;p&gt;Usefully for me as a newcomer, our first session was about the ongoing role of the TAG. The TAG occupies a unique position within the W3C. According to its &lt;a href=&quot;http://www.w3.org/2004/10/27-tag-charter.html&quot;&gt;charter&lt;/a&gt; it was set up&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;To improve the effectiveness of Working Groups, to reduce misunderstandings and overlapping work, and to improve the consistency of Web technologies developed inside and outside W3C&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The TAG ultimately has three routes to do this:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;by providing specific advice on issues that are brought to its attention&lt;/li&gt;
&lt;li&gt;by writing documents on basic web architecture principles that go through community review, particularly through the general review of the W3C standards track and become Recommendations&lt;/li&gt;
&lt;li&gt;by advising the W3C Director (Tim Berners-Lee) about what he should do on the extremely rare occasions when there are issues that he is supposed to adjudicate on&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In none of these cases is there anything that binds the people receiving the advice of the TAG, or reading Findings or Recommendations made by the TAG, to accept them or do anything about them. The power and authority of the TAG depends solely on the quality and utility of its arguments, which is how it should be in my opinion.&lt;/p&gt;

&lt;h2&gt;Client-Side Application State&lt;/h2&gt;

&lt;p&gt;The first technical session was about &lt;a href=&quot;http://www.w3.org/2001/tag/2011/06/06-agenda#clientState&quot;&gt;client-side application state&lt;/a&gt; and was a review of the &lt;a href=&quot;http://www.w3.org/2001/tag/doc/IdentifyingApplicationState-20110515.html&quot;&gt;Identifying Application State draft&lt;/a&gt; that &lt;a href=&quot;http://en.wikipedia.org/wiki/T._V._Raman&quot;&gt;T.V. Raman&lt;/a&gt; began before he left the TAG and that &lt;a href=&quot;http://www.linkedin.com/pub/ashok-malhotra/4/675/6a2&quot;&gt;Ashok Malhotra&lt;/a&gt; has been working on since. This should in the next few months or so be published as a TAG Finding (though it is currently on the Recommendation track).&lt;/p&gt;

&lt;p&gt;This work is essentially about documenting the different ways in which you can identify application state within a URI, why that&amp;#8217;s a useful thing to do, and some of the pitfalls of using &lt;a href=&quot;http://www.jenitennison.com/blog/node/154&quot;&gt;hash URIs&lt;/a&gt; to do so. Most of the discussion was about details to do with wording within the document. One thing I thought particularly interesting was the point that URI-based application state is relevant in all &amp;#8216;active content&amp;#8217;, not just in HTML; for example, scripting in SVG or in PDFs bring the same considerations.&lt;/p&gt;

&lt;h2&gt;Buffer Bloat&lt;/h2&gt;

&lt;p&gt;Over lunch on Monday we listened to and discussed a presentation by &lt;a href=&quot;http://en.wikipedia.org/wiki/Jim_Gettys&quot;&gt;Jim Gettys&lt;/a&gt; on &lt;a href=&quot;http://www.w3.org/2001/tag/2011/06/06-agenda#bufferbloat&quot;&gt;buffer bloat&lt;/a&gt;. Basically (and all the errors here are introduced by me), TCP/IP is designed to route around network blockages, but it can only do so if it detects them quickly. When you have big buffers in place, as in the case of all modern operating systems and hardware, blockages aren&amp;#8217;t detected quickly; they&amp;#8217;re only detected when the buffers fill up. Then buffers empty and the data has to be sent again. The net result is that connections get really slow, not just for upload or download but for both, not just for you but for everyone using the network.&lt;/p&gt;

&lt;p&gt;Jim talked about how this is exacerbated by the large amount of web traffic and the design of HTTP, particularly the lack of use of HTTP pipelining (whereby several HTTP requests and responses are sent over one long-term connection), because it leads to lots of small messages which can&amp;#8217;t be handled effectively. There&amp;#8217;s lots more about this &lt;a href=&quot;http://gettys.wordpress.com/&quot;&gt;on his blog&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Jim also talked about the failure of certificate authorities and how we should be looking at distributed protocols using digitally signed data, pointing us in particular to &lt;a href=&quot;http://www.ccnx.org/&quot;&gt;CCNx&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;Fragment ID Semantics&lt;/h2&gt;

&lt;p&gt;First thing Tuesday was a session that I led on &lt;a href=&quot;http://www.w3.org/2001/tag/2011/06/06-agenda.html#mimefrag&quot;&gt;fragids&lt;/a&gt;, in particular the problems that are arising out of the mime type registration of +xml types (&lt;a href=&quot;http://www.w3.org/2006/02/son-of-3023/draft-murata-kohn-lilley-xml-04.html#frag&quot;&gt;3023bis&lt;/a&gt;) clashing with those that are used for, say, &lt;a href=&quot;http://www.w3.org/TR/2011/WD-media-frags-20110317/&quot;&gt;images&lt;/a&gt;, and what happens when these come together in something like SVG.&lt;/p&gt;

&lt;p&gt;The same issues arise whenever you have documents with types that &amp;#8216;inherit&amp;#8217; fragid semantics from two directions. For example, XHTML documents are XML documents, so constraints on +xml mean you shouldn&amp;#8217;t use interpreted fragids (eg hash-bangs) on them, but they are also &amp;#8216;active content&amp;#8217; which makes interpreted fragids useful. Similarly, in linked data you shouldn&amp;#8217;t really use a hash URI to mean a Person with a primary resource that provides as a response an XML document with embedded RDFa, because according to XML fragid semantics, such a URI should point to an XML element.&lt;/p&gt;

&lt;p&gt;Basically the use of fragids has grown markedly outside their original scope and these situations aren&amp;#8217;t really covered in the specs. I am now tasked to create a document that describes the issues and suggests ways forward. So that will be fun.&lt;/p&gt;

&lt;h2&gt;Telcon with IAB&lt;/h2&gt;

&lt;p&gt;The second session on Tuesday was a telcon with the &lt;a href=&quot;http://www.iab.org/&quot;&gt;IAB&lt;/a&gt; which has a similar role within the &lt;a href=&quot;http://www.ietf.org/&quot;&gt;IETF&lt;/a&gt; as the TAG does within the W3C. This was a bit of a &amp;#8216;getting to know you&amp;#8217; session, covering the work of the two groups on:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;versioning and extensibility&lt;/li&gt;
&lt;li&gt;security&lt;/li&gt;
&lt;li&gt;privacy, including Do Not Track&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;and talking about opportunities to meet and work together on various topics like these.&lt;/p&gt;

&lt;h2&gt;URI Definition Discovery and Metadata Architecture&lt;/h2&gt;

&lt;p&gt;The &lt;a href=&quot;http://www.w3.org/2001/tag/2011/06/06-agenda#metadata&quot;&gt;afternoon session on Tuesday&lt;/a&gt; was spent on &lt;a href=&quot;http://mumble.net/~jar/&quot;&gt;Jonathan Rees&amp;#8217;s&lt;/a&gt; work on the &lt;a href=&quot;http://www.w3.org/wiki/AwwswHome&quot;&gt;Architecture of the World Wide Semantic Web&lt;/a&gt;, which covers, amongst other things, what people in semantic web circles call &lt;a href=&quot;http://www.w3.org/wiki/HttpRange14Webography&quot;&gt;httpRange-14&lt;/a&gt;. At core, this is about the kinds of URIs we can use to refer to real-world things, what the response to HTTP requests on those URIs should be, and how we find out information about these resources.&lt;/p&gt;

&lt;p&gt;Jonathan has put together a document called &lt;a href=&quot;http://www.w3.org/2001/tag/awwsw/issue57/20110531/&quot;&gt;Providing and discovering definitions of URIs&lt;/a&gt; which covers the various ways that have been suggested over time, including the 303 method that was &lt;a href=&quot;http://lists.w3.org/Archives/Public/www-tag/2005Jun/0039&quot;&gt;recommended by the TAG in 2005&lt;/a&gt; and methods that have been suggested by various people since that time.&lt;/p&gt;

&lt;p&gt;It&amp;#8217;s clear that the 303 method has lots of practical shortcomings for people deploying linked data, and isn&amp;#8217;t the way in which URIs are commonly used by Facebook and schema.org, who don&amp;#8217;t currently care about using separate URIs for documents and the things those documents are about. We discussed these alongside concerns that we continue to support people who want to do things like describe the license or provenance of a document (as well as the facts that it contains) and don&amp;#8217;t introduce anything that is incompatible with the ways in which people who have been following recommended practice are publishing their linked data. The general mood was that we need to support some kind of &amp;#8216;punning&amp;#8217;, whereby a single URI could be used to refer to both a document and a real-world thing, with different properties being assigned to different &amp;#8216;views&amp;#8217; of that resource.&lt;/p&gt;

&lt;p&gt;Jonathan is going to continue to work on the draft, incorporating some other possible approaches. It&amp;#8217;s a &lt;a href=&quot;http://lists.w3.org/Archives/Public/public-lod/2011Jun/0186.html&quot;&gt;very contentious topic within the linked data community&lt;/a&gt;. My opinion is while we need to provide some &amp;#8216;good practice&amp;#8217; guides for linked data publishers, we can&amp;#8217;t just stick to a theoretical ideal that experience has shown not to be practical. What I&amp;#8217;d hope is that the TAG can help to pull together the various arguments for and against different options, and document whatever approach the wider community supports.&lt;/p&gt;

&lt;h2&gt;Can publication of hyperlinks cause copyright infringment?&lt;/h2&gt;

&lt;p&gt;The &lt;a href=&quot;http://www.w3.org/2001/tag/2011/06/06-agenda.html#linkcopyright&quot;&gt;first session on Wednesday&lt;/a&gt; was another session that I led, discussing the &lt;a href=&quot;http://www.w3.org/2001/tag/doc/publishingAndLinkingOnTheWeb-2011-05-28&quot;&gt;Publishing and Linking on the Web draft&lt;/a&gt; that &lt;a href=&quot;http://torgo.com/blog/&quot;&gt;Dan Appelquist&lt;/a&gt; and I have been working on.&lt;/p&gt;

&lt;p&gt;The aim of this document is to explain the tensions between terms that are commonly used in legal documents such as &amp;#8220;possession&amp;#8221;, &amp;#8220;adaptation&amp;#8221; and &amp;#8220;distribution&amp;#8221; and the way that publication works on the web, in which multiple servers may have copies of the same document (because they cache copies to make the &amp;#8216;net go faster), automated agents may make changes to those documents (such as compressing or resizing documents, or merging Javascript) and people may refer others to those documents through linking.&lt;/p&gt;

&lt;p&gt;We&amp;#8217;re particularly keen to argue that linking to something is not the same thing as distributing it. The web&amp;#8217;s power arises through its links, so it&amp;#8217;s important that people are able to link to something without being worried about what happens when/if the domain they link to is taken over by something illegal.&lt;/p&gt;

&lt;p&gt;Dan and I are going to continue to work on this document in response to various suggestions around organisation and terminology, with a view to getting some &amp;#8216;friendly legal experts&amp;#8217; to look it over and then seeking wider review. The intention is for it to eventually become a Recommendation as this will give greater weight to it as a document for a legal audience.&lt;/p&gt;

&lt;h2&gt;API Minimisation and Client-Side Storage&lt;/h2&gt;

&lt;p&gt;There were then a couple of short sessions.&lt;/p&gt;

&lt;p&gt;Dan talked about &lt;a href=&quot;http://www.w3.org/2001/tag/2011/06/06-agenda.html#apis&quot;&gt;API Minimisation&lt;/a&gt;, which is the design principle that to increase privacy we should design APIs that enable people requesting information to say exactly what information they need, and return only that rather that everything known about a think. Dan&amp;#8217;s put together an &lt;a href=&quot;http://www.w3.org/2001/tag/doc/APIMinimization-20100605.html&quot;&gt;draft&lt;/a&gt; and should be calling for review for it soon.&lt;/p&gt;

&lt;p&gt;Ashok then led discussion on &lt;a href=&quot;http://www.w3.org/2001/tag/2011/06/06-agenda.html#webAppStorage&quot;&gt;client-side storage&lt;/a&gt; and we brainstormed around some of the architectural/design issues about which we might want to write if we were to put together a document. This work is at a very early stage.&lt;/p&gt;

&lt;h2&gt;TAG Priorities&lt;/h2&gt;

&lt;p&gt;After lunch, we had a &lt;a href=&quot;http://www.w3.org/2001/tag/2011/06/06-agenda#priorities&quot;&gt;session on TAG priorities&lt;/a&gt; where we discussed which of the various pieces of work that we&amp;#8217;re doing should receive the most attention and had a quick review of who is doing what within the TAG.&lt;/p&gt;

&lt;p&gt;Our basic problem is that a lot of this stuff feels quite urgent, and we want to be responsive, but with only 5-6 of us &amp;#8220;actively involved&amp;#8221; (which means 1 day/week) in drafting documents, and other TAG duties taking up our time, it feels like we have taken on too much work. Our focus for the next little while is going to be on responding to issues where our lack of response might either hold people up or cause longer term problems (for example the publication of contradictory mime type definitions), which means things like the document on publishing and linking on the web will need to bubble in the background rather than being the focus of activity.&lt;/p&gt;

&lt;h2&gt;HTML5 Last Call&lt;/h2&gt;

&lt;p&gt;Our &lt;a href=&quot;http://www.w3.org/2001/tag/2011/06/06-agenda.html#htmlreview&quot;&gt;final session&lt;/a&gt;, for which we were joined by &lt;a href=&quot;http://www.w3.org/People/LeHegaret/&quot;&gt;Philippe Le Hégaret&lt;/a&gt;, was on the HTML5 Last Call documents. The TAG has raised various issues over the course of HTML5 development and want to follow up on how those issues have been addressed in the documents. Our role means that we&amp;#8217;re responsible for making sure there&amp;#8217;s consistency with other specifications, and that there isn&amp;#8217;t anything that seems like it&amp;#8217;s going to cause problems in the long term.&lt;/p&gt;

&lt;p&gt;The part that we spent most discussion time on was the relationship between &lt;a href=&quot;http://www.w3.org/TR/2011/WD-microdata-20110525/&quot;&gt;Microdata&lt;/a&gt; and &lt;a href=&quot;http://www.w3.org/TR/2011/WD-rdfa-in-html-20110525/&quot;&gt;RDFa&lt;/a&gt;. We talked about the precedents for having two specifications that do very similar things but with different approaches, such as CSS and XSL, and how this isn&amp;#8217;t necessarily a bad thing so long as they don&amp;#8217;t contradict each other and people can move between them easily (because they have the same conceptual foundations).&lt;/p&gt;

&lt;p&gt;I&amp;#8217;m going to save my opinion on this topic for another post. Suffice it to say that microdata and RDFa as currently specified don&amp;#8217;t work well with each other but it&amp;#8217;s not at all clear what the best path forward is. The TAG decided to recommend that the W3C set up a Task Force to look at what the best way forward might be.&lt;/p&gt;

&lt;h2&gt;Final Words&lt;/h2&gt;

&lt;p&gt;If you want links to the minutes of the TAG F2F, they&amp;#8217;re available within the agenda or on separate pages for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://www.w3.org/2001/tag/2011/06/06-minutes&quot;&gt;Monday 6th June&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.w3.org/2001/tag/2011/06/07-minutes&quot;&gt;Tuesday 7th June&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;http://www.w3.org/2001/tag/2011/06/08-minutes&quot;&gt;Wednesday 8th June&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you have anything to say on any of these topics, please send email to the &lt;a href=&quot;mailto:www-tag@w3.org&quot;&gt;TAG mailing list&lt;/a&gt;. Or you could comment here or &lt;a href=&quot;mailto:jeni@jenitennison.com&quot;&gt;email me directly&lt;/a&gt; if you like. Which leads me on to talking about what I&amp;#8217;d like to do in the TAG.&lt;/p&gt;

&lt;p&gt;One of the guidance notes for new members to the TAG says:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;TAG members are elected or appointed not to represent their individual member organizations, but the Web community as a whole. We try to take that responsibility very seriously.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I do take that responsibility seriously. Web architecture has to be a combination of practice and theory, balancing approaches that work right now with a desire to not break anything long term. I do practical work developing web applications with HTML, CSS, Javascript, XML, RDF, XSLT, XQuery and so on and so on every day, but I know I don&amp;#8217;t see all the difficult corners of the open web standard space: no one person can.&lt;/p&gt;

&lt;p&gt;I can listen though, so that&amp;#8217;s what I will try to do: listen, digest, reflect and act.&lt;/p&gt;

&lt;p&gt;But I have limited resources. Unlike most of the members of the TAG, I am not employed by a large organisation that pays me for time I take on the work that I do for the TAG. The W3C kindly paid for my flights to and from F2Fs, but not hotels or expenses. I wouldn&amp;#8217;t have taken this on if I wasn&amp;#8217;t prepared to shoulder the financial burden, but if there is anyone out there who might sponsor my participation, I&amp;#8217;d love to hear from you.&lt;/p&gt;
</description>
 <comments>http://www.jenitennison.com/blog/node/158#comments</comments>
 <category domain="http://www.jenitennison.com/blog/taxonomy/term/44">html5</category>
 <category domain="http://www.jenitennison.com/blog/taxonomy/term/46">linked data</category>
 <category domain="http://www.jenitennison.com/blog/taxonomy/term/71">microdata</category>
 <category domain="http://www.jenitennison.com/blog/taxonomy/term/42">rdfa</category>
 <category domain="http://www.jenitennison.com/blog/taxonomy/term/73">tag</category>
 <category domain="http://www.jenitennison.com/blog/taxonomy/term/69">uris</category>
 <category domain="http://www.jenitennison.com/blog/taxonomy/term/12">web</category>
 <pubDate>Fri, 17 Jun 2011 10:44:12 +0000</pubDate>
 <dc:creator>Jeni</dc:creator>
 <guid isPermaLink="false">158 at http://www.jenitennison.com/blog</guid>
</item>
<item>
 <title>The HTML5 DOM and RDFa</title>
 <link>http://www.jenitennison.com/blog/node/129</link>
 <description>&lt;p&gt;One of the fundamental disconnects between HTML5 and previous versions of HTML is the way in which you answer the question &amp;#8220;what is the structure of this page?&amp;#8221;. Things that make use of that structure, such as RDFa, need to take this into account.&lt;/p&gt;

&lt;p&gt;An example is the document:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;html&amp;gt;
  &amp;lt;head&amp;gt;&amp;lt;title&amp;gt;HTML example&amp;lt;/title&amp;gt;&amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;table&amp;gt;
      &amp;lt;span&amp;gt;Example title&amp;lt;/span&amp;gt;
      &amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Example table&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;
    &amp;lt;/table&amp;gt;
  &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;There are two different ways in which you might interpret the structure of this document. First, you might view the structure to be as it is written, with the &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt; element as a child of the &lt;code&gt;&amp;lt;table&amp;gt;&lt;/code&gt; element and therefore a tree that looks like:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;+- html
   +- head
   | +- title
   +- body
      +- table
         +- span
         +- tr
            +- td
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Second, you might view the structure of the page to be the DOM as it is constructed by an HTML5 processor, which will move the &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt; out from the table due to &lt;a href=&quot;http://dev.w3.org/html5/spec/Overview.html#foster-parenting&quot;&gt;foster parenting&lt;/a&gt;, giving the result:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;+- html
   +- head
   | +- title
   +- body
      +- span
      +- table
         +- tr
            +- td
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Which you view it as doesn&amp;#8217;t really matter at this point, but it does when you start to introduce markup that infers information based on the structure of the page, such as RDFa. Let me introduce some RDFa markup to the document:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;html xmlns:dc=&quot;http://purl.org/dc/elements/1.1/&quot;&amp;gt;
  &amp;lt;head&amp;gt;&amp;lt;title&amp;gt;HTML+RDFa example&amp;lt;/title&amp;gt;&amp;lt;/head&amp;gt;
  &amp;lt;body&amp;gt;
    &amp;lt;table about=&quot;http://example.com&quot;&amp;gt;
      &amp;lt;span property=&quot;dc:title&quot;&amp;gt;Example title&amp;lt;/span&amp;gt;
      &amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Example table&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;
    &amp;lt;/table&amp;gt;
  &amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now, if you view the structure to be as written, the &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt; element is within the &lt;code&gt;&amp;lt;table&amp;gt;&lt;/code&gt; element, and is therefore viewed as talking about whatever it is that the &lt;code&gt;&amp;lt;table&amp;gt;&lt;/code&gt; element is talking about, namely &lt;code&gt;http://example.com&lt;/code&gt;. So the RDF that you will glean from this page is:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;http://example.com&amp;gt; dc:title &quot;Example title&quot;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;On the other hand, if you view the structure to be that constructed by an HTML5 processor, the &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt; element is not within the &lt;code&gt;&amp;lt;table&amp;gt;&lt;/code&gt; element, and is therefore viewed as talking about whatever the document is talking about, namely the document itself. So the RDF that you will glean from the page is:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;&amp;gt; dc:title &quot;Example title&quot;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This isn&amp;#8217;t exactly a new problem. There has always been the possibility of Javascript embedded within a page changing the page by moving or inserting elements, making the page that a non-browser sees fundamentally different from the one that a browser sees. This has been used by SEO people and spam merchants to get search engines to direct people to pages which mutated into something different when they were actually visited by a browser. And this eventually lead to those people who cared about interpreting meaning from the structure of pages (ie search engines) to at least go some way towards evaluating the Javascript within the page in order to &amp;#8220;see&amp;#8221; the page as a human would.&lt;/p&gt;

&lt;p&gt;So it&amp;#8217;s not a new problem, but it&amp;#8217;s still a problem.&lt;/p&gt;

&lt;p&gt;For those people trying to define how RDFa is interpreted in HTML5, there are several unpleasant alternatives:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Define RDFa as operating over an HTML5 DOM. This would make things easy for Javascript implementations in as much as they can rely on being used with HTML5 DOMs, ie in HTML5 browsers. But it raises the implementation burden for other implementations, such as those based on XSLT or a simple tidy-then-interpret-as-XML approach: essentially every implementation will need to include an HTML5 parsing library.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Define RDFa as operating over a DOM, but leave the creation of that DOM as implementation-defined. This effectively passes the buck (&amp;#8220;it&amp;#8217;s not &lt;em&gt;our&lt;/em&gt; fault that HTML5 processors will construct a different DOM from XML processors&amp;#8221;) but makes it hard to test implementation conformance and for authors to know exactly how their page will be interpreted. For example, an implementation that constructed a DOM with randomly rearranged elements would be entirely conformant despite producing completely different triples from one that took the elements in the original order.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Define RDFa as operating over a serialisation, with precise wording that describes how that serialisation is mapped into a tree structure that is walked to process the RDFa within the page. This approach will prevent implementations that use other methods of constructing trees from being conformant; depending on how it&amp;#8217;s defined that might include XSLT implementations and/or Javascript implementations and/or implementations that use standard (XML-based) libraries for parsing the documents.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Personally I lean towards the second of these: defining RDFa as operating over a DOM but placing no constraints on how that DOM is created. It leaves open the possibility of Javascript implementations to work on the DOM they see, which may be radically different from the one seen by other processors due both to HTML5 reordering of elements and the dynamic modification of the page through Javascript. (Several people use rdfQuery to do before-and-after parsing of RDFa within a page, turning browsers into semantic editors, for example.) But it also lets conformant implementations be constructed in other ways for implementation ease or user needs, supporting the use of XSLT through GRDDL and the static crawling of content with minimal processing.&lt;/p&gt;

&lt;p&gt;Perhaps the set of permissible methods of DOM creation could be listed to prevent completely random processing, but I expect that it will be effectively limited through social and technological pressures. Implementations that build DOMs in random ways aren&amp;#8217;t going to be as useful (to their users) as those that build them in expected ways; it&amp;#8217;s also going to be far easier to implement RDFa processors using standard parsing libraries.&lt;/p&gt;

&lt;p&gt;The approach is not without its downsides, of course. XSLT is similarly defined as operating over a tree model, with the question of how that tree model is constructed left to the implementation. Most processors decided to construct the tree using standard XML parsing, but famously MSXML would strip certain whitespace-only text nodes from the tree (unless you specified a parsing flag telling it not to), leading to incompatibilities and user confusion.&lt;/p&gt;

&lt;p&gt;My guess is that the same kind of thing will happen with RDFa processors. It could very well be the case that an author will:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;check their RDFa in an RDFa validator that constructs a static HTML5 DOM, revealing one set of triples&lt;/li&gt;
&lt;li&gt;be confused when they then use a Javascript RDFa library within their page and get a slightly different set of triples because of some Javascript embedded in the page that changes its structure&lt;/li&gt;
&lt;li&gt;be further confused when a search engine that uses a tidy-and-interpret-as-XML approach gleans yet another slightly different set of triples and displays it in the search result&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So if this approach were chosen, I would expect wording in the specification that required implementations to state the method they used to create the DOM (ie it should be implementation-&lt;em&gt;defined&lt;/em&gt; rather than implementation-&lt;em&gt;dependent&lt;/em&gt;) and that warned authors of the most likely causes of differences between implementations (such as tree modifications performed by HTML5 processors and Javascript within the page). I&amp;#8217;d also like to see tools that take an HTML page and indicate the triples that it generates under different common DOM construction methods, so that authors can see the variation in how their documents might be interpreted.&lt;/p&gt;
</description>
 <comments>http://www.jenitennison.com/blog/node/129#comments</comments>
 <category domain="http://www.jenitennison.com/blog/taxonomy/term/44">html5</category>
 <category domain="http://www.jenitennison.com/blog/taxonomy/term/42">rdfa</category>
 <pubDate>Thu, 24 Sep 2009 08:05:03 +0000</pubDate>
 <dc:creator>Jeni</dc:creator>
 <guid isPermaLink="false">129 at http://www.jenitennison.com/blog</guid>
</item>
<item>
 <title>HTML5/RDFa Arguments</title>
 <link>http://www.jenitennison.com/blog/node/124</link>
 <description>&lt;p&gt;When I came back from holiday, I caught up with the recent &lt;a href=&quot;http://lists.w3.org/Archives/Public/public-rdf-in-xhtml-tf/2009Aug/thread.html&quot;&gt;discussions around RDFa and HTML5&lt;/a&gt;. It&amp;#8217;s exhausting reading so many posts repetitively reiterating the positions of people who all have the best of intentions but fundamentally different priorities. And such a shame that so much energy is spent on fruitless discussion when it could be spent at the very least improving specifications, if not testing, implementing, experimenting or otherwise in some very minor way changing the world.&lt;/p&gt;

&lt;!--break--&gt;

&lt;p&gt;The particular thread&amp;#8217;s subject was the use of prefixes, which are used to provide a shorthand for URIs, which are used to name properties such as &lt;code&gt;http://xmlns.com/foaf/0.1/firstName&lt;/code&gt;. It&amp;#8217;s unquestionable, really, that prefixes are a source of problems:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;with copy-and-paste, because it&amp;#8217;s easy to lose the bindings that are used to construct the full URI&lt;/li&gt;
&lt;li&gt;in general understandability, because people just don&amp;#8217;t get the idea that the prefix &lt;code&gt;foaf&lt;/code&gt; could be used for something other than &lt;code&gt;http://xmlns.com/foaf/0.1/&lt;/code&gt; or that &lt;code&gt;http://xmlns.com/foaf/0.1/&lt;/code&gt; might be bound to a prefix other than &lt;code&gt;foaf&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;when declared using namespace declarations, because of differences in interpretation between HTML and XHTML and for the general namespaces-in-content problems that we see in XML&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I think it&amp;#8217;s generally the case that the Semantic Web community, who are used to using syntaxes such as RDF/XML and Turtle which use prefixes all the time, judge these as being less disadvantageous than the members of the HTML5 community, who are much more in touch with and concerned about the &amp;#8220;common user&amp;#8221;.&lt;/p&gt;

&lt;p&gt;But underlying the arguments about the costs of prefixes are arguments about whether these disadvantages are important enough to stop&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;giving people shorthands for URIs and/or&lt;/li&gt;
&lt;li&gt;using URIs when naming properties and/or&lt;/li&gt;
&lt;li&gt;using RDF as the data model for data on the web&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Fundamentally, members of the Semantic Web (capital S, capital W) community take it as a matter of faith that the correct data model to use for expressing data about things both on and off the web is RDF. If there&amp;#8217;s anything that defines the Semantic Web community, it&amp;#8217;s that underlying assumption. (Well, probably: I&amp;#8217;m sure there are still some who hanker after Topic Maps.)&lt;/p&gt;

&lt;p&gt;Further, they think it is absolutely essential that if a property such as &amp;#8216;first name&amp;#8217; is used within a page, you can &lt;code&gt;GET&lt;/code&gt; a URI to find interesting information about the property. For example, with &lt;code&gt;http://xmlns.com/foaf/0.1/firstName&lt;/code&gt;, you will get&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;  &amp;lt;rdf:Property rdf:about=&quot;http://xmlns.com/foaf/0.1/firstName&quot; 
    vs:term_status=&quot;testing&quot; 
    rdfs:label=&quot;firstName&quot; 
    rdfs:comment=&quot;The first name of a person.&quot;&amp;gt;
    &amp;lt;rdf:type rdf:resource=&quot;http://www.w3.org/2002/07/owl#DatatypeProperty&quot;/&amp;gt;
    &amp;lt;rdfs:domain rdf:resource=&quot;http://xmlns.com/foaf/0.1/Person&quot;/&amp;gt;
    &amp;lt;rdfs:range rdf:resource=&quot;http://www.w3.org/2000/01/rdf-schema#Literal&quot;/&amp;gt;
    &amp;lt;rdfs:isDefinedBy rdf:resource=&quot;http://xmlns.com/foaf/0.1/&quot;/&amp;gt;
  &amp;lt;/rdf:Property&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;which among other things includes a human-readable label that you might use in a display of information about things that have the property, and a statement about the domain of the property, from which you can tell that anything that has a &lt;code&gt;http://xmlns.com/foaf/0.1/firstName&lt;/code&gt; property is a &lt;code&gt;http://xmlns.com/foaf/0.1/Person&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Given that you need URIs for properties, members of the Semantic Web community generally think that you need a way to shorten those URIs to make them palatable to people who might be embedding metadata in their pages. The cost of that is that you have to use prefixes, with the disadvantages that I&amp;#8217;ve outlined above, but it&amp;#8217;s a cost that&amp;#8217;s worth paying to gain resolvability and concision. And since it can be done in RDF/XML and Turtle and SPARQL and almost every other syntax in existence for expressing RDF, it seems unnatural not to be able to do it in the metadata embedded within webpages.&lt;/p&gt;

&lt;p&gt;At an equally fundamental level, members of the HTML5 community are unconvinced that RDF is a necessary or useful model to use for data. They do not see how it offers significant advantages over Javascript object structures, for example.&lt;/p&gt;

&lt;p&gt;Part of the reason for not being convinced of the utility of RDF is that members of the HTML5 community think it simply isn&amp;#8217;t important for properties to be named with resolvable URIs. After all, &lt;a href=&quot;http://microformats.org/&quot;&gt;microformats&lt;/a&gt; have illustrated that applications can derive meaning without having a machine-readable definition of the semantics of a property.&lt;/p&gt;

&lt;p&gt;I haven&amp;#8217;t heard them make these arguments, but they could also point out that there are vastly more mash-ups constructed with the developer having knowledge and understanding of the data that they are mashing up (and therefore requiring human-readable but not machine-readable definitions), than there are generic applications that could, or do, actually retrieve and reason with schemas or ontologies.&lt;/p&gt;

&lt;p&gt;Some within the HTML5 community even think it is &lt;em&gt;dangerous&lt;/em&gt; to use information from a property or class&amp;#8217;s URI, because if the metadata within an HTML page can only be accurately understood when coupled with information from an external document, applications that are built on being able to locate that external information are in real trouble if (when) that document disappears, either temporarily or permanently.&lt;/p&gt;

&lt;p&gt;For example, say that I have a page that contains the triple:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;http://www.jenitennison.com/#me&amp;gt; 
  &amp;lt;http://xmlns.com/foaf/0.1/firstName&amp;gt; &quot;Jenifer&quot;^^&amp;lt;http://www.w3.org/2001/XMLSchema#token&amp;gt; .
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;If it is the case that an application that resolves that triple also (a) retrieves the information available about the property and (b) reasons using it and any information derived from it, then having that triple in my page entails:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;http://www.jenitennison.com/#me&amp;gt; 
  a &amp;lt;http://xmlns.com/foaf/0.1/Person&amp;gt; ,
  a &amp;lt;http://xmlns.com/foaf/0.1/Agent&amp;gt; ,
  a &amp;lt;http://www.w3.org/2000/10/swap/pim/contact#Person&amp;gt; ,
  a &amp;lt;http://www.w3.org/2000/10/swap/pim/contact#SocialEntity&amp;gt; ,
  a &amp;lt;http://www.w3.org/2003/01/geo/wgs84_pos#SpatialThing&amp;gt; .
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;but this information can only be known by collecting the documents at:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;http://xmlns.com/foaf/0.1/firstName&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;http://xmlns.com/foaf/0.1/Person&lt;/code&gt; (actually the same document as &lt;code&gt;http://xmlns.com/foaf/0.1/firstName&lt;/code&gt; but I can&amp;#8217;t know that)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;http://xmlns.com/foaf/0.1/Agent&lt;/code&gt; (as with &lt;code&gt;http://xmlns.com/foaf/0.1/Person&lt;/code&gt;, actually the same document as &lt;code&gt;http://xmlns.com/foaf/0.1/firstName&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;http://www.w3.org/2000/10/swap/pim/contact&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;http://www.w3.org/2003/01/geo/wgs84_pos&lt;/code&gt; (resolving this doesn&amp;#8217;t actually tell me anything extra, but I have to do it all the same to check)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In these circumstances, if, say, &lt;code&gt;http://xmlns.com/foaf/0.1/Person&lt;/code&gt; can&amp;#8217;t be located (my connection dips out for a second or whatever) then suddenly the page&amp;#8217;s metadata &lt;em&gt;means&lt;/em&gt; something different, which is surely a problem in a &lt;em&gt;Semantic&lt;/em&gt; Web.&lt;/p&gt;

&lt;p&gt;Putting aside all that, even if you did need URIs for properties, the HTML5 community feels that the costs in usability of using prefixes to shorten URIs are simply too high to justify the benefit of concision. Why not simply use the full URI within an attribute?&lt;/p&gt;

&lt;p&gt;In summary, you will not be able to persuade members of the HTML5 community that it&amp;#8217;s worth paying the usability cost of prefixes until you have persuaded them:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;that RDF has significant advantages as a way of modelling data over and above Javascript object structures&lt;/li&gt;
&lt;li&gt;that the ability to resolve the URIs that are used to name properties is not dangerous, and can even be helpful&lt;/li&gt;
&lt;li&gt;that it is ugly and tedious to have to use full URIs when naming properties&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Really I&amp;#8217;m just trying to draw attention to the fact that the HTML5 community has very reasonable concerns about things much more fundamental than using prefix bindings. After redrafting this concluding section many times, the things that I want to say are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;so wouldn&amp;#8217;t things be better if we put as much effort into understanding each other as persuading each other (hah, what an idealist!)&lt;/li&gt;
&lt;li&gt;so we will make more progress in discussions if we focus on the underlying arguments&lt;/li&gt;
&lt;li&gt;so we need to talk in a balanced way about the advantages and disadvantages of RDF&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;or, in a more realistic frame of mind:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;so it&amp;#8217;s just not going to happen for HTML5&lt;/li&gt;
&lt;li&gt;so why not just stop arguing and use the spare time and energy &lt;em&gt;doing&lt;/em&gt;?&lt;/li&gt;
&lt;li&gt;so why not demonstrate RDF&amp;#8217;s power in real-world applications?&lt;/li&gt;
&lt;/ul&gt;
</description>
 <comments>http://www.jenitennison.com/blog/node/124#comments</comments>
 <category domain="http://www.jenitennison.com/blog/taxonomy/term/44">html5</category>
 <category domain="http://www.jenitennison.com/blog/taxonomy/term/31">rdf</category>
 <category domain="http://www.jenitennison.com/blog/taxonomy/term/42">rdfa</category>
 <pubDate>Fri, 21 Aug 2009 18:28:16 +0000</pubDate>
 <dc:creator>Jeni</dc:creator>
 <guid isPermaLink="false">124 at http://www.jenitennison.com/blog</guid>
</item>
<item>
 <title>Google&#039;s RDFa Support</title>
 <link>http://www.jenitennison.com/blog/node/104</link>
 <description>&lt;p&gt;I can&amp;#8217;t reply to &lt;a href=&quot;http://twitter.com/hsivonen/status/1785106195&quot; title=&quot;Tweet: @JeniT What&#039;s wrong with http://rdf.data-vocabulary.org/rdf.xml ?&quot;&gt;Henri Sivonen&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;@JeniT What&amp;#8217;s wrong with http://rdf.data-vocabulary.org/rdf.xml ?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;in 140 characters.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://rdf.data-vocabulary.org/rdf.xml&quot; title=&quot;http://rdf.data-vocabulary.org/rdf.xml&quot;&gt;http://rdf.data-vocabulary.org/rdf.xml&lt;/a&gt; is the the RDF schema that describes the classes and properties recognised by Google&amp;#8217;s &lt;a href=&quot;http://google.com/support/webmasters/bin/topic.py?topic=21997&quot; title=&quot;Google: Structured Data (Rich Snippets)&quot;&gt;rich snippets&lt;/a&gt;, which promises to provide richer information about search results than is available currently, in the manner of &lt;a href=&quot;http://developer.yahoo.com/searchmonkey/&quot; title=&quot;Yahoo! SearchMonkey&quot;&gt;SearchMonkey&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;So what&amp;#8217;s so bad about this RDF schema?&lt;/p&gt;

&lt;!--break--&gt;

&lt;p&gt;Well, firstly, unlike what I just claimed, it&amp;#8217;s &lt;em&gt;not&lt;/em&gt; the RDF schema for Google&amp;#8217;s rich snippets. If you look at an example like this one from their own help pages:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div xmlns:v=&quot;http://rdf.data-vocabulary.org/&quot; typeof=&quot;v:Person&quot;&amp;gt;
   &amp;lt;span property=&quot;v:name&quot;&amp;gt;John Smith&amp;lt;/span&amp;gt;
   &amp;lt;span property=&quot;v:nickname&quot;&amp;gt;Smithy&amp;lt;/span&amp;gt;
   &amp;lt;span property=&quot;v:url&quot;&amp;gt;http://www.example.com&amp;lt;/span&amp;gt;
   &amp;lt;span property=&quot;v:affiliation&quot;&amp;gt;ACME&amp;lt;/span&amp;gt;
   &amp;lt;span rel=&quot;v:address&quot;&amp;gt;
     &amp;lt;span property=&quot;v:locality&quot;&amp;gt;Albuquerque&amp;lt;/span&amp;gt;
   &amp;lt;/span&amp;gt;
   &amp;lt;span property=&quot;title&quot;&amp;gt;Engineer&amp;lt;/span&amp;gt;
   &amp;lt;a href=&quot;http://darryl-blog.example.com/&quot; rel=&quot;v:friend&quot;&amp;gt;
   &amp;lt;span property=&quot;v:name&quot;&amp;gt;Darryl&amp;lt;/span&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;you&amp;#8217;ll see that the CURIE &lt;code&gt;v:name&lt;/code&gt; resolves to the URI &lt;code&gt;http://rdf.data-vocabulary.org/name&lt;/code&gt;. And that resolves to&amp;#8230; well, &lt;a href=&quot;http://rdf.data-vocabulary.org/name&quot; title=&quot;http://rdf.data-vocabulary.org/name&quot;&gt;take a look&lt;/a&gt;. &lt;strong&gt;The fact that you can&amp;#8217;t resolve a property URI to a definition within a schema or ontology really undermines the idea of &lt;a href=&quot;http://www.w3.org/2001/tag/doc/selfDescribingDocuments.html&quot; title=&quot;W3C: Self-Describing Documents&quot;&gt;self-describing documents&lt;/a&gt;.&lt;/strong&gt; To know anything about what &lt;code&gt;http://rdf.data-vocabulary.org/name&lt;/code&gt; means you have to be human enough to go hunting for the documentation that describes it. Contrast with &lt;code&gt;http://xmlns.com/foaf/0.1/name&lt;/code&gt; which, if you ask for RDF, takes you to ontology in which you can look for the definition of that resource, and find out its domain, range, a label for it and so on.&lt;/p&gt;

&lt;p&gt;So the redirection&amp;#8217;s screwed up. What about the schema itself? Well, it&amp;#8217;s not that it&amp;#8217;s bad in and of itself; it reflects a reasonable model of the world of products, reviews, people, organisations. The model&amp;#8217;s obviously heavily based on those used within the microformats that Google is also supporting: &lt;a href=&quot;http://www.microformats.org/wiki/hproduct&quot; title=&quot;microformats: hProduct&quot;&gt;hProduct&lt;/a&gt;, &lt;a href=&quot;http://www.microformats.org/wiki/hreview&quot; title=&quot;microformats: hReview&quot;&gt;hReview&lt;/a&gt;, &lt;a href=&quot;http://microformats.org/wiki/hcard&quot; title=&quot;microformats: hCard&quot;&gt;hCard&lt;/a&gt; and &lt;a href=&quot;http://gmpg.org/xfn/intro&quot; title=&quot;XFN&quot;&gt;XFN&lt;/a&gt;, which in turn are based on existing standards such as &lt;a href=&quot;http://www.ietf.org/rfc/rfc2426.txt&quot; title=&quot;RFC2426: vCard&quot;&gt;vCard&lt;/a&gt; or on solid document analysis on existing behaviour. So it&amp;#8217;s not surprising that it&amp;#8217;s a reasonable model.&lt;/p&gt;

&lt;p&gt;The problem is not so much what has been done as what hasn&amp;#8217;t. I&amp;#8217;m not completely surprised that there&amp;#8217;s no support for &lt;a href=&quot;http://www.foaf-project.org/&quot; title=&quot;Friend-of-a-Friend&quot;&gt;FOAF&lt;/a&gt; &amp;#8212; the model is sufficiently different from that of hCard to make it harder to use &amp;#8212; but not reusing the &lt;a href=&quot;http://www.w3.org/2006/vcard/ns#&quot; title=&quot;W3C: RDF Ontology for vCard&quot;&gt;existing RDF ontology for vCard&lt;/a&gt; smacks of either ignorance or arrogance. I&amp;#8217;ve advocated before going ahead and building your own ontologies rather than waiting for community standardisation, but not doing a rudimentary search for previous work is going too far.&lt;/p&gt;

&lt;p&gt;The schema itself is very sparse. It only uses RDF schema, rather than OWL, so it&amp;#8217;s not surprising that it&amp;#8217;s not particularly expressive, but even so a few labels would have been useful! The classes that have been introduced have no hierarchy (they are all subclasses of &lt;code&gt;rdf:Resource&lt;/code&gt;), so properties that are shared between people and organisations, such as &lt;code&gt;v:name&lt;/code&gt;, have a domain of all resources. And there&amp;#8217;s no property subclass, so no way to automatically identify the appropriate property to use as a substitute for &lt;code&gt;rdfs:label&lt;/code&gt; when displaying information about a person or organisation. &lt;strong&gt;From a technical standpoint, it seems like it was hastily thrown together by people who either don&amp;#8217;t understand why self-description is important, or don&amp;#8217;t care about other people&amp;#8217;s use of the vocabulary.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;But more than these, the reason that I am disappointed with what&amp;#8217;s been shown so far is that &lt;strong&gt;Google is really missing the point of using RDF: its extensibility&lt;/strong&gt;. It&amp;#8217;s easy enough to parse a set of microformats; to build something useful around a small number of known vocabularies. It&amp;#8217;s easy, but it&amp;#8217;s limited. When I heard the buzz of &amp;#8220;Google supporting RDFa&amp;#8221; I expected it to support not just the syntax of RDFa, but its extensibility, because otherwise what&amp;#8217;s the point?&lt;/p&gt;

&lt;p&gt;The quote that scares me most comes from the &lt;a href=&quot;http://radar.oreilly.com/2009/05/google-adds-microformat-parsin.html&quot; title=&quot;O&#039;Reilly: Google Adds Microformat Parsing&quot;&gt;interview with RV Guha and Othar Hansson&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;RV Guha&lt;/strong&gt; &amp;#8230; It&amp;#8217;s really important that everybody, as far as possible, use the same vocabulary. So Google is essentially going to be making an investment in sort of hosting a vocabulary that maybe is Google Services. &amp;#8230;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;because a single centralised vocabulary is just not going to be feasible. The web&amp;#8217;s too large and diverse for that.&lt;/p&gt;

&lt;p&gt;And I believe that Google, by working with the web and combining semantic markup with their formidable computing power and existing natural language understanding, could do so much more. Let me talk through a really simple scenario to illustrate.&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;Google publish their own RDF vocabulary for products (as they have done). Amazon look at the vocabulary and decide that it doesn&amp;#8217;t include some information that&amp;#8217;s useful and important specifically for books, such as the author of the book. So Amazon extend Google&amp;#8217;s vocabulary by adding a new class that&amp;#8217;s a subclass of &lt;code&gt;google:Product&lt;/code&gt;, &lt;code&gt;amazon:Book&lt;/code&gt; and introduce another property in their RDFa markup, &lt;code&gt;amazon:author&lt;/code&gt;, giving it a range of &lt;code&gt;amazon:Book&lt;/code&gt;.&lt;/p&gt;
  
  &lt;p&gt;When Google indexes Amazon&amp;#8217;s pages, the RDFa parser sees that the resources that are described in the pages are described as &lt;code&gt;amazon:Book&lt;/code&gt;s. It doesn&amp;#8217;t know what a &lt;code&gt;amazon:Book&lt;/code&gt; is, so it resolves the URI, looks at Amazon&amp;#8217;s ontology and finds the label and description of the class, and the fact that it&amp;#8217;s a subclass of &lt;code&gt;google:Product&lt;/code&gt;. The fact that an &lt;code&gt;amazon:Book&lt;/code&gt; is a kind of &lt;code&gt;google:Product&lt;/code&gt; means that it can be displayed just like other products. Perhaps Google even specify some other things that can be put in your ontology to supplement the rich snippet, like an icon, or a list of properties that are important. I don&amp;#8217;t know. The point is that the ontology provides information to Google about what to do with this class, without Google having to invent and own the vocabulary.&lt;/p&gt;
  
  &lt;p&gt;Similarly, when the RDFa is parsed, Google generates triples for this new &lt;code&gt;amazon:author&lt;/code&gt; property just as it does for the other Google ones. It recognises that it doesn&amp;#8217;t know what it means, so it resolves the URI for the property and finds a schema. The schema includes a label for the property, &amp;#8220;author&amp;#8221; and a natural language description. Google uses the label in the display of the rich snippet; it processes the natural language description to disambiguate the label and translate it into other languages. Perhaps it can even assess the importance of the property, and whether it should actually be displayed at all, by understanding its description.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Anyway, back to earth. These are the kind of pipe dreams that I used to ridicule semantic web folk about back before they body-snatched me! So although I&amp;#8217;m sure that Google could do so much more, there are some things to be thankful for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;They have made the first steps towards recognising semantic markup as a potentially useful source of information.&lt;/li&gt;
&lt;li&gt;They haven&amp;#8217;t gone and invent yet another syntax for encoding semantic information within HTML. (Well, at least this arm hasn&amp;#8217;t.)&lt;/li&gt;
&lt;li&gt;They have reused microformats.&lt;/li&gt;
&lt;li&gt;They have developed a vocabulary for a few things that are really useful, even if we did have ontologies for some of it already.&lt;/li&gt;
&lt;li&gt;They will now have a stake in answering the difficult questions around trust, confidence, accuracy and time-sensitivity of semantic information.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And, of course, this will encourage people who haven&amp;#8217;t previously been interested to use semantic markup, which will make data easier to get at and more open to reuse and I believe will benefit the web as a whole.&lt;/p&gt;
</description>
 <comments>http://www.jenitennison.com/blog/node/104#comments</comments>
 <category domain="http://www.jenitennison.com/blog/taxonomy/term/19">google</category>
 <category domain="http://www.jenitennison.com/blog/taxonomy/term/42">rdfa</category>
 <pubDate>Wed, 13 May 2009 21:30:31 +0000</pubDate>
 <dc:creator>Jeni</dc:creator>
 <guid isPermaLink="false">104 at http://www.jenitennison.com/blog</guid>
</item>
<item>
 <title>What You Can&#039;t Do with HTML5 Microdata</title>
 <link>http://www.jenitennison.com/blog/node/103</link>
 <description>&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; Fixed a couple of errors in the microdata code.&lt;/p&gt;

&lt;p&gt;The &lt;a href=&quot;http://dev.w3.org/html5/spec/Overview.html#microdata&quot; title=&quot;W3C: HTML5: Microdata&quot;&gt;HTML5 microdata&lt;/a&gt; proposal has hit the web, just days before Google announced its &lt;a href=&quot;http://radar.oreilly.com/2009/05/google-announces-support-for-m.html&quot; title=&quot;O&#039;Reilly: Google Announces Support for Microformats and RDFa&quot;&gt;support for RDFa&lt;/a&gt; (or at least &lt;a href=&quot;http://iandavis.com/blog/2009/05/googles-rdfa-a-damp-squib&quot; title=&quot;Ian Davis: Google&#039;s RDFa a Damp Squib&quot;&gt;one vocabulary encoded using RDFa attributes&lt;/a&gt;). These are, indeed, &lt;a href=&quot;http://en.wikipedia.org/wiki/May_you_live_in_interesting_times&quot; title=&quot;Wikipedia: May you live in interesting times&quot;&gt;&amp;#8220;interesting times&amp;#8221;&lt;/a&gt; for the semantic web.&lt;/p&gt;

&lt;p&gt;Now, if you&amp;#8217;re one of those weirdos who want to embed RDF triples within your web pages, what you&amp;#8217;re going to care about is whether you can use microdata to do it. Those of us who have been using RDFa in anger, rather than in toy examples, know that it can be hard to map a particular set of RDF statements onto HTML content. I thought I&amp;#8217;d take a look to see just what it would be like to create particular RDF with the HTML5 microdata proposal.&lt;/p&gt;

&lt;!--break--&gt;

&lt;h2&gt;Basics&lt;/h2&gt;

&lt;p&gt;On the face of it, you can express any triple in microdata because a triple like this (Turtle):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;http://www.example.com/subject&amp;gt; &amp;lt;http://www.example.com/property&amp;gt; &amp;lt;http://www.example.com/object&amp;gt; .
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;can always, and anywhere, be expressed with (HTML5):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;span item&amp;gt;
  &amp;lt;link itemprop=&quot;about&quot; href=&quot;http://www.example.com/subject&quot;&amp;gt;
  &amp;lt;link itemprop=&quot;http://www.example.com/property&quot; href=&quot;http://www.example.com/object&quot;&amp;gt;
&amp;lt;/span&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;while a triple like:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;http://www.example.com/subject&amp;gt; &amp;lt;http://www.example.com/otherProperty&amp;gt; &quot;value&quot; .
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;can be expressed with:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;span item&amp;gt;
  &amp;lt;link itemprop=&quot;about&quot; href=&quot;http://www.example.com/subject&quot;&amp;gt;
  &amp;lt;meta itemprop=&quot;http://www.example.com/otherProperty&quot; content=&quot;value&quot;&amp;gt;
&amp;lt;/span&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Of course having to use all those long, repetitive URIs is a bit of a pain and bloats out the markup, but we&amp;#8217;d never expect this to be hand-authored, right? Right? And what we really care about is that we can express the RDF.&lt;/p&gt;

&lt;p&gt;It&amp;#8217;s not just the URIs that are long-winded, by the way. RDFa manages to cram a lot into each element, whereas microdata usually requires separate elements. This is an example from the RDFa specification:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;img src=&quot;photo1.jpg&quot;
  rel=&quot;license&quot; resource=&quot;http://creativecommons.org/licenses/by/2.0/&quot;
  property=&quot;dc:creator&quot; content=&quot;Mark Birbeck&quot; /&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;which produces the triples:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;photo1.jpg&amp;gt; xhv:license &amp;lt;http://creativecommons.org/licenses/by/2.0/&amp;gt; .
&amp;lt;photo1.jpg&amp;gt; dc:creator &quot;Mark Birbeck&quot; .
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;In HTML5, I think this has to be done with:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;span item&amp;gt;
  &amp;lt;img itemprop=&quot;about&quot; src=&quot;photo1.jpg&quot;&amp;gt;
  &amp;lt;link itemprop=&quot;http://www.w3.org/1999/xhtml/vocab#license&quot; 
        href=&quot;http://creativecommons.org/licenses/by/2.0/&quot;&amp;gt;
  &amp;lt;meta itemprop=&quot;http://purl.org/dc/elements/1.1/creator&quot; 
        content=&quot;Mark Birbeck&quot;&amp;gt;
&amp;lt;/span&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;It&amp;#8217;s a bit more tedious, but also more obvious what&amp;#8217;s going on. Even after handling RDFa as much as I have, I still struggle to work out when, for example, an &lt;code&gt;href&lt;/code&gt; attribute is providing the object for a statement, and when the subject. And if you look at the &lt;a href=&quot;http://www.london-gazette.co.uk/&quot; title=&quot;London Gazette&quot;&gt;London Gazette&lt;/a&gt; RDFa, you&amp;#8217;ll notice many occasions where empty &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt; elements are used to provide the equivalent of the inline &lt;code&gt;&amp;lt;link&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;meta&amp;gt;&lt;/code&gt; elements shown above. (In fact, as far as I recall earlier drafts of RDFa allowed &lt;code&gt;&amp;lt;link&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;meta&amp;gt;&lt;/code&gt; elements to be used this too.)&lt;/p&gt;

&lt;p&gt;From what I can see, though, there are two things that the microdata proposal in its current form can&amp;#8217;t handle: datatyping and XML literals.&lt;/p&gt;

&lt;h2&gt;Datatypes&lt;/h2&gt;

&lt;p&gt;Datatypes are important in RDF. Values of properties are often not just strings, but dates, times, integers and so on. The microdata proposal mentions using the &lt;code&gt;&amp;lt;time&amp;gt;&lt;/code&gt; element to create values, and has this example:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div item&amp;gt;
 I was born on &amp;lt;time itemprop=&quot;birthday&quot; datetime=&quot;2009-05-10&quot;&amp;gt;May 10th 2009&amp;lt;/time&amp;gt;.
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The triple that you&amp;#8217;d want to create from this is:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;&amp;gt; &amp;lt;http://www.w3.org/1999/xhtml/custom#birthday&amp;gt; &quot;2009-05-10&quot;^^xsd:date .
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;which makes it plain that the value is a date. However, the definition of the mapping from microdata to RDF makes it clear that the triple that&amp;#8217;s created is:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;&amp;gt; &amp;lt;http://www.w3.org/1999/xhtml/custom#birthday&amp;gt; &quot;2009-05-10&quot; .
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;In other words, the value is a plain literal, not a date.&lt;/p&gt;

&lt;p&gt;In RDFa, the &lt;code&gt;datatype&lt;/code&gt; attribute is used to indicate the datatype of the value, so you can do:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div xmlns:custom=&quot;http://www.w3.org/1999/xhtml/custom#&quot;&amp;gt;
  I was born on &amp;lt;span property=&quot;custom:birthday&quot; content=&quot;2009-05-10&quot; datatype=&quot;xsd:date&quot;&amp;gt;May 10th 2009&amp;lt;/span&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;It would be easy enough to say that the value of a &lt;code&gt;&amp;lt;time&amp;gt;&lt;/code&gt; element has the datatype &lt;code&gt;xsd:date&lt;/code&gt;, &lt;code&gt;xsd:time&lt;/code&gt; or &lt;code&gt;xsd:dateTime&lt;/code&gt; dependent on the syntax of its &lt;code&gt;datetime&lt;/code&gt; attribute, but there are other times that you want typed values. We&amp;#8217;ve used strings (as opposed to plain literals), integers and years. I wouldn&amp;#8217;t want to rule out the use of custom datatypes such as colours (and RDF permits these). The JSON mapping could, perhaps, use an appropriate object if there is one, and otherwise use just the string value without too much loss of power.&lt;/p&gt;

&lt;h2&gt;XML Literals&lt;/h2&gt;

&lt;p&gt;Arguably less important is the lack of support for XML literals, which are values that contain markup. The example in the RDFa spec is:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;h2 property=&quot;dc:title&quot;&amp;gt;
  E = mc&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;: The Most Urgent Problem of Our Time
&amp;lt;/h2&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;which generates the triple (Turtle):&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;&amp;gt; &amp;lt;http://purl.org/dc/elements/1.1/title&amp;gt; &quot;E = mc&amp;lt;sup&amp;gt;2&amp;lt;/sup&amp;gt;: The Most Urgent Problem of Our Time&quot;^^rdf:XMLLiteral .
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;RDFa allows you to force a value as an XML literal or a plain literal using the &lt;code&gt;datatype&lt;/code&gt; attribute. Otherwise, if the element has any element children then it&amp;#8217;s assumed to be an XML literal, and if not, a plain literal. I think the microdata proposal could adopt the same course of action. The JSON mapping could, perhaps, result in a value which is an array or some other container for a sequence of text and element nodes.&lt;/p&gt;

&lt;h2&gt;Final Thoughts&lt;/h2&gt;

&lt;p&gt;To my mind, the HTML5 microdata proposal is unacceptable in its current form because, unlike RDFa, it can&amp;#8217;t be used to represent all the statements that you might want to represent. If those issues were fixed, there would be pros and cons between it and RDFa. Microdata is more long-winded, but more explicit. RDFa is more arcane but doesn&amp;#8217;t swamp the content of the page to quite the same extent.&lt;/p&gt;

&lt;p&gt;Like a lot of people, I would have far rather seen a proposal which didn&amp;#8217;t reinvent the wheel, but how does the old saying go: &amp;#8220;The great thing about standards is that there are so many to choose from.&amp;#8221; If the microdata proposal stays the course, I only hope that we&amp;#8217;ll see consumers supporting both it and RDFa so that producers can choose which to use rather than being forced to embed both within their pages.&lt;/p&gt;
</description>
 <comments>http://www.jenitennison.com/blog/node/103#comments</comments>
 <category domain="http://www.jenitennison.com/blog/taxonomy/term/44">html5</category>
 <category domain="http://www.jenitennison.com/blog/taxonomy/term/42">rdfa</category>
 <pubDate>Wed, 13 May 2009 00:57:46 +0000</pubDate>
 <dc:creator>Jeni</dc:creator>
 <guid isPermaLink="false">103 at http://www.jenitennison.com/blog</guid>
</item>
</channel>
</rss>

