--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ED/microdata-rdf/20111011/index.html Wed Oct 26 12:46:18 2011 -0700
@@ -0,0 +1,784 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Microdata to RDF</title>
+<meta http-equiv="content-type" content="text/html; charset=UTF-8">
+<!--
+ === NOTA BENE ===
+ For the three scripts below, if your spec resides on dev.w3 you can check them
+ out in the same tree and use relative links so that they'll work offline,
+ -->
+<script type="text/javascript"
+ src="http://dev.w3.org/2009/dap/ReSpec.js/js/respec.js" class="remove">
+ </script>
+<script type="text/javascript" class="remove">
+
+ var preProc = {
+ apply: function(c) {
+ // extend the bibliography entries
+ berjon.biblio["MICRODATA"] = "<cite><a href=\"http://www.w3.org/TR/2011/WD-microdata-20110525/\">HTML Microdata</a></cite> Ian Hickson Editor. World Wide Web Consortium (work in progress). 25 May 2010. This edition of the HTML Microdata specification is http://www.w3.org/TR/2011/WD-microdata-20110525/. The <a href=\"http://www.w3.org/TR/microdata/\">latest edition of HTML Microdata</a> is available at http://www.w3.org/TR/microdata/";
+
+ // process the document before anything else is done
+ var refs = document.querySelectorAll('adef') ;
+ for (var i = 0; i < refs.length; i++) {
+ var item = refs[i];
+ var p = item.parentNode ;
+ var con = item.innerHTML ;
+ var sp = document.createElement( 'dfn' ) ;
+ var tit = item.getAttribute('title') ;
+ if (!tit) {
+ tit = con;
+ }
+ sp.className = 'adef' ;
+ sp.title=tit ;
+ sp.innerHTML = con ;
+ p.replaceChild(sp, item) ;
+ }
+ refs = document.querySelectorAll('aref') ;
+ for (var i = 0; i < refs.length; i++) {
+ var item = refs[i];
+ var p = item.parentNode ;
+ var con = item.innerHTML ;
+ var sp = document.createElement( 'a' ) ;
+ sp.className = 'aref' ;
+ sp.setAttribute('title', con);
+ sp.innerHTML = '@'+con ;
+ p.replaceChild(sp, item) ;
+ }
+ // now do terms
+ refs = document.querySelectorAll('tdef') ;
+ for (var i = 0; i < refs.length; i++) {
+ var item = refs[i];
+ if (!item) continue ;
+ var p = item.parentNode ;
+ var con = item.innerHTML ;
+ var ref = item.getAttribute('title') ;
+ if (!ref) {
+ ref = item.textContent ;
+ }
+ if (ref) {
+ ref = ref.replace(/\n/g, '_') ;
+ ref = ref.replace(/\s+/g, '_') ;
+ }
+ var sp = document.createElement( 'dfn' ) ;
+ sp.title = ref ;
+ sp.innerHTML = con ;
+ p.replaceChild(sp, item) ;
+ }
+ // now term references
+ refs = document.querySelectorAll('tref') ;
+ for (var i = 0; i < refs.length; i++) {
+ var item = refs[i];
+ if (!item) continue ;
+ var p = item.parentNode ;
+ var con = item.innerHTML ;
+ var ref = item.getAttribute('title') ;
+ if (!ref) {
+ ref = item.textContent ;
+ }
+ if (ref) {
+ ref = ref.replace(/\n/g, '_') ;
+ ref = ref.replace(/\s+/g, '_') ;
+ }
+
+ var sp = document.createElement( 'a' ) ;
+ var id = item.textContent ;
+ sp.className = 'tref' ;
+ sp.title = ref ;
+ sp.innerHTML = con ;
+ p.replaceChild(sp, item) ;
+ }
+ }
+ } ;
+
+
+ var respecConfig = {
+ // specification status (e.g. WD, LCWD, NOTE, etc.). If in doubt use ED.
+ specStatus: "ED",
+ //publishDate: "2010-04-29",
+ copyrightStart: "2011",
+
+ // the specification's short name, as in http://www.w3.org/TR/short-name/
+ shortName: "microdata-rdf",
+ subtitle: "Transformation from HTML+Microdata to RDF",
+ // if you wish the publication date to be other than today, set this
+ // publishDate: "2009-08-06",
+
+ // if there is a previously published draft, uncomment this and set its YYYY-MM-DD date
+ // and its maturity status
+ //previousPublishDate: "2011-08-17",
+ //previousMaturity: "ED",
+ //previousDiffURI: "http://json-ld.org/spec/ED/20110817/index.html",
+ //diffTool: "http://www.aptest.com/standards/htmldiff/htmldiff.pl",
+
+ // if there a publicly available Editor's Draft, this is the link
+ edDraftURI: "https://dvcs.w3.org/hg/htmldata/microdata-rdf/",
+
+ // if this is a LCWD, uncomment and set the end of its review period
+ // lcEnd: "2009-08-05",
+
+ // if you want to have extra CSS, append them to this list
+ // it is recommended that the respec.css stylesheet be kept
+ extraCSS: [
+ "http://dev.w3.org/2009/dap/ReSpec.js/css/respec.css",
+ ],
+
+ // editors, add as many as you like
+ // only "name" is required
+ editors: [
+ { name: "Gregg Kellogg", url: "http://greggkellogg.net/",
+ company: "Kellogg Associates" },
+ ],
+
+ // authors, add as many as you like.
+ // This is optional, uncomment if you have authors as well as editors.
+ // only "name" is required. Same format as editors.
+
+ authors: [
+ { name: "Ian Hickson", url: "mailto:ian@hixie.ch",
+ company: "Google, Inc." },
+ { name: "Gregg Kellogg", url: "http://greggkellogg.net/",
+ company: "Kellogg Associates" },
+ ],
+
+ // name of the WG
+ wg: "HTML Data Task Force",
+
+ // URI of the public WG page
+ wgURI: "http://www.w3.org/wiki/Html-data-tf",
+
+ // name (with the @w3c.org) of the public mailing to which comments are due
+ wgPublicList: "public-html-data-tf",
+
+ // URI of the patent status for this WG, for Rec-track documents
+ // !!!! IMPORTANT !!!!
+ // This is important for Rec-track documents, do not copy a patent URI from a random
+ // document unless you know what you're doing. If in doubt ask your friendly neighbourhood
+ // Team Contact.
+ wgPatentURI: "",
+ maxTocLevel: 4,
+ preProcess: [ preProc ],
+ //alternateFormats: [ {uri: "diff-20110817.html", label: "diff to previous version"} ],
+ };
+
+ function updateExample(doc, content) {
+ // perform transformations to make it render and prettier
+ content = content.replace(/<!--/, '');
+ content = content.replace(/-->/, '');
+ content = doc._esc(content);
+ content = content.replace(/\*\*\*\*([^*]*)\*\*\*\*/g, '<span class="diff">$1</span>') ;
+ return content ;
+ }
+
+ function updateDTD(doc, content) {
+ // perform transformations to
+ // make it render and prettier
+ content = '<pre class="dtd">' + doc._esc(content) + '</pre>';
+ content = content.replace(/!ENTITY % ([^ \t\r\n]*)/g, '!ENTITY <span class="entity">% $1</span>');
+ content = content.replace(/!ELEMENT ([^ \t$]*)/mg, '!ELEMENT <span class="element">$1</span>');
+ return content;
+ }
+
+ function updateSchema(doc, content) {
+ // perform transformations to
+ // make it render and prettier
+ content = '<pre class="dtd">' + doc._esc(content) + '</pre>';
+ content = content.replace(/<xs:element\s+name="([^&]*)"/g, '<xs:element name="<span class="element" id="schema_element_$1">$1</span>"') ;
+ return content;
+ }
+
+ function updateTTL(doc, content) {
+ // perform transformations to
+ // make it render and prettier
+ content = '<pre class="sh_sourceCode">' + doc._esc(content) + '</pre>';
+ content = content.replace(/@prefix/g, '<span class="sh_keyword">@prefix</span>');
+ return content;
+ }
+ </script>
+<style>
+.diff { font-weight:bold; color:#0a3; }
+ol.algorithm { counter-reset:numsection; list-style-type: none; }
+ol.algorithm li { margin: 0.5em 0; }
+ol.algorithm li:before {
+ font-weight: bold;
+ counter-increment: numsection;
+ content: counters(numsection, ".") ") ";
+}
+dl.triple { padding: 0 0 0 1em; }
+dl.triple dt, dl.triple dd { margin: 0; display: inline }
+dl.triple dt:after { content: ':'; }
+dl.triple dd:after { content: '\A'; white-space: pre; }
+</style>
+</head>
+
+<body>
+<section id="abstract">
+</section>
+
+<section id='sotd'>
+<p>This document is an experimental work in progress.</p>
+</section>
+
+<section>
+ <h1>Introduction</h1>
+ <p>
+ This document describes a means of transforming HTML containing Microdata into RDF. HTML Microdata [[!MICRODATA]]
+ is an extension to HTML used to embed machine-readable data to HTML documents. This specification describes
+ transformation directly to RDF [[RDF-CONCEPTS]].
+ </p>
+</section>
+
+<section>
+ <h1>Attributes and Syntax</h1>
+ <p>
+ The Microdata specification [[!MICRODATA]] defines a number of attributes and the way in which those
+ attributes are to be interpreted. This section describes those attributes, with reference to their
+ original definition.
+ </p>
+ <dl>
+ <dt><adef>itemid</adef></dt><dd>
+ An attribute containing a URI used to identify the subject of triples associated with this <tref>item</tref>.
+ Available through the <cite><a
+ href="http://www.w3.org/TR/2011/WD-microdata-20110525/#microdata-dom-api">Microdata DOM API</a></cite> as
+ <code>element.itemId</code>.
+ (See <cite><a href="http://www.w3.org/TR/2011/WD-microdata-20110525/#attr-itemscope">Section 3.2 Items</a></cite> in [[!MICRODATA]]).
+ </dd>
+ <dt><adef>itemprop</adef></dt><dd>
+ An attribute used to identify one or more properties to one ore more <tref>item</tref>s. An <aref>itemprop</aref>
+ contains a space separated list of <tdef>name</tdef>s which may either by <tref>absolute URI</tref>s or terms
+ associated with the type of the <tref>item</tref> as defined by the referencing <trdf>item</trdf>'s
+ <aref>itemtype</aref>.
+ Available through the <cite><a
+ href="http://www.w3.org/TR/2011/WD-microdata-20110525/#microdata-dom-api">Microdata DOM API</a></cite> as
+ <code>element.itemProp</code>.
+ (See <cite><a href="http://www.w3.org/TR/2011/WD-microdata-20110525/#names:-the-itemprop-attribute">Section 3.3
+ Names: the itemprop attribute</a></cite> of [[!MICRODATA]]).
+ </dd>
+ <dt><adef>itemscope</adef></dt><dd>
+ An boolean attribute identifying an element as an item.
+ (See <cite><a href="http://www.w3.org/TR/2011/WD-microdata-20110525/#attr-itemscope">Section 3.2 Items</a></cite>
+ of [[!MICRODATA]]).
+ </dd>
+ <dt><adef>itemref</adef></dt><dd>
+ An additional attribute on an <tref>item</tref> that references additional elements containing property
+ definitions to be applied to the referencing <tref>item</tref>. The attribute value is an unordered
+ list of ID references to elements within the same document.
+ Available through the <cite><a
+ href="http://www.w3.org/TR/2011/WD-microdata-20110525/#microdata-dom-api">Microdata DOM API</a></cite> as
+ <code>element.itemRef</code>.
+ (See <cite><a href="http://www.w3.org/TR/2011/WD-microdata-20110525/#attr-itemscope">Section 3.2 Items</a></cite>
+ of [[!MICRODATA]]).
+ </dd>
+ <dt><adef>itemtype</adef></dt><dd>
+ An additional attribute on an <tref>item</tref> used to specify the type of an <tref>item</tref>.
+ The specified type is also used to resolve non-URI <tref>name</tref>s to <tref>absolute URI</tref>s.
+ Available through the <cite><a
+ href="http://www.w3.org/TR/2011/WD-microdata-20110525/#microdata-dom-api">Microdata DOM API</a></cite> as
+ <code>element.itemType</code>.
+ (See <cite><a href="http://www.w3.org/TR/2011/WD-microdata-20110525/#attr-itemscope">Section 3.2 Items</a></cite>
+ of [[!MICRODATA]]).
+ </dd>
+ </dl>
+</section>
+
+<section>
+ <h1>Algorithm</h1>
+ <p>
+ Transformation of Microdata to RDF makes use of general processing rules described in [[!MICRODATA]]
+ for the treatment of <tref>item</tref>s.
+ </p>
+ <section>
+ <h2>Algorithm Terms</h2>
+ <dl>
+ <dt><tdef>item</tdef></dt><dd>
+ An <tref>item</tref> is defined as an element containing an <aref>itemscope</aref> attribute. (See <cite><a
+ href="http://www.w3.org/TR/2011/WD-microdata-20110525/#attr-itemscope">Section 3.2 Items</a></cite> of
+ [[!MICRODATA]]).
+ </dd>
+ <dt><tdef>top-level item</tdef></dt><dd>
+ An <tref>item</tref> which does not contain an <aref>itemprop</aref> attribute.
+ Available through the <cite><a
+ href="http://www.w3.org/TR/2011/WD-microdata-20110525/#microdata-dom-api">Microdata DOM API</a></cite> as
+ <code>document.getItems</code>.
+ (See <cite><a href="http://www.w3.org/TR/2011/WD-microdata-20110525/#top-level-microdata-items">Section 3.5
+ Associating names with items</a></cite> of [[!MICRODATA]]).
+ </dd>
+ <dt><tdef>absolute URI</tdef></dt><dd>
+ As defined in [[!RFC3986]], an absolute URI contains both <em>scheme</em> and <em>scheme-specific-part</em>s.
+ </dd>
+ <dt><tdef>document base</tdef></dt><dd>
+ The base address of the document being processed, as defined in <cite><a
+ href="http://dev.w3.org/html5/spec/Overview.html#resolving-urls">Section 2.6.3 Resolving URLs</a> of
+ [[!HTML5]]</cite>.
+ </dd>
+ <dt><tdef>global identifier</tdef></dt><dd>
+ The value of an <tref>item</tref>'s <aref>itemid</aref> attribute, if it has one. (See <cite><a
+ href="http://www.w3.org/TR/2011/WD-microdata-20110525/#attr-itemscope">Section 3.2 Items</a></cite> of
+ [[!MICRODATA]]).
+ </dd>
+ <dt><tdef>URI reference</tdef></dt><dd>
+ URI references are suitable to be used as subject predicate or object positions within an RDF triple,
+ as opposed to a <tref>Literal</tref> value that may contain a string representation of a URI. (See
+ [[RDF-CONCEPTS]]).
+ </dd>
+ <dt><tdef>Blank Node</tdef></dt><dd>
+ A blank node is a node in a graph that is neither a <tref>URI reference</tref> nor a <tref>Literal</tref>.
+ <tref>Item</tref>s without a <tref>global identifier</tref> have a blank node allocated to them.
+ (See [[RDF-CONCEPTS]]).
+ </dd>
+ <dt><tdef>Literal</tdef></dt><dd>
+ Literals a values such as strings and dates, including <tdef>typed literal</tdef>s and
+ <tdef>plain literal</tdef>s.
+ (See [[RDF-CONCEPTS]]).
+ </dd>
+ <dt><tdef>evaluation context</tdef></dt><dd>
+ A data structure including the following elements:
+ <dl>
+ <dt><tdef>memory</tdef></dt><dd>
+ a mapping of items to subjects, initially empty
+ </dd>
+ <dt><tdef>current type</tdef></dt><dd>
+ an <tref>absolute URI</tref> for the <em>current type</em>, used when an <tref>item</tref> does not contain
+ an explicit <aref>itemtype</aref>
+ </dd>
+ </dl>
+ </dd>
+ <dt><tdef>item properties</tdef></dt><dd>
+ The mechanism for finding the <tref title="item properties">properties of an item</tref> are described in
+ <cite><a href="http://www.w3.org/TR/2011/WD-microdata-20110525/#the-properties-of-an-item">Section 3.5
+ Associating names with items</a></cite> of [[!MICRODATA]].
+ Available through the <cite><a
+ href="http://www.w3.org/TR/2011/WD-microdata-20110525/#microdata-dom-api">Microdata DOM API</a></cite> as
+ <code>element.properties</code>.
+ </dd>
+ <dt><tdef>property names</tdef></dt><dd>
+ The tokens of an element's <aref>itemprop</aref> attribute.
+ (See <cite><a href="http://www.w3.org/TR/2011/WD-microdata-20110525/#property-names">Section 3.3 Names: the
+ itemprop attribute</a></cite> of [[!MICRODATA]]).
+ </dd>
+ <dt><tdef>property value</tdef></dt><dd>
+ The <tref>property value</tref> of a name-value pair added by an element with an <aref>itemprop</aref>
+ attribute depends on the element.
+ Available through the <cite><a
+ href="http://www.w3.org/TR/2011/WD-microdata-20110525/#microdata-dom-api">Microdata DOM API</a></cite> as
+ <code>element.itemValue</code>.
+ (Updated from <cite><a href="http://www.w3.org/TR/2011/WD-microdata-20110525/#url-property-elements">Section
+ 3.4 Values</a></cite> of [[!MICRODATA]]).
+ <div class="issue">
+ If we reference <code>element.itemValue</code> we should file issues against the Microdata spec
+ to ensure that values returned are consisted with this spec.
+ </div>
+ <dl>
+ <dt>If the element also has an <tref>itemscope</tref> attribute</dt>
+ <dd>
+ The value is the <tref>item</tref> created by the element as a <tref>URI reference</tref> or
+ <tref>blank node</tref>
+ </dd>
+ <dt>If the element is a <code>meta</code> element</dt>
+ <dd>
+ The value is the <tref>plain literal</tref> created from the value of the element's <aref>content</aref>
+ attribute, if any, or the empty string if there is no such attribute.
+ </dd>
+ <dt>
+ If the element is an <code>audio</code>, <code>embed</code>, <code>iframe</code>, <code>img</code>,
+ <code>source</code>, <code>track</code>, or <code>video</code> element with a <aref>src</aref> attribute
+ </dt>
+ <dd>
+ The value is a <tref>URI reference</tref> that results from resolving the value of the element's
+ <aref>src</aref> attribute relative to the element at the time the attribute is set.
+ </dd>
+ <dt>
+ If the element is an <code>a</code>, <code>area</code>, or <code>link</code> element with an
+ <aref>href</aref> attribute
+ </dt>
+ <dd>
+ The value is a <tref>URI reference</tref> that results from resolving the value of the element's
+ <aref>href</aref> attribute relative to the element at the time the attribute is set.
+ </dd>
+ <dt>If the element is an <code>object</code> element with a <aref>data</aref> attribute</dt>
+ <dd>
+ The value is <tref>URI reference</tref> that results from resolving the value of the element's
+ <aref>data</aref> attribute relative to the element at the time the attribute is set.
+ </dd>
+ <dt>If the element is a <code>time</code> element with a <aref>datetime</aref> attribute</dt>
+ <dd>
+ <dl>
+ <dt>
+ If the value has the lexical form of <cite><a
+ href="http://www.w3.org/TR/xmlschema-2/#date">xsd:date</a></cite> [[!RDF-SCHEMA]]
+ </dt>
+ <dd>
+ The value is a <tref>typed literal</tref> composed of the value and
+ <code>http://www.w3.org/2001/XMLSchema#date</code>
+ </dd>
+ <dt>
+ If the value has the lexical form of <cite><a
+ href="http://www.w3.org/TR/xmlschema-2/#time">xsd:time</a></cite> [[!RDF-SCHEMA]]
+ </dt>
+ <dd>
+ The value is a <tref>typed literal</tref> composed of the value and
+ <code>http://www.w3.org/2001/XMLSchema#time</code>
+ </dd>
+ <dt>
+ If the value has the lexical form of <cite><a
+ href="http://www.w3.org/TR/xmlschema-2/#dateTime">xsd:dateTime</a></cite> [[!RDF-SCHEMA]]
+ </dt>
+ <dd>
+ The value is a <tref>typed literal</tref> composed of the value and
+ <code>http://www.w3.org/2001/XMLSchema#dateTime</code>
+ </dd>
+ <!-- revisit when/if content model for @datetime is updated to allow for xsd:duration
+ <dt>
+ If the value has the lexical form of <cite><a
+ href="http://www.w3.org/TR/xmlschema-2/#duration">xsd:duration</a></cite> [[!RDF-SCHEMA]]
+ </dt>
+ <dd>
+ The value is a <tref>typed literal</tref> composed of the value and
+ <code>http://www.w3.org/2001/XMLSchema#duration</code>
+ </dd>
+ -->
+ <dt>Otherwise</dt>
+ <dd>The value is a <tref>plain literal</tref> created from the value.</dd>
+ </dl>
+ </dd>
+ <dt>
+ If the element is an <code>blockquote</code> or <code>q</code> element with n
+ <aref>cite</aref> attribute
+ </dt>
+ <dd>
+ The value is <tref>URI reference</tref> that results from resolving the value of the element's
+ <aref>cite</aref> attribute relative to the element at the time the attribute is set
+ <div class="note">
+ Was formerly document-level, now part of item value processing.
+ </div>
+ </dd>
+ <dt>Otherwise</dt>
+ <dd>
+ The value is a <tref>plain literal</tref>, with the language information set from the language of the
+ element, if it is not unknown.
+ </dd>
+ </dl>
+ </dd>
+ </dl>
+ </section>
+
+ <section>
+ <h3>RDF Conversion Algorithm</h3>
+ <p>A HTML document containing Microdata MAY be converted to any other RDF-compatible document
+ format using the algorithm specified in this section.</p>
+ <p>
+ The algorithm below is designed for DOM-based implementations with CSS selector access to elements.
+ </p>
+ <p>
+ A conforming Microdata processor implementing RDF conversion MUST implement a
+ processing algorithm that results in the equivalent triples that the following
+ algorithm generates:
+ </p>
+
+ <p>Set <em>item list</em> to an empty list.</p>
+
+ <p>For each element that is also a <tref>top-level item</tref> run the following algorithm:</p>
+ <ol class="algorithm">
+ <li>
+ <a href="generate-the-triples">Generate the triples</a> for an item <em>item</em>, using the
+ <tref>evaluation context</tref>.
+ Let <em>result</em> be the (<tref>URI reference</tref> or <tref>blank node</tref>) subject returned.
+ </li>
+ <li>
+ Append <em>result</em> to <em>item list</em>.
+ </li>
+ <li>
+ If <em>item list</em> contains multiple values, <a
+ href="generate-collection">generate an RDF Collection</a> <em>list</em> from the ordered list of values.
+ Set <em>value</em> to the value returned from <a href="generate-collection">generate an RDF
+ Collection</a>.
+ </li>
+ <li>
+ Otherwise, if <em>item list</em> contains a single value set <em>value</em> to that value.
+ </li>
+ <li>
+ Generate the following triple:
+ <dl class="triple">
+ <dt>subject</dt>
+ <dd><tref>Document base</tref></dd>
+ <dt>predicate</dt>
+ <dd><code>http://www.w3.org/1999/xhtml/microdata#item</code></dd>
+ <dt>object</dt>
+ <dd><em>value</em></dd>
+ </dl>
+ </li>
+ </ol>
+ </section>
+
+ <section>
+ <h2>Generate the triples</h2>
+ <p>
+ When the user agent is to Generate triples for an <tref>item</tref> <em>item</em>, given an
+ <tref>Evaluation Context</tref>, it must run the following steps:
+ </p>
+ <p class="note">
+ This algorithm has undergone substantial change from the original Microdata specification [[!MICRODATA]].
+ </p>
+ <ol class="algorithm">
+ <li>
+ If there is an entry for <tref>item</tref> in <tref>memory</tref>, then let <em>subject</em> be the subject of
+ that entry. Otherwise, if <tref>item</tref> has a <tref>global identifier</tref> and that
+ <tref>global identifier</tref> is an <tref>absolute URI</tref>, let <em>subject</em> be that
+ <tref>global identifier</tref>. Otherwise, let <em>subject</em> be a new <tref>blank node</tref>.
+ </li>
+ <li>Add a mapping from <tref>item</tref> to <em>subject</em> in <tref>memory</tref></li>
+ <li>
+ If the <tref>item</tref> has an <aref>itemtype</aref> attribute, extract the value as <em>type</em>.
+ </li>
+ <li>If <em>type</em> is an <tref>absolute URI</tref>, generate the following triple:
+ <dl class="triple">
+ <dt>subject</dt>
+ <dd><em>subject</em></dd>
+ <dt>predicate</dt>
+ <dd><code>http://www.w3.org/1999/02/22-rdf-syntax-ns#type</code></dd>
+ <dt>object</dt>
+ <dd><em>type</em> (as a <tref>URI reference</tref>)</dd>
+ </dl>
+ </li>
+ <li>
+ If <em>type</em> is not an <tref>absolute URI</tref>, set it to <tref>current type</tref> from the
+ <tref>Evaluation Context</tref> if not empty.
+ </li>
+ <li>
+ Set <em>property list</em> to an empty mapping between properties and one or more ordered
+ <em>value</em>s as established below.
+ </li>
+ <li>
+ For each element <em>element</em> that has one or more <tref>property names</tref> and is one of the
+ <tref title="item properties">properties of the item</tref> <em>item</em>, in the order those elements
+ are given by the algorithm that returns the <tref title="item properties">properties of the item</tref>,
+ run the following substep:
+ <ol class="algorithm">
+ <li>
+ For each <em>name</em> in the element's <tref>property names</tref>, run the following substeps:
+ <ol class="algorithm">
+ <li>
+ If <em>name</em> is an <tref>absolute URI</tref>, set <em>predicate</em> to <em>name</em>
+ as a <tref>URI reference</tref>.
+ </li>
+ <li>
+ Otherwise, if <em>type</em> is not defined, set
+ <em>predicate</em> to a <tref>URI reference</tref> that results from resolving <em>name</em>
+ relative to the element at the time the attribute is set.
+ </li>
+ <li>
+ Otherwise, construct <em>predicate</em> from <em>type</em> by removing everything
+ following the last SOLIDUS U+002F ("/") or NUMBER SIGN U+0023 ("#") in <em>type</em> and append
+ <em>name</em>.
+ </li>
+ <li>
+ Let <em>value</em> be the <tref>property value</tref> of <em>element</em>.
+ </li>
+ <li>
+ If <em>value</em> is an <tref>item</tref>, then <a href="generate-the-triples">generate the
+ triples</a> for <em>value</em> using a copy of <tref>evaluation context</tref> with
+ <tref>current type</tref> set to <em>type</em>. Replace <em>value</em> by the subject returned from those steps.
+ </li>
+ <li>
+ Add <em>value</em> to <em>property list</em> for <em>predicate</em>.
+ </li>
+ </ol>
+ </li>
+ </ol>
+ </li>
+ <li>
+ For each <em>predicate</em> in <em>property list</em>:
+ <ol class="algorithm">
+ <li>
+ If entry for <em>predicate</em> in <em>property list</em> contains multiple values, <a
+ href="generate-collection">generate an RDF Collection</a> <em>list</em> from the ordered list of values.
+ Set <em>value</em> to the value returned from <a href="generate-collection">generate an RDF
+ Collection</a>.
+ </li>
+ <li>
+ Otherwise, if <em>predicate</em> in <em>property list</em> contains a single value set
+ <em>value</em> to that value.
+ </li>
+ <li>
+ Generate the following triple:
+ <dl class="triple">
+ <dt>subject</dt>
+ <dd><em>subject</em></dd>
+ <dt>predicate</dt>
+ <dd><em>predicate</em></dd>
+ <dt>object</dt>
+ <dd><em>value</em></dd>
+ </dl>
+ </li>
+ </ol>
+ </li>
+ <li>Return <em>subject</em></li>
+ </ol>
+ </section>
+
+ <section id="generate-collection">
+ <h2>Generate an RDF Collection</h2>
+ <p>
+ An <tdef>RDF Collection</tdef> is a mechanism for defining ordered sequences of objects in RDF (See <cite><a
+ href="http://www.w3.org/TR/rdf-syntax/#collections">Section 5.2 RDF Collections</a></cite> in
+ [[!RDF-SCHEMA]]). As the RDF data-model is that of an unordered graph, a linking method using properties
+ <code>rdf:first</code> and <code>rdf:next </code>is required to be able to specify a particular order.
+ </p>
+ <p>
+ In the Microdata to RDF mapping, <tref>RDF Collection</tref>s are used when an item has more than one value
+ associated with a given property to ensure that the original document order is maintained. The following
+ procedure should be used to generate triples when an <tref>item</tref> property has more than one value
+ (contained in <em>list</em>):
+ </p>
+ <ol class="algorithm">
+ <li>
+ Create a new array <em>array</em> containing a <tref>blank node</tref> for every value in <em>list</em>.
+ </li>
+ <li>
+ For each pair of <em>bnode</em> and <em>value</em> from <em>array</em> and <em>list</em> the following
+ triple is generated:
+ <dl class="triple">
+ <dt>subject</dt>
+ <dd><em>bnode</em></dd>
+ <dt>predicate</dt>
+ <dd><code>http://www.w3.org/1999/02/22-rdf-syntax-ns#first</code></dd>
+ <dt>object</dt>
+ <dd><em>value</em></dd>
+ </dl>
+ </li>
+ <li>
+ For each <em>bnode</em> in <em>array</em> the following triple is generated:
+ <dl class="triple">
+ <dt>subject</dt>
+ <dd><em>bnode</em></dd>
+ <dt>predicate</dt>
+ <dd><code>http://www.w3.org/1999/02/22-rdf-syntax-ns#rest</code></dd>
+ <dt>object</dt>
+ <dd>
+ next element in <em>array</em> or, if that does not exist,
+ <code>http://www.w3.org/1999/02/22-rdf-syntax-ns#nil</code>
+ </dd>
+ </dl>
+ </li>
+ <li>
+ Return the first <tref>blank node</tref> from <em>array</em>.
+ </li>
+ </ol>
+ </section>
+</section>
+
+<section class="appendix">
+<h2>Markup Examples</h2>
+
+<p>The Microdata example below expresses book information as an FRBR Work item.</p>
+
+<pre class="example" data-transform="updateExample">
+<!--
+<dl itemscope
+ itemtype="http://purl.org/vocab/frbr/core#Work"
+ itemid="http://purl.oreilly.com/works/45U8QJGZSQKDH8N"
+ lang="en">
+ <dt>Title</dt>
+ <dd><cite itemprop="http://purl.org/dc/terms/title">Just a Geek</cite></dd>
+ <dt>By</dt>
+ <dd><span itemprop="http://purl.org/dc/terms/creator">Wil Wheaton</span></dd>
+ <dt>Format</dt>
+ <dd itemprop="realization"
+ itemscope
+ itemtype="http://purl.org/vocab/frbr/core#Expression"
+ itemid="http://purl.oreilly.com/products/9780596007683.BOOK">
+ <link itemprop="http://purl.org/dc/terms/type" href="http://purl.oreilly.com/product-types/BOOK">
+ Print
+ </dd>
+ <dd itemprop="realization"
+ itemscope
+ itemtype="http://purl.org/vocab/frbr/core#Expression"
+ itemid="http://purl.oreilly.com/products/9780596802189.EBOOK">
+ <link itemprop="http://purl.org/dc/terms/type" href="http://purl.oreilly.com/product-types/EBOOK">
+ Ebook
+ </dd>
+</dl>
+-->
+</pre>
+
+<p>This is equivalent to the following Turtle:</p>
+<pre class="example" data-transform="updateExample">
+<!--
+@base <http://books.example.com/> .
+@prefix dc: <http://purl.org/dc/terms/> .
+@prefix md: <http://www.w3.org/1999/xhtml/microdata#> .
+@prefix frbr: <http://purl.org/vocab/frbr/core#> .
+
+<> md:item <works/45U8QJGZSQKDH8N> .
+
+<works/45U8QJGZSQKDH8N> a frbr:Work ;
+ dc:creator "Wil Wheaton"@en ;
+ dc:title "Just a Geek"@en ;
+ frbr:realization (
+ <products/9780596007683.BOOK>
+ <products/9780596802189.EBOOK>
+ ) .
+
+<products/9780596007683.BOOK> a frbr:Expression ;
+ dc:type <product-types/BOOK> .
+
+<products/9780596802189.EBOOK> a frbr:Expression ;
+ dc:type <product-types/EBOOK> .
+-->
+</pre>
+
+<p>The following snippet of HTML has microdata for two people with the same address:</p>
+<pre class="example" data-transform="updateExample">
+<!--
+<p>
+ Both
+ <span itemscope itemtype="http://microformats.org/profile/hcard#" itemref="home">
+ <span itemprop="fn"
+ ><span itemprop="n" itemscope
+ ><span itemprop="given-name">Princeton</span></span></span>
+ </span>
+ and
+ <span itemscope itemtype="http://microformats.org/profile/hcard#" itemref="home">
+ <span itemprop="fn"
+ ><span itemprop="n" itemscope
+ ><span itemprop="given-name">Trekkie</span></span></span>
+ </span>
+ live at
+ <span id="home" itemprop="adr" itemscope>
+ <span itemprop="street-address">Avenue Q</span>.
+ </span>
+</p>
+-->
+</pre>
+
+<p>It generates these triples expressed in Turtle:</p>
+
+<pre class="example" data-transform="updateExample">
+<!--
+@prefix md: <http://www.w3.org/1999/xhtml/microdata#> .
+@prefix hcard: <http://microformats.org/profile/hcard#> .
+
+<> md:item
+ [ a hcard:;
+ hcard:fn "Princeton";
+ hcard:n [ hcard:given-name "Princeton" ];
+ hcard:adr _:a
+ ],
+ [ a hcard:;
+ hcard:fn "Trekkie";
+ hcard:n [ hcard:given-name "Trekkie" ];
+ hcard:adr _:a
+ ] .
+
+_:a hcard:street-address "Avenue Q" .
+-->
+</pre>
+
+</section>
+
+<section class="appendix">
+ <h1>Acknowledgements</h1>
+</section>
+
+</body>
+</html>