Re: Proposal to extend rangeIncludes of DataTypes predicates in schema.org

> On Nov 13, 2014, at 6:30 AM, martin.hepp@ebusiness-unibw.org wrote:
> 
> On 10 Nov 2014, at 16:54, Gregg Kellogg <gregg@greggkellogg.com> wrote:
> 
>>> 2. It may also be that you want to encourage Web sites to add XSD datatype information to schema.org properties. This will not work, IMO, because
>>> a) this is impossible in Microdata syntax (no datatype at instance level)
>> 
>> Not entirely true, a conforming Microdata to RDF processor will output a matching @datetime or element content value for a <time> element as a typed literal using the matching xsd datatype. What Google does, however, may be different.
>> 
>> Gregg
>> 
> 
> Yes, <time> is a special case. But also note the complexity of that special case: https://wiki.whatwg.org/wiki/Time_element. Not sure whether there is a 1:1 match to xsd datatypes.

The Microdata to RDF note does require matching against xsd:date, xsd:time, xsd:dateTime, xsd:gYearMonth, xsd:gYear or xsd:duration to generate a datatyped literal [1].

My own reasoner [2], used for the Linter, uses the following regular expression to match plain literals having a range of schema:Date:


   ISO_8601 =  %r(^
      # Year
      ([\+-]?\d{4}(?!\d{2}\b))
      # Month
      ((-?)((0[1-9]|1[0-2])
            (\3([12]\d|0[1-9]|3[01]))?
          | W([0-4]\d|5[0-2])(-?[1-7])?
          | (00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))
          ([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24\:?00)
                 ([\.,]\d+(?!:))?)?
                (\17[0-5]\d([\.,]\d+)?)?
                ([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?
          )?
      )?
    $)x.freeze

(Not perfect, and not very pretty, and definitely not for the feint of heart!)

The real complexities of date formats are properly document in XKCD [3] :)

> Martin
> 

Gregg

[1] http://www.w3.org/TR/microdata-rdf/#dfn-property-value
[2] https://github.com/ruby-rdf/rdf-reasoner/blob/develop/lib/rdf/reasoner/schema.rb#L96
[3] http://xkcd.com/1179/

Received on Thursday, 13 November 2014 19:02:45 UTC