GRValidator Implemented E9

Error 9

E9: Check that the opening hour is earlier than the closing hour.

Validator Tool: Step # 11

Error Message

Invalid validity interval for opening hours (gr:opens and gr:closes make no sense).

Potential Problem

One business entity (gr:BusinessEntity) can include provision locations with more than one opening hour specification. Opening hour specifications can include open-close intervals using the gr:opens - gr:closes properties. Care must be taken that for all open-close ranges in opening hour specifications gr:opens is less or equal than gr:closes.

Examples of Wrong Data

@prefix foo: <http://www.example.com/#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix vcard: <http://www.w3.org/2006/vcard/ns#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix gr: <http://purl.org/goodrelations/v1#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
foo:myCompany rdf:type gr:BusinessEntity ;
    gr:legalName "Hepp's Bagel Bakery Ltd. "^^<http://www.w3.org/2001/XMLSchema#string> ;
    vcard:fn "Hepp's Bagel Bakery Ltd. "@en .
foo:myShop rdf:type gr:LocationOfSalesOrServiceProvisioning ;
    vcard:adr foo:address ;
    vcard:tel "+49-89-6004-4217"^^<http://www.w3.org/2001/XMLSchema#string> .
foo:Monday rdf:type gr:OpeningHoursSpecification ;
    gr:opens "18:00:00"^^<http://www.w3.org/2001/XMLSchema#time> ;
    gr:closes "08:00:00"^^<http://www.w3.org/2001/XMLSchema#time> ;
    gr:hasOpeningHoursDayOfWeek gr:Monday .
foo:myShop gr:hasOpeningHourSpecification foo:Monday .
foo:myCompany gr:hasPOS foo:myShop ;
    rdfs:seeAlso <http://www.example.com/> .
foo:address rdf:type vcard:Address ;
    vcard:country-name "Germany"@en ;
    vcard:locality "Neubiberg"@en ;
    vcard:postal-code "85577"^^<http://www.w3.org/2001/XMLSchema#string> ;
    vcard:region "Bavaria"@en ;
    vcard:street-address "1234 Hepp Road"@en .
foo:myCompany vcard:adr foo:address ;
    vcard:tel "+49-89-6004-0"^^<http://www.w3.org/2001/XMLSchema#string> ;
    vcard:url <http://www.example.com/> .

SPARQL Query

PREFIX gr:<http://purl.org/goodrelations/v1#>

SELECT ?o
WHERE {
  ?o a gr:OpeningHoursSpecification .
  ?o gr:opens ?from .
  ?o gr:closes ?through .
  FILTER (str(?from) > str(?through))
}