From c58e1d1d40e4be6df2aaaa4675bda311434b6d47 Mon Sep 17 00:00:00 2001 From: Gregg Kellogg Date: Mon, 13 Nov 2017 17:33:28 -0800 Subject: [PATCH] Update RDFa algorithm to reflect Ruby Microdata to RDF implementation. --- index.html | 60 +++++++++++++++++++++++++++++------------------------- 1 file changed, 32 insertions(+), 28 deletions(-) diff --git a/index.html b/index.html index 09efbe9..e429ff9 100644 --- a/index.html +++ b/index.html @@ -1661,37 +1661,41 @@

RDFa

The algorithm to convert a Microdata item to RDFa is as follows:

    -
  1. Replace the itemscope attribute with a vocab attribute, - whose value is the vocabulary identifier for the item.
  2. -
  3. Let local type be the difference between the vocabulary identifier and the first - value of itemtype. Replace the itemtype attribute with a typeof attribute - whose value is local type.
  4. -
  5. If splitting the value on spaces for the itemtype attribute - results in more than one value, - then for each value extra type of itemtype after the first, - add an empty span child element to the element that represents the item, - with the attribute rel="rdf:type" - and a resource attribute whose value is extra type.
  6. -
  7. Change each itemprop attribute to a property attribute with the same value
  8. -
  9. Change each itemid attribute to an about attribute with the same value
  10. -
  11. For the value of each itemref attribute, for each value reference - that is a result of splitting the value on spaces follow the following substeps: +
  12. For each element having an itemscope attribute:
      -
    1. Add an element as the immediate parent of the element with id reference, - with a vocab attribute whose value is the vocabulary identifier for the item. -

      The choice of element is left to the author, to provide sufficient flexibility - to avoid unwanted changes in the rendering of the content.

      +
    2. Replace the itemscope attribute with a vocab attribute, whose value is the vocabulary identifier for the item.
    3. +
    4. Replace any itemtype attribute with a typeof attribute whose value is taken from the values of itemtype where each type is made relative to vocabulary identifier, ensuring that the element has a typeof attribute with at least an empty value..
    5. -
    6. If the element with id reference has no resource attribute, - add a resource attribute whose value is a NUMBER SIGN U+0023 followed by reference - to the element.
    7. -
    8. If the element with id reference has no typeof attribute, - add a typeof="rdfa:Pattern" attribute to the element.
    9. -
    10. Add a link child element to the element that represents the item, - with a rel="rdfa:copy" attribute and an href attribute - whose value is a NUMBER SIGN U+0023 followed by reference
    11. +
    12. Replace any itemid attribute with a + resource attribute having the same value.
    13. +
    14. Otherwise, ensure that element has a typeof + attribute with at least an empty value.
    15. +
    +
  13. +
  14. For each object element having both an + itemprop and a data attribute, change + the data attribute to a + resource attribute with the same value
  15. +
  16. Change each itemprop attribute to a property attribute with the same value
  17. +
  18. For each element having an itemref attribute: +
      +
    1. Set item vocab to the first value of the + vocab attribute taken from the element and its + ansestors.
    2. +
    3. For each value reference + that is a result of splitting the value on spaces follow the following substeps: +
        +
      1. Add an element as the immediate parent of the element with id reference, + with a vocab attribute whose value is item vocab, and a typeof attribute with rel="rdfa:Pattern" attribute. +

        The choice of element is left to the author, to provide sufficient flexibility + to avoid unwanted changes in the rendering of the content.

        +
      2. +
      3. Add a link child element to the element that represents the item, + with a rel="rdfa:copy" attribute and an href attribute + whose value is a NUMBER SIGN U+0023 followed by reference
      4. +
      +

      And then remove the itemref attribute.

    -

    And then remove the itemref attribute.

There is significant scope for optimising this algorithm, which may result in redundant vocab