From GoodRelations Wiki
Jump to: navigation, search

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:

  1. You typically just have a headline, a body text, and incomplete contact information.
  2. 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=""
     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="" />
<!-- if you know the type of business function (Sell, LeaseOut, Dispose, ProvideService, 
       attach it like this -->
    <div rel="gr:hasBusinessFunction" resource=""></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>
<!-- provide the URI of a deep link to the page -->
    <div rel="foaf:page" resource=""></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>


This validates in the Google Rich Snippet Testing Tool, as you can see:

The list of all supported business functions is here: