zazuko/ld-didok

Model opening hours properly

ktk opened this issue · 2 comments

ktk commented

After investigation I think the easiest way to model it looks like this:

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix schema: <http://schema.org/> .

<http://example.org/bla>  a schema:LocalBusiness ;
    schema:name "Gene’s Delicious Donuts" ;
    schema:openingHours "Mo,Tu,We,Th,Fr 09:00-17:00" ;
    schema:telephone "555-111-2345" ;

    schema:address [
        schema:addressLocality "Irvine" ;
        schema:addressRegion "CA" ;
        schema:postalCode "92618" ;
        schema:streetAddress "123 Happy Lane" ;
        a schema:PostalAddress
    ] ;

    schema:description "This is your business description." ;
    schema:geo [
        schema:latitude "40.75" ;
        schema:longitude "73.98" ;
        a schema:GeoCoordinates
    ] .

Source: http://www.whitespark.ca/blog/post/62-the-json-ld-markup-guide-to-local-business-schema

So basically the line is simply:

schema:openingHours "Mo,Tu,We,Th,Fr 09:00-17:00" ;

A bit more complex but more Linked Data would be the GoodRelations way, which is documented here here.

Sample from there:

foo:restaurant a gr:Location;
    gr:name "Hepp's Happy Burger Restaurant";
    gr:hasOpeningHoursSpecification 
         [ a gr:OpeningHoursSpecification;
           gr:opens "08:00:00"^^xsd:time;
           gr:closes "20:00:00"^^xsd:time;
           gr:hasOpeningHoursDayOfWeek gr:Monday, gr:Tuesday, gr:Wednesday, 
                                       gr:Thursday, gr:Friday ].

There seems to be a schema.org version of this called OpeningHoursSpecification

In Turtle the example looks like this:

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix schema: <http://schema.org/> .

<http://example.org/blo>
    schema:address [
        schema:addressCountry "Canada" ;
        schema:addressLocality "Sudbury" ;
        schema:addressRegion "ON" ;
        schema:contactType "Mailing address" ;
        schema:postalCode "P3E 2C6" ;
        schema:streetAddress "School of Education - Music Resource Centre Laurentian University" ;
        a schema:PostalAddress
    ] ;
    schema:email "mailto:dscott@laurentian.ca" ;
    schema:name "Music Resource Centre" ;
    schema:openingHoursSpecification [
        schema:closes "17:00:00" ;
        schema:dayOfWeek "http://purl.org/goodrelations/v1#Wednesday" ;
        schema:opens "09:00:00" ;
        a schema:OpeningHoursSpecification
    ], [
        schema:closes "17:00:00" ;
        schema:dayOfWeek "http://purl.org/goodrelations/v1#Friday" ;
        schema:opens "09:00:00" ;
        a schema:OpeningHoursSpecification
    ], [
        schema:closes "17:00:00" ;
        schema:dayOfWeek "http://purl.org/goodrelations/v1#Monday" ;
        schema:opens "09:00:00" ;
        a schema:OpeningHoursSpecification
    ], [
        schema:closes "17:00:00" ;
        schema:dayOfWeek "http://purl.org/goodrelations/v1#Sunday" ;
        schema:opens "09:00:00" ;
        a schema:OpeningHoursSpecification
    ], [
        schema:closes "17:00:00" ;
        schema:dayOfWeek "http://purl.org/goodrelations/v1#Saturday" ;
        schema:opens "09:00:00" ;
        a schema:OpeningHoursSpecification
    ], [
        schema:closes "17:00:00" ;
        schema:dayOfWeek "http://purl.org/goodrelations/v1#Thursday" ;
        schema:opens "09:00:00" ;
        a schema:OpeningHoursSpecification
    ], [
        schema:closes "17:00:00" ;
        schema:dayOfWeek "http://purl.org/goodrelations/v1#Tuesday" ;
        schema:opens "09:00:00" ;
        a schema:OpeningHoursSpecification
    ] ;
    schema:parentOrganization "https://laurentian.concat.ca/eg/opac/library/LUSYS" ;
    a schema:Library .
ktk commented

This is now properly mapped in the new mapping for the shops, see https://github.com/zazuko/ld-didok/blob/master/config/place.ttl#L54