GoodRelations is a standardized vocabulary for product, price, and company data that can (1) be embedded into existing static and dynamic Web pages and that (2) can be processed by other computers. This increases the visibility of your products and services in the latest generation of search engines, recommender systems, and other novel applications.
Martin Hepp
martin.hepp at ebusiness-unibw.org
Fri Nov 4 09:15:00 CET 2011
Dear all: I was recently asked on how to model quantities of goods in GoodRelations, e.g. "10 g of salt" or "1 liter of Bordeaux red wine". There are two different ways of modeling this, and both are supported by GoodRelations: 1. You can say that you offer exactly 10g of salt or 1 l of red wine, but maybe accept this offer multiple times. 2. You can say that you offer salt or red wine and that the price is USD 1 / 10 g or 1 l. In case 1, you model the quantity *to which the offer refers* using TypeAndQuantityNode in combination with gr:SomeItems In case 2, you model it using gr:hasUnitOfMeasurement on the gr:UnitPriceSpecification. Approach 2 does work only if the price is related to a standard unit (C62, INH, LTR, GRM, ...). So you can say that the price is 1 USD / liter (unit code: LTR), but this way, you cannot say that it is 1 USD / 10 gram. If you want to say something like USD1 / 10 g, you must - create a gr:SomeItems node representing some salt (or any other type of good), - add this to a gr:Offering with gr:includesObject and a gr:TypeAndQuantityNode with 10 g as the quantity - set the price to 1 USD per 1 C62 of this offer (because one piece of this gr:SomeItems instance means 10 g). Examples in Turtle syntax: # 1 l of Bordeaux red wine for 1 USD/liter foo:offer a gr:Offering; gr:hasBusinessFunction gr:Sell; gr:includesObject [ a gr:TypeAndQuantityNode; gr:amountOfThisGood "1"^^xsd:float; gr:hasUnitOfMeasurement "C62"^^xsd:string; gr:typeOfGood foo:redwine ]; gr:hasPriceSpecification [ a gr:UnitPriceSpecification; gr:hasCurrency "USD"^^xsd:string; gr:hasCurrencyValue "1.00"^^xsd:float; gr:validThrough "2012-12-31T23:59:59Z"^^xsd:dateTime; gr:hasUnitOfMeasurement "LTR"^^xsd:string ]. # This represents an arbitrary amount of red wine: foo:redwine a gr:SomeItems, <http://www.productontology.org/id/Bordeaux_wine>; gr:name "ACME Bordeaux Red Wine - dry and tasty"@en. # Table salt for 1 USD / 10 g foo:offer a gr:Offering; gr:hasBusinessFunction gr:Sell; gr:includesObject [ a gr:TypeAndQuantityNode; gr:amountOfThisGood "10"^^xsd:float; gr:hasUnitOfMeasurement "GRM"^^xsd:string; gr:typeOfGood foo:salt ]; gr:hasPriceSpecification [ a gr:UnitPriceSpecification; gr:hasCurrency "USD"^^xsd:string; gr:hasCurrencyValue "1.00"^^xsd:float; gr:validThrough "2012-12-31T23:59:59Z"^^xsd:dateTime; gr:hasUnitOfMeasurement "C62"^^xsd:string ]. # This represents an arbitrary amount of table salt: foo:redwine a gr:SomeItems, <http://www.productontology.org/id/Salt>; gr:name "ACME Table Salt - clear and salty"@en. Note: You can convert those to others syntaxes with - http://rdf-translator.appspot.com/ - http://www.ebusiness-unibw.org/tools/rdf2rdfa/ - http://www.ebusiness-unibw.org/tools/rdf2microdata/ (experimental) Best wishes Martin Hepp