There is an HTML5 attribute called datetime
that indicates that a value type is a datetime. But I see no way to indicate whether a itemprop
value i
The Microdata specification only differs between these types of values, which get derived from the HTML5 markup:
itemprop
and an itemscope
attribute)itemprop
is specified on an URL property element like a
, video
etc.)itemprop
is specified on a time
element)meta
elements: the value of the content
attributedata
elements: the value of the value
attributemeter
elements: the value of the value
attributeWhile RDFa allows to specify the datatype with its datatype attribute …
<span property="alive" datatype="xsd:boolean">true</span>
<!-- the value is boolean -->
… Microdata doesn’t offer such an attribute:
<span itemprop="alive">true</span>
<!-- no way to denote that the value is boolean -->
There was the idea to specify the datatype of Microdata properties in the vocabulary registry, but it seems that there was no consensus for this.
Vocabularies could define in their descriptions which values their properties should/must have.
The vocabulary Schema.org expects (and does intentionally not require) specific types. Examples:
free property:
Values expected to be one of these types:
Boolean
The vocabulary vCard (as defined by the WHATWG) requires values types. Examples:
anniversary property:
The value must be a valid date string.
sex property:
The value must be one of
F
, meaning "female",M
, meaning "male",N
, meaning "none or not applicable",O
, meaning "other", orU
, meaning "unknown".
Of course one could use/create a Microdata vocabulary to make such statements about other Microdata vocabularies, similar to RDFS. Schema.org is using RDFa to define their types/properties, and they also use RDFS, but instead of defining a range with rdfs:range (which would mean that all property values are (also) of that type), they made their own property rangeIncludes, which doesn’t allow this inference:
<div typeof="rdf:Property" resource="http://schema.org/free"> <span class="h" property="rdfs:label">free</span> <span property="rdfs:comment">A flag to signal that the publication is accessible for free.</span> <span>Domain: <a property="http://schema.org/domainIncludes" href="http://schema.org/PublicationEvent">PublicationEvent</a></span> <span>Range: <a property="http://schema.org/rangeIncludes" href="http://schema.org/Boolean">Boolean</a></span> </div>