The chemid vocabulary defined at
http://www.axeleratio.com/voc/chemid
can be used to annotate a selected HTML element containing
information on a chemical species. This requires two
markup/annotation steps:
1. Selection of an HTML element. Select the
HTML element of interest and include the two attributes
itemscope and
itemtype into its start tag.
The HTML5 specification does not require a value for
itemscope, but for XML compatibility
you may want to use the assignment
itemscope="itemscope".
The itemtype attribute provides the URL
for the vocabularity—in our case, the chemid vocabulary
link given above.
2. Insertion of child elements. Any vocabulary-defined
property can then be incorporated into the selected element
via child elements, for example, by using the em,
span and code tags. These child
elements are upgraded as microdata by including an
itemprop attribute in their start tag,
the value of which is a valid property from the vocabulary.
|
The following example illustrates the annotation of a text snippet
reporting on some use of the chemical compound dimethyl carbonate.
In addition to the annotation of the compound name itself by
CompName, an acronym, the molecular
formula and the CAS registry number are supplied, specified
via attribute values ShortName,
FormulaSub and
CASRN, respectively.
|
<div itemscope="itemscope"
.....itemtype="http://www.axeleratio.com/voc/chemid">
..As reaction medium we are employing a green solvent:
..<em itemprop="CompName">dimethyl carbonate</em>
..(<span itemprop="ShortName">DMC</span>,
...<code itemprop="FormulaSub">
.....C<sub>3</sub>H<sub>6</sub>O<sub>3</sub>
...</code>,
...<span itemprop="CASRN">616-38-6</span>).
..Notice that this reagent has a flash point in
..the room temperature range.
</div>
|
The W3C Markup Validator at
http://validator.w3.org/
may report errors while evaluating HTML5 pages with microdata
markup: for various element types, the validator does not accept
the itemprop attribute “at
this point.” We experienced good validation performances
with the (X)HTML5 Validator at
http://html5.validator.nu/.
|