[uf-discuss] How about adding aRecipe, an RDFa serialization of hRecipe?

Toby A Inkster mail at tobyinkster.co.uk
Fri Oct 10 01:33:56 PDT 2008


Hi Thomas,

There is already a reasonably good RDF recipe schema:
http://donnafales.com/2002/07/28/recipe-schema#

If you want to map hRecipe to RDFa, then the best technique would be  
to use a combination of the schema above, plus Dublin Core (for  
authorship) and then create your own vocabulary only to fill in the  
gaps which the combination of the two more established vocabularies  
couldn't cover. That would be similar to what Manu has done for his  
RDFa mapping of hAudio.

For what it's worth, I've already performed a mapping of hRecipe to  
RDF. (This is basically the way my parser, Cognition, works. All  
microformats are converted into RDF, and then RDF is converted to,  
for example, vCard or JSON or whatever. Thus, when I added support  
for hRecipe, I had to map it to RDF as part of that process.) The  
mapping I've used is:

hrecipe =>
   http://donnafales.com/2002/07/28/recipe-schema#Recipe

recipe-title =>
   http://purl.org/dc/terms/title

recipe-summary =>
   http://purl.org/dc/terms/abstract

author =>
   http://purl.org/dc/terms/creator

published =>
   http://purl.org/dc/terms/issued

photo =>
   http://purl.org/media#depiction

ingredient =>
   http://donnafales.com/2002/07/28/recipe-schema#ingredient

method =>
   http://donnafales.com/2002/07/28/recipe-schema#directions

yield =>
   http://donnafales.com/2002/07/28/recipe-schema#x-yield
   (Namespace squatting a bit here.)

preparation-time =>
   http://donnafales.com/2002/07/28/recipe-schema#x-preparation-time
   (Ditto.)

category =>
   http://www.holygoat.co.uk/owl/redwood/0.1/tags/taggedWithTag

Within ingredients, I also map:

quantity =>
   http://buzzword.org.uk/rdf/measure#quantity

item =>
   http://www.w3.org/1999/02/22-rdf-syntax-ns#value

note =>
   http://purl.org/dc/terms/abstract

optional =>
   http://purl.org/dc/terms/abstract

How might all this be used in RDFa? Well, here's an example:

<div xmlns:r="http://donnafales.com/2002/07/28/recipe-schema#"
      xmlns:dc="http://purl.org/dc/terms/"
      xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
      xmlns:m="http://buzzword.org.uk/measure#"
      typeof="r:Recipe">

   <h1 property="dc:title">Mince and Dumplings</h1>
   <div property="dc:creator">Toby Inkster</div>

   <h2>Ingredients</h2>

   <h3>For the mince</h3>

   <ul rel="r:ingredient">
     <li typeof="r:Ingredient">
       <span property="m:quantity">400 g</span>
       <span property="rdf:value">minced beed</span>
     </li>
     <li typeof="r:Ingredient">
       <span property="m:quantity">1</span>
       <span property="rdf:value">carrot</span>,
       <span property="dc:abstract">chopped</span>
     </li>
     <li typeof="r:Ingredient">
       <span property="m:quantity">1</span>
       <span property="rdf:value">onion</span>,
       <span property="dc:abstract">chopped</span>
     </li>
     <li typeof="r:Ingredient">
       <span property="m:quantity">60 g</span>
       <span property="rdf:value">peas</span>,
       <span property="dc:abstract">shelled (frozen are OK)</span>
     </li>
     <li typeof="r:Ingredient">
       <span property="m:quantity">500 mL</span>
       <span property="rdf:value">ale</span>
     </li>
     <li typeof="r:Ingredient">
       <span property="m:quantity">2 tbsp</span>
       <span property="rdf:value">tomato puree</span>
     </li>
     <li typeof="r:Ingredient">
       <span property="rdf:value">worcestershire sauce</span>
       <span property="dc:abstract">to taste</span>
     </li>
     <li typeof="r:Ingredient">
       <span property="rdf:value">sage</span>
     </li>
     <li typeof="r:Ingredient">
       <span property="rdf:value">butter</span>
     </li>
   </ul>

   <h3>For the dumplings</h3>
   <ul rel="r:ingredient">
     <li typeof="r:Ingredient">
       <span property="m:quantity">75 g</span>
       <span property="rdf:value">shredded suet</span>
     </li>
     <li typeof="r:Ingredient">
       <span property="m:quantity">150 g</span>
       <span property="rdf:value">self-raising flour</span>
     </li>
   </ul>

   <div property="r:directions">
     <ol>
       <li>Preheat the oven to 190ûC.</li>
       <li>In a casserole dish, fry the onion gently
       with a little butter.</li>
       <li>Brown the beef in the dish.</li>
       <li>Mix in the other mince ingredients.</li>
       <li>Bake for 45 minutes, covered.</li>
       <li>While the mince is baking, prepare a
       dough from the suet, flour and a little
       water.</li>
       <li>Divide the dough into eight balls.</li>
       <li>After the mince has been baking for
       45 minutes, add the dumplings to the dish.
       They should float like icebergs, partly
       poking out of the mince.</li>
       <li>Return to the oven for another 35
       minutes - covered for 20 minutes and
       uncovered for the last 15.</li>
     </ol>
   </div>

   <p>
     <span property="r:x-preparation-time"
       >Preparation: 10 minutes</span>;
     <span property="r:x-preparation-time"
       >Cooking: 90 minutes</span>.
   </p>

</div>

-- 
Toby A Inkster
<mailto:mail at tobyinkster.co.uk>
<http://tobyinkster.co.uk>






More information about the microformats-discuss mailing list