GRValidator Implemented W1

Warning 1

W1: Warn if list price is lower than non-list price.

Validator Tool: Step # 14

WarningMessage

If the type price is SRP, all currency values in other unit price specifications with the same currency must be greater or equal, i.e the one which is SRP must be the lowest.

Potential Problem

Offerings can include more than one Unit Price Specification. A unit price specification helps to describe price type, valid dates (from - throught), and unit of measurements. Care must be taken when one type price is SRP since it means that all currency values in all other unit price specifications with the same currency must be greater or equal, i.e the one which is SRP must be the lowest.

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> rdf:type gr:Offering .
<http://www.heppnetz.de/ontologies/examples/gr#UnitPriceSpecification_1> rdf:type gr:UnitPriceSpecification ;
    gr:priceType "SRP"^^<http://www.w3.org/2001/XMLSchema#string> ;
    gr:hasCurrency "COP"^^<http://www.w3.org/2001/XMLSchema#string> ;
    gr:hasCurrencyValue "550.0"^^<http://www.w3.org/2001/XMLSchema#float> .
<http://www.heppnetz.de/ontologies/examples/gr#Offering_1> gr:hasPriceSpecification
<http://www.heppnetz.de/ontologies/examples/gr#UnitPriceSpecification_1> .
<http://www.heppnetz.de/ontologies/examples/gr#UnitPriceSpecification_2> rdf:type gr:UnitPriceSpecification ;
    gr:hasCurrency "COP"^^<http://www.w3.org/2001/XMLSchema#string> ;
    gr:hasCurrencyValue "450.0"^^<http://www.w3.org/2001/XMLSchema#float> .
<http://www.heppnetz.de/ontologies/examples/gr#Offering_1> gr:hasPriceSpecification
<http://www.heppnetz.de/ontologies/examples/gr#UnitPriceSpecification_2> .
<http://www.heppnetz.de/ontologies/examples/gr#DeliveryChargeSpecification_1> rdf:type gr:DeliveryChargeSpecification ;
    gr:hasMinCurrencyValue "100.0"^^<http://www.w3.org/2001/XMLSchema#float> ;
    gr:hasMaxCurrencyValue "400.0"^^<http://www.w3.org/2001/XMLSchema#float> .
<http://www.heppnetz.de/ontologies/examples/gr#Offering_1> gr:hasPriceSpecification
<http://www.heppnetz.de/ontologies/examples/gr#DeliveryChargeSpecification_1> .

SPARQL Query

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

#domain: UnitPriceSpecification, dataProperties: priceType, range: String

SELECT DISTINCT ?offering
WHERE {
  {
    #PriceSpecification
    #Get priceType, curency, and
    ?offering gr:hasPriceSpecification ?priceSpec .
    ?priceSpec a gr:UnitPriceSpecification .
    ?priceSpec gr:priceType ?priceType . #interesting only when it is present!!!
    ?priceSpec gr:hasCurrency ?currency . #mandatory
    ?priceSpec gr:hasCurrencyValue ?value . #(0..1)
    # Get data for each ?offering again
    ?offering gr:hasPriceSpecification ?priceSpec1 .
    ?priceSpec1 a gr:UnitPriceSpecification .
    ?priceSpec1 gr:hasCurrency ?currency1 . #mandatory
    ?priceSpec1 gr:hasCurrencyValue ?value1 . #(0..1)
    # Filter same priceSpec (no sense to compare to itself)
    FILTER ( ?priceSpec != ?priceSpec1 )
    # Test: priceType is present with the value "SRP"
    # --> all other UPS with the same hasCurrency must have a hasCurrencyValue greater or equal
    # (value1 >= value) OK, then check (value1 < value), i.e. (value > value1)
    FILTER (
      ( regex(str(?priceType), "^SRP$", "i") )
      && ( str(?currency) = str(?currency1) )
      && ( ?value > ?value1  )
    )
  }
}
 ORDER BY ?offering