forked from foodkg/foodkg.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfoodkg.html
128 lines (112 loc) · 5.9 KB
/
foodkg.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<!DOCTYPE html>
<html lang="en">
<head>
<title>FoodKG</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="css/custom.css">
</head>
<body>
<nav class="navbar navbar-inverse mx-auto">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="#"></a>
</div>
<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav">
<li><a href="index.html">Home</a></li>
<li class="active"><a href="foodkg.html">FoodKG Construction</a></li>
<li><a href="whattomake.html">What To Make Application</a></li>
<li><a href="kbqa.html">Question Answering on Knowledge Base Application</a></li>
<li><a href="contact.html">Contact</a></li>
</ul>
</div>
</div>
</nav>
<div class="container-fluid text-center">
<div class="row content">
<div class="col-sm-2 sidenav">
<div class="bg"></div>
<span class="caption">
source: <a
href="https://www.freeimages.com/search/food-question-mark">https://www.freeimages.com/search/food-question-mark</a>.
</span>
</div>
<div class="col-sm-8 text-left">
<a href="https://github.com/foodkg/foodkg.github.io"><img
style="position: absolute; top: 0; right: 0; border: 0;"
src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png" alt="Fork me on GitHub"></a>
<h1>Knowledge Graph Construction</h1>
<br />
<p>
We combine multiple sources of data into a single cohesive knowledge graph, forming linkages to relate similar
concepts.
</p>
<hr>
<h2>Components</h2>
<h3>Recipe data</h3>
<p>Recipes can be derived from a multitude of sources, such as books, websites, and structured datasets. For the
purposes of the publication dataset, we chose to use a collection of recipes gathered by the authors of and
used in the making of the <a href="http://im2recipe.csail.mit.edu/">Im2Recipe project</a>.</p>
<h3>Nutrient data</h3>
<p>Nutrient information can be found in great quantities for a variety of foods. We chose to source our data
from the USDA. To bring the data they provide into the knowledge graph, we took advantage of <a
href="https://tetherless-world.github.io/sdd">Semantic Data Dictionaries</a>, an RPI project.
The files used in the Semantic Data Dictionary process is available in <a href="https://github.com/foodkg/foodkg.github.io/tree/master/sdd">this</a> folder.
The <a href="sdd/usdaDM.csv">dictionary mapping</a> file specifies all the linkages made to external ontologies,
such as FoodOn, Units Ontology etc.</p>
<p></p>
<p>
We make available a <a href="https://drive.google.com/open?id=1hkitCcxnM_7R6OYuvC5zakWojlN2Xuog">sample of
the FoodKG (USDA mappings) </a> that were created using the Semantc Data Dictionary process.</p>
<h3>Food knowledge</h3>
Finally, to provide some structure to the ingredients encountered in our recipes, we incorporated <a
href="https://foodon.org">FoodOn</a>. The ontology provides detailed information about the origin and
preparation of foods.
<h2>Construction</h2>
<h3>Prerequisites</h3>
<p>You will need to manually acquire the following:</p>
<ul>
<li>The Im2Recipe <a href="http://im2recipe.csail.mit.edu/dataset/download/">Recipe1M Dataset (Layers and Ingredient detections files)</a></li>
</ul>
<p>To build, Python 3.7 is required as some of the prerequisite packages depend on the bundled packages with Python 3.7.
<h3>Execution</h3>
<p>After cloning the <a href="https://github.com/foodkg/foodkg.github.io">repository</a>, detailed instructions
for reproduction are available under the /src directory. A broad overview follows:</p>
<ol>
<li>Acquire the data listed above</li>
<li>Use /src/prep-scripts/ to join automatically-acquired data with the manual data</li>
<li>Use /src/recipe-handler/ to generate a knowledge graph from the prepared data</li>
<li>Use /src/verify to generate statistics from the result</li>
</ol>
<h3>Inputs</h3>
<p>The following two files are required from Recipe1M:</p>
<ul>
<li>layer1.json (<a =href="http://data.csail.mit.edu/im2recipe/recipe1M_layers.tar.gz">Layers</a> (381 MiB)) </li>
<li>det_ingrs.json (<a =href="http://data.csail.mit.edu/im2recipe/det_ingrs.json">Ingredient detections </a> (102 MiB))</li>
</ul>
<p> Other public data sources (e.g., USDA, FoodOn) are downloaded automatically by the script.
<h3>Outputs</h3>
<p>The final output comprises the serialized RDF data iles comprising the FoodKG:</p>
<ul>
<li>usda-links.trig (approx 4.1 million triples)</li>
<li>foodon-links.trig (approx 30 thousand triples)</li>
<li>foodkg-core.trig (approx 63 million triples)</li>
</ul>
<p> These files can be loaded into a graph database like BlazeGraph for executing the natural language queries.
</div>
</div>
</div>
<!-- <footer class="container-fluid text-center">
<p></p>
</footer> -->
</body>
</html>