Fork me on GitHub

Documentation

The WhatToMake ontology is separated into three components: Food, FoodOn, and Ingredient. The Food component of the ontology contains all of the base classes that were created for the ontology. The FoodOn component contains all of the imported classes from FoodOn. The Ingredient component contains all of the individuals that represent different recipes and ingredients. Documentation for each component of the ontology can be found in the links below, as well as the link to the ontology itself.

Conceptual Model

The motivation for WhatToMake Ontology came from our observation of the pains of using traditional cookbooks or even some online recipe archives to find recipes that fit a given person’s requirements. We felt that in order to make that experience better, a user should have the ability to search for a wide range of parameters such as ingredients, cook time, course type, and meal type and have recipes that fulfilled those parameters returned to them. We also saw that recipe searching was difficult if a user had some form of allergy, health concern, or dietary restriction. We wanted to create something which would help the user not only enter those restrictions but to help them find adequate substitutes for the ingredients that they have restricted in the event that was necessary. These were the driving problems that influenced our design of WhatToMake Ontology. In creating this ontology, we set out to relate recipes and their ingredients in a way that allows users to query the system and get results that would accommodate different requirements. Some of these requirements have to do with the meal or course type or the preparation time of a recipe, while others have to do with allergies and substitution requests. We thus needed to model our ontology in a way that would allow us to efficiently answer these types of questions. Our ontology is made up of several major classes: food, ingredient, recipe, characteristic, user, course, and meal. These classes can be seen in the overview diagram below.

This diagram illustrates how the classes (denoted by green rectangles) are related to each other through object properties (denoted by the red rectangles). The data properties for each class are represented by the yellow rectangles. In some cases, there is a limited set of individuals used to represent different meals or courses. These individuals are shown as purple circles.
WhatToMake Ontology Conceptual Model: Whole
This piece of the concept diagram illustrates the relationship that the Recipe class has with other classes and properties. The recipe class has individuals that represent specific recipes. Each recipe individual has three data properties: hasCookTime, hasCookingTemprature, and serves. Each recipe individual also has however many hasIngredient relations with ingredient individuals. Each recipe has at least one Meal and Course that it is recommended for. Each ingredient individual has a boolean data property hasGluten to indicate whether this ingredient contains gluten and a data property hasGlycemicIndex that stores the glycemic index value for this ingredient.
WhatToMake Ontology Conceptual Model: Recipe
This piece of the diagram shows the makeup of the Characteristic class. Each ingredient can have the relations hasFlavor and/or hasTexture, which represent the flavor and texture of this ingredient. This can help us when trying to make substitutions for ingredients. The flavors and textures themselves are represented as individuals.
WhatToMake Ontology Conceptual Model: Characteristic
This piece of the diagram shows the relationship between Users and Ingredients/Recipes. A user (which is represented as an individual) can have a “dislikes,” “forbids,” or “isAllergicTo” relationship with an ingredient. This makes it so the user doesn’t have to input this information into the system every time. The user can also save recipes, which is represented by the “hasSaved” relation so that any recipes this user particularly likes can be easily displayed.
WhatToMake Ontology Conceptual Model: User
In addition to the ingredient class (which is used to indicate which individuals are ingredients), there is a separate hierarchy to classify these ingredients as foods. The top level element is “Food” and serves as the superclass for all food classifications. The classes represented in blue are existing classes that were imported from the EBI Food Ontology and the classes represented in green are additions made to improve the classification. This diagram does not represent all of the imported classes, but rather shows a representative set of those classes that are most relevant to the competency questions.
WhatToMake Ontology Conceptual Model: Food

Competency Questions & Queries

The functionality of the WhatToMake system can be demonstrated through the four competency questions that were devised in order to develop the ontology. Each question aims to target a specific functionality of the WhatToMake ontology, as explained below. Some questions include sample SPARQL queries, which can be run by loading the ontology into Protege. To do so, load the http://purl.org/heals/ingredient ontology by URL into Protege and execute the queries in the SPARQL Query tab. Note that the food and foodon ontology components are imported as a part of the ingredient ontology.

1) "What recipes contain beef?"
This question targets the ontology's ability to query the system for recipes that contain a single incredient, beef. An example SPARQL query for this question is shown below.

@PREFIX food: <http://purl.org/heals/food/>
@PREFIX ingredient: <http://purl.org/heals/ingredient/>
SELECT DISTINCT ?recipe
WHERE {
?recipe food:hasIngredient ingredient:Beef .
}

2) "What recipes contain beef, carrots, and potatoes?"
This question is similar to the first, but allows for a user to specify multiple ingredients at a time. An example SPARQL query for this question is shown below.

@PREFIX food: <http://purl.org/heals/food/>
@PREFIX ingredient: <http://purl.org/heals/ingredient/>
SELECT DISTINCT ?recipe
WHERE {
?recipe food:hasIngredient ingredient:Beef .
?recipe food:hasIngredient ingredient:Carrot .
?recipe food:hasIngredient ingredient:Potato .
}

3) "What recipes contain bananas that do not contain walnuts?"
This question allows a user to specify which ingredients the would like to include while also specifying those to exclude. This kind of question is especially relevant in cases of allergies, intolerances, and dislikes. An example SPARQL query for this question is shown below.

@PREFIX food: <http://purl.org/heals/food/>
@PREFIX ingredient: <http://purl.org/heals/ingredient/>
SELECT DISTINCT ?recipe
WHERE {
?recipe food:hasIngredient ingredient:Banana .
FILTER NOT EXISTS {
?recipe food:hasIngredient ingredient:Walnut .
}
}

4) "What recipes that have chicken are low in sugar?"
This question addresses the use case of accomodating nutritional-based recommendations. This kind of question would be ideal for a diabetic user who must reduct their sugar intake. Currently, the ontology encodes nutritional information related to sugar by using glycemic index values. An example SPARQL query for this question is shown below.

@PREFIX food: <http://purl.org/heals/food/>
@PREFIX ingredient: <http://purl.org/heals/ingredient/>
SELECT DISTINCT ?recipe
WHERE {
?recipe food:hasIngredient ingredient:Chicken .
FILTER NOT EXISTS{
?recipe food:hasIngredient ?ingredient .
?ingredient food:hasGlycemicIndex ?GI .
FILTER (?GI >= 50)}
}

Running Queries

In order to run the above queries, we recommend either option below for loading the ontology:

  • Use Protege to load the ontology and execute the queries in the SPARQL tab.
  • Use blazegraph to load the ontology as a regular RDF file and execute the queries in the Query view.