GRValidator Implemented E22

Error 22

E22: Check for lacking UnitsOfMeasurement everywhere, exactly one.

Validator Tool: Step # 13

Error Message

The property gr:hasUnitsOfMeasurement must be used exactly once for every instance of gr:QuantitativeValue, gr:TypeAndQuantityNode and every gr:UnitPriceSpecification.

Examples of Wrong Data

@prefix gr: <http://purl.org/goodrelations/v1#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix toy: <http://www.heppnetz.de/ontologies/examples/toy#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
<http://www.heppnetz.de/ontologies/examples/gr> rdf:type owl:Ontology ;
    owl:imports <http://www.heppnetz.de/ontologies/examples/toy> ,
        <http://purl.org/goodrelations/v1> .
<http://www.heppnetz.de/ontologies/examples/gr#Offering_1> a gr:Offering;
        gr:hasBusinessFunction gr:Sell;
        gr:validFrom "2010-11-12T00:00:00+01:00"^^xsd;dateTime;
        gr:validThrough "2010-11-12T23:59:59+01:00"^^xsd;dateTime;
        gr:hasEligibleQuantity <http://www.heppnetz.de/ontologies/examples/gr#QVF_1>;
    gr:hasPriceSpecification <http://www.heppnetz.de/ontologies/examples/gr#UPS_1>.
<http://www.heppnetz.de/ontologies/examples/gr#QVF_1> a gr:QuantitativeValueFloat;
        gr:hasValueFloat "200.0"^^xsd:float.
<http://www.heppnetz.de/ontologies/examples/gr#UPS_1> a gr:UnitPriceSpecification;
        gr:hasCurrency "EUR"^^xsd:string;
    gr:hasCurrencyValue "1.0"^^xsd:float.

SPARQL Query

DEFINE input:inference "http://uriburner.com/inference/rules/goodrelations#"
SELECT ?object
WHERE {
  {
   ?object a gr:QuantitativeValue.
   FILTER (1 != (SELECT COUNT(?UOM) WHERE {?object gr:hasUnitOfMeasurement ?UOM.}))
  } UNION {
   ?object a gr:TypeAndQuantityNode.
   FILTER (1 != (SELECT COUNT(?UOM) WHERE {?object gr:hasUnitOfMeasurement ?UOM.}))
  } UNION {
   ?object a gr:UnitPriceSpecification.
   FILTER (1 != (SELECT COUNT(?UOM) WHERE {?object gr:hasUnitOfMeasurement ?UOM.}))
  }
}