W3C home > Mailing lists > Public > public-vocabs@w3.org > November 2011

Modeling quantities of goods in GoodRelations

From: Martin Hepp <martin.hepp@ebusiness-unibw.org>
Date: Fri, 4 Nov 2011 09:15:00 +0100
Cc: "public-vocabs@w3.org Vocabularies" <public-vocabs@w3.org>
Message-Id: <7F0CA78E-F807-4426-8F96-5ADC9ED2ADE4@ebusiness-unibw.org>
To: goodrelations-list <goodrelations@ebusiness-unibw.org>
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
Received on Friday, 4 November 2011 08:15:34 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 22 May 2012 06:48:57 GMT