Documentation/Product features

From GoodRelations Wiki
Jump to: navigation, search

Product Features

Work in progress: This page is an incomplete draft. Please help to improve it by addressing the issues from the discussion page and remove this template when finished.


Originally, GoodRelations was designed to be used in combination with an additional ontology for product types and their properties, like

Those vocabularies provide very precise terms for modeling product types and their features based on specializations of

This pattern is ideal for consuming e-commerce data, since one can easily harmonize different units of measurement or define mappings between product features. However, it turned out that for publishing product features from shop sites and manufacturer data sheets, it is often too much of a burden to map the available product data into a standardized products or services ontology and its types and properties.

Also, when using the 300,000 types from, there are often no adequate product property definitions available.

Hence, GoodRelations from release 2012-08-01 onwards supports a novel pattern based on

that allows publishing arbitrary property-value pairs for product features.

With that feature, a shop owner could easily mark-up product feature tables and preserve as much data and as much data structure and other meta-data as possible without the need to cleanse and lift the data before publishing it. That will be left to the consuming client.

A consumer of GoodRelations data should try to lift instances of gr:ProductFeature and gr:Feature to the original, richer structures of GoodRelations.

This new pattern follows the GoodRelations design principles of

Publishing Property-Value Pairs with gr:ProductFeature and gr:feature

Assume we have the following information

  • Product name: ACME Electric Anvil
  • Features:
    • Power supply: 110-220 Volts
    • Weight: 2.25 lb.
    • Safety belt: yes

This could be modeled as follows:

Microdata Syntax in the Namespace

<div itemscope itemtype="" itemid="#model">
  <span itemprop="name">ACME Electric Anvil</span>
  <div itemprop="feature" itemscope
      <span itemprop="propertyName">Power supply</span>:
      <span itemprop="propertyValue">110-220</span>
      <span itemprop="unitText">Volts</span>
  <div itemprop="feature" itemscope
      <span itemprop="propertyName">Weight</span>:
      <span itemprop="propertyValue">2.25</span>
      <span itemprop="unitText">kg</span>
  <div itemprop="feature" itemscope
      <span itemprop="propertyName">Safety belt</span>:
      <span itemprop="propertyValue">yes</span>

If we know the proper UN/CEFACT Unit Codes for the units of measurement, like

  • VLT for volt and
  • KGM for kilogram,

then we should use the unitCode property of (or the gr:hasUnitOfMeasurement property when in the GoodRelations namespace) instead of unitText:

  <div itemprop="feature" itemscope
      <span itemprop="propertyName">Weight</span>:
      <span itemprop="propertyValue">2.25</span>
      <meta itemprop="unitCode" content="KGM">kg

Turtle Syntax in the Namespace

In Turtle syntax (e.g. as a result from crawling and parsing), this will look as follows:

<#model> a schema:Product ;
    schema:name "ACME Electric Anvil" ;
    schema:feature [ a schema:ProductFeature ;
                       schema:propertyName "Power supply" ;
                       schema:propertyValue "110-220" ;
                       schema:unitText "Volts" ] ;
    schema:feature [ a schema:ProductFeature ;
                       schema:propertyName "Weight" ;
                       schema:propertyValue "2.25" ;
                       schema:unitText "kg" ] ;
    schema:feature [ a schema:ProductFeature ;
                       schema:propertyName "Safety belt" ;
                       schema:propertyValue "yes" ] .

Lifting gr:ProductFeature for Consumption

We have seen that the gr:ProductFeature / gr:feature combo simplifies the publication of product features. However, the resulting data will not match against queries for the main GoodRelations meta-model. Hence, a client that crawls Web data, in particular RDFa and microdata markup, should try to lift and augment respective property-value pairs.

For instance, we could try to find a matching product feature in a GoodRelations compatible products ontology. For weight, we may use schema:weight directly. For power supply, we assume foo:operating_voltage and for safety belt, we assume foo:belt for the sake of this example.

The target data would then look as follows:

<#model> a schema:Product ;
    schema:name "ACME Electric Anvil" ;
    foo:operating_voltage [ a schema:QuantitativeValue ;
                            schema:unitCode "VLT" ;
                            schema:minValue 110 ;
                            schema:maxValue 220 ] ;
    schema:weight         [ a schema:QuantitativeValue ;
                            schema:unitCode "KGM" ;
                            schema:value 2.25 ] ;
    foo:belt True .


See also Documentation/Structured_values_and_value_references. TBC