Documentation/Product variants

From GoodRelations Wiki
Jump to: navigation, search

Product Variants

A variant is a specialization of a product model and inherits all of is product properties, unless they are defined locally. This allows a very compact modeling of product models that vary only in a few properties.

Example: First, we define the base model for a family of laptops:
foo:MacBook a gr:ProductOrServiceModel, pto:Laptop ;
    gr:name "Macbook Pro"@en ;
    foo:operatingVoltage
        [ a gr:QuantitativeValue ;
          gr:hasMinValue "110"^^xsd:float ;
          gr:hasMaxValue "220"^^xsd:float ;
          gr:hasUnitOfMeasurement "VLT"^^xsd:string ] ;
    foo:noOfUSBPorts
        [ a gr:QuantitativeValue ;
          gr:hasValue "2"^^xsd:int ;
          gr:hasUnitOfMeasurement "C62"^^xsd:string ] .

Then we define two variants, namely a 13 inch model:

foo:MacBook13Inch a gr:ProductOrServiceModel, pto:Laptop ;
    gr:name "MacBook Pro 13 Inch"@en;
    gr:isVariantOf foo:MacBook ;
    foo:screenSize
        [ a gr:QuantitativeValue ;
          gr:hasValue "13"^^xsd:float ;
          gr:hasUnitOfMeasurement "INH"^^xsd:string ] .

and a 15 inch model, which also has four instead of two USB ports

foo:MacBook15Inch a gr:ProductOrServiceModel, pto:Laptop ;
    gr:name "MacBook Pro 15 Inch with 4 USB Ports"@en;
    gr:isVariantOf foo:MacBook ;
    foo:screenSize
        [ a gr:QuantitativeValue ;
          gr:hasValue "15"^^xsd:float ;
          gr:hasUnitOfMeasurement "INH"^^xsd:string ] ;
    foo:noOfUSBPorts
        [ a gr:QuantitativeValue ;
          gr:hasValue "4"^^xsd:int ;
          gr:hasUnitOfMeasurement "C62"^^xsd:string ] .

By means of the specific inference rules from

http://wiki.goodrelations-vocabulary.org/Axioms#Product_Variants

this results in the following augmented product models for the 13 inch and the 15 inch model: 13 inch model:

foo:MacBook13Inch a gr:ProductOrServiceModel, pto:Laptop ;
    gr:name "MacBook Pro 13 Inch"@en;
    gr:isVariantOf foo:MacBook ;
    foo:operatingVoltage
        [ a gr:QuantitativeValue ;
          gr:hasMinValue "110"^^xsd:float ;
          gr:hasMaxValue "220"^^xsd:float ;
          gr:hasUnitOfMeasurement "VLT"^^xsd:string ] ;
    foo:noOfUSBPorts
        [ a gr:QuantitativeValue ;
          gr:hasValue "2"^^xsd:int ;
          gr:hasUnitOfMeasurement "C62"^^xsd:string ] ;
    foo:screenSize
        [ a gr:QuantitativeValue ;
          gr:hasValue "13"^^xsd:float ;
          gr:hasUnitOfMeasurement "INH"^^xsd:string ] .

15 inch model:

foo:MacBook15Inch a gr:ProductOrServiceModel, pto:Laptop ;
    gr:name "MacBook Pro 15 Inch with 4 USB Ports"@en;
    gr:isVariantOf foo:MacBook ;
    foo:operatingVoltage
        [ a gr:QuantitativeValue ;
          gr:hasMinValue "110"^^xsd:float ;
          gr:hasMaxValue "220"^^xsd:float ;
          gr:hasUnitOfMeasurement "VLT"^^xsd:string ] ;
    foo:screenSize
        [ a gr:QuantitativeValue ;
          gr:hasValue "15"^^xsd:float ;
          gr:hasUnitOfMeasurement "INH"^^xsd:string ] ;
    foo:noOfUSBPorts
        [ a gr:QuantitativeValue ;
          gr:hasValue "4"^^xsd:int ;
          gr:hasUnitOfMeasurement "C62"^^xsd:string ] .

So foo:MacBookPro13Inch inherits the operating voltage and the number of USB ports from the base model, while foo:MacBook15Inch inherits only the operating voltage but not the number of USB ports, since the latter are overridden locally.