diff --git a/dr.syntax/README.md b/dr.syntax/README.md index 515b53e..64f2ada 100644 --- a/dr.syntax/README.md +++ b/dr.syntax/README.md @@ -9,64 +9,159 @@ Dr. Syntax (in America known as Syntax, M.D.) is an object model, and file layout for representing recipes, ingredients, and shopping lists. +Examples are shown in JSON format, and the `nosebag` project will continue to +use JSON, but Dr. Syntax is format agnostic as long as the object can be +serialised and deserialised intact. + ## Object model -### Recipes - -Each recipe is represented as a core object and optional additional media. -The central properties of each recipe are two lists: - -* recipe ingredients, which: - * reference an ingredient by name (which may not exist, - in which case it is treated as if an ingredient of that name exists - with no other defined properties) - * have an optional quantity which are either a naked - positive number, meaning an amount without unit, or contain: - * an amount - * a unit - * optional notes that provide advice on how to modify the amount - required (such as "more if they are small") - * an optional property of 'optional', meaning that the ingredient can be - omitted - * an optional prep instruction - * an optional note (distinct from the quantity note), which can be used - to express a preference; for instance, you could indicate a preferred - variety -* steps, each of which is a narrative of the task to be accomplished - -Recipes also have a name, an optional "serves" property to represent how many -people this recipe will feed, and zero or more attributes (such as "gluten -free"), which are used for searching and filtering. -Prep instructions for ingredients are implicit steps that all come before -the first recipe step. -### Ingredients +### The list of known ingredients — `ontology.json` + +Stored serialised as `ontology.json`, the ontology is an object containing +an abstraction of foodstuff used in recipes. + +```javascript +{ + "ingredients": [ + { + "name": "carrot", + "group": "vegetable", + "attributes": [ + "meat free", + ... + ] + }, + ... + ] +} +``` + +Each ingredient is an object, containing: + +* `name` — _required_, the unique, singular name of the foodstuff, by + convention lower cased (ie "carrot" not "Carrots") +* `group` — _optional_, the unique, singular name of the grouping of the + foodstuff, also by convention lower cased (ie "spice" not "Spices") +* `attributes` — _optional_, an array of strings which represents aspects of the + ingredient, such as "dairy" or "meat" that could be used for searching + and filtering + +Groups represent a phase of shopping where similar items are collected +together, such as an aisle or area in a supermarket, or visiting different +shops. -Ingredients are the abstraction of the food stuff used in recipes. So -"carrot" rather than "100g carrots". The names of ingredients are unique, -and by convention are singular and lower-cased. -Ingredients also have an optional group, referenced by name, and zero or -more attributes (such as "meat") which are used for searching and filtering -recipes. +### The list of recipes — `recipes.json` -### Groups +Stored serialised as `recipes.json`, the list of recipes is an array of +strings that represent the directory relative to the location storing both +`recipes.json` and `ontology.json` under which the recipe serialisation can be +found. -Groups represent a phase of your shopping, and may be thought of as aisles -of a supermarket, or different shopkeepers. They have a name, which like -ingredients are unique, singular, and lower-cased. For example, "vegetable", -or "spice". +```javascript +{ -## File layout + "recipes": [ + "bacon-hash", + "cauliflower-fritter-lime-sauce", + ... + ] +} +``` + + +### A recipe — `