Baking a topic map (err, I mean bread)

Benjamin Bock asked last week about how to topic map ingredients (and the measures of) as well as the order of steps in a recipe.

I can’t give you a complete answer in one post (or even in several) but I can highlight some of the issues and possible solutions.

First, we need a recipe. I will be using the basic bread recipe, from the Artisan Bread in 5 Minutes a Day site, which lists the following ingredients:

  • 3 1/2 cups lukewarm water
  • 4 teaspoons active dry yeast
  • 4 teaspoons coarse salt
  • 7 1/4 cups (2 lb. 4 oz.; 1027.67 grams) unbleached all-purpose flour (measure using scoop and sweep method)

That’s right. Carol has been teaching me to cook and I really enjoy baking bread.

If it is a good day, call ahead and I am likely to have fresh bread out of the oven within minutes of your arrival.

Anyway, at first blush, this looks easy, after all , people have been passing recipes along for thousands of years.

Second look, not so easy.

First try at baking the topic map

The recipe itself has a name, Master Artisan Bread Recipe.

That looks like a promising place to start, we have a recipe, it has a name and from what we read above, some ingredients.

We could simply create a topic for the recipe, record its name and include the ingredients as occurrences, of type ingredient.

After all, since we can search for strings across the topic map, it won’t be hard to find recipes with yeast, flour, etc., whatever ingredient we want.

And that would be a perfectly valid topic map.

Well, except that you or I may want to say something about the yeast, as a subject. Could be which brand to use, etc.

Could simply stuff that information into the occurrence but topic maps have a better solution.

Second try at baking the topic map

Isn’t there a hint in the way we have passed recipes down for years about how we should represent them in a topic map?

That is each ingredient, more or less, stands on its own. We can talk about each one and often measure them all out before starting.

What if we represented each ingredient as a subject, that is with a topic?

And we represent their relationships to the recipe, remember Master Artisan Bread Recipe?, with an ingredient_of association. (Stolen shamelessly from Sam Hunting’s chapter, How to Start Topic Mapping Right Away with the XTM Specification, in XML Topic Maps, ed. by Jack Park and Sam Hunting.)

Oh, err, one thing, how do I get from 3 1/2 cups lukewarm water from water as a subject in an ingredient_of association?

That wasn’t explained very well. ;-)

Third try at baking the topic map

Err, hmmm, yes (stalling for time),

Well, let’s break the water subject out and see if we can establish some principles for a solution that works for the other ingredients.

The measurement, 3 1/2 cups and the temperature, lukewarm, do not affect the subject identity of the water, but the first establishes a particular/specific, set aside amount of water and lukewarm, defines a temperature for that set aside portion.

At its core the problem is that we would prefer to talk about water as an ingredient and to not have to use 3 1/2 cups as part of its identity.

That is, how would your topic map look with an ingredient_of association between a recipe and 3 1/2 cups of water?

Would your 3 1/2 cups of water only merge with other 3 1/2 cups of water topics in other recipes?

That sounds like a bad plan.

Fourth try at baking the topic map

Let’s think about this for a moment.

We want ingredient as subject so we can say things about them. We also want to record the amount or some condition of an ingredient as part of the recipe.

One work around, not necessarily a good one (discussion please!) would be to model the recipe – ingredient association as a three role relationship:

  • recipe
  • ingredient
  • measure_condition

That breaks out the measurement or condition of the ingredient as a separate subject. It also dodges some fairly complicated issues with regard to measurement but those are probably not critical to a bread recipe anyway.

Oh, sorry, did not mean to avoid answering Benjamin’s question about ordering steps in the recipe.

Did you know that when practicing my typing in grade school I duplicated my mother’s recipes and then discarded the originals?

I also left off the steps then. Had the amounts and ingredients, but no steps. ;-)

She took it good naturedly enough but declined my further help where the recipe box was concerned.

I promise I won’t repeat that error but I won’t reach the step question today.

Besides, interested to hear what you think about the recipe illustration so far?

Understand that I need to include syntax but thought I would do that in the next post, before I get to the steps question.

2 Responses to “Baking a topic map (err, I mean bread)”

  1. Dear Patrick,

    I think I’ll go with treat mesaure_condition as occurrence of the reification of recipe-ingredient association.

    But… I’ve a recipe book in Topic Maps (http://gilgamesh.unipv.it/ricettario/) and I don’t use this solution :-) (Not only because Topincs doesn’t support reification).

    The problem is: what are the functional requirements?

    Do you browse all ingredients? Do you want to know which recipes need salt or do you wanna know only recipes that have salt as main ingredient?

    So for my personal use I prefer to have a generic occurence ingredients and a specific association recipe – main ingredients…

    Probably isn’t the perfect solution (my vow goes to reification) but works for me

  2. Patrick Durusau says:

    Salvatore,

    Thanks for the pointer! I will have to tell my wife. We went to Rome a couple of times and she really likes Italian cooking.

    Err, functional requirements?

    Well, my god-son is gluten intolerant (to the point of severe illness from tiny amounts) so if a recipe calls for “flour,” I need to know if it has to be wheat “flour” or can it be rice “flour,” etc.

    There are several different kinds of flour.

    Or take the peanut butter recipe I found that has no flour at all! His father started to correct him at a party at our house because he had a handful of cookies, only to be told (laughing) that the cookies had no flour.

    That last one is the absence of an ingredient but I don’t know of any reason why absence of a property should not be an identity condition.