GoodRelations for Classified Ads
| The GoodRelations Cookbook | |
|---|---|
| Recipe | GoodRelations for Classified Ads |
| Description | GoodRelations for offers in unstructured text, as in public classified ads sites |
| Status | mature |
| Level | intermediate |
| Tags | classifieds |
The special challenge when exposing structured data for classified ads are the following:
- You typically just have a headline, a body text, and incomplete contact information.
- The exact identity of the offering party is unknown and often limited to a screen-name or just the phone number.
In GoodRelations, simply put the headline in gr:name, the body text in gr:description and try to parse the phone number and the price so that you can populate the elements in the following example.
<div xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://www.w3.org/1999/xhtml" xmlns:foaf="http://xmlns.com/foaf/0.1/" xmlns:gr="http://purl.org/goodrelations/v1#" xmlns:xsd="http://www.w3.org/2001/XMLSchema#" xml:lang="en" > <!-- The Classified Ad content --> <div about="#offering" typeof="gr:Offering"> <div rev="gr:offers" resource="#user1234"></div> <strong property="gr:name" >Classified ad - headline (e.g. the text in bold)</strong> <div property="gr:description">Here comes the full text of the classified ad .... blablabla</div> <!-- if you have an image, use this pattern --> <img rel="foaf:depiction" src="http://www.heppnetz.de/rdfa4google/image.jpg" /> <!-- if you know the type of business function (Sell, LeaseOut, Dispose, ProvideService, attach it like this --> <div rel="gr:hasBusinessFunction" resource="http://purl.org/goodrelations/v1#Sell"></div> <!-- if you can provide the price in a structured form, use this pattern (needed for Rich Snippets) --> <div rel="gr:hasPriceSpecification"> <div typeof="gr:UnitPriceSpecification"> <div property="gr:hasCurrency" content="USD" datatype="xsd:string"></div> <div property="gr:hasCurrencyValue" content="89" datatype="xsd:float"></div> </div> </div> <!-- provide the URI of a deep link to the page --> <div rel="foaf:page" resource="http://www.heppnetz.de/rdfa4google/tc16.html"></div> </div> <!-- The contact information of the seller - omit fields that you do not have --> <div about="#user1234" typeof="gr:BusinessEntity"> Call <span property="gr:name">Peter Miller</span> at <div property="vcard:tel" content="+1 408 970-6104"></div> </div> </div> </body> </html>
This validates in the Google Rich Snippet Testing Tool, as you can see:
The list of all supported business functions is here:
License:
All text content and source code in the GoodRelations Wiki is available under a Creative Commons Attribution-ShareAlike 3.0 license. Images and other multimedia content in the Wiki may have differing licenses; see the respective meta-data pages for details.
For more information, see http://wiki.goodrelations-vocabulary.org/Licensing.

