일일 권장 영양 섭취량의 시각화
Wolfram Knowledgebases는 37,000 여종의 "Food" 엔티티와 1,000개 이상 항목의 "FoodType" 엔티티에 대한 상세 특성과 영양 정보 뿐만 아니라 176개 항목 영양소의 하루 권장 섭취량 역시 포함하고 있습니다. 이러한 광범위한 데이터 집합을 사용하면 사실상 어떠한 식사의 영양소 함량의 계산이 가능하며, 간단한 플롯을 사용하여 직관적인 시각화를 표현할 수 있습니다.
In[1]:=
EntityValue["Nutrient", "EntityCount"]Out[1]=
하루 2000kcal 열량 섭취를 기준으로 하여 일일 권장 섭취량 목록을 추출합니다.
In[2]:=

allDailyValues = 
 Append[DeleteMissing[
    EntityValue["Nutrient", "DailyValue", "EntityAssociation"]], 
   Entity["Nutrient", "Energy"] -> 
    Quantity[2000, ("LargeCalories")/("Days")]]*Quantity[1, "Days"]Out[2]=

음식의 영양소 음식 특성을 지도로 생성합니다.
In[3]:=

propertyNutrientRules = {EntityProperty["Food", 
     "AbsoluteSodiumContent"] -> Entity["Nutrient", "Sodium"], 
   EntityProperty["Food", "AbsoluteTotalCarbohydratesContent"] -> 
    Entity["Nutrient", "TotalCarbohydrates"], 
   EntityProperty["Food", "AbsoluteTotalFatContent"] -> 
    Entity["Nutrient", "TotalFat"], 
   EntityProperty["Food", "AbsoluteTotalFiberContent"] -> 
    Entity["Nutrient", "TotalFiber"], 
   EntityProperty["Food", "AbsoluteIronContent"] -> 
    Entity["Nutrient", "Iron"], 
   EntityProperty["Food", "AbsoluteTotalCaloriesContent"] -> 
    Entity["Nutrient", "Energy"]};EntityGroup과 EntityInstance를 사용하여 전형적인 아침 식사를 부호화합니다.
In[4]:=

breakfast = EntityGroup[{
    EntityInstance[Entity[
     "Food", {
      EntityProperty["Food", "CookingMethod"] -> Entity[
        "CookingMethod", "HardBoiled"], 
       EntityProperty["Food", "FoodType"] -> ContainsExactly[{
Entity["FoodType", "Egg"]}], 
       EntityProperty[
        "Food", "AddedFoodTypes"] -> ContainsExactly[{}]}], 
     Quantity[2, "Servings"]],
    EntityInstance[Entity[
     "Food", {EntityProperty["Food", "FoodType"] -> ContainsExactly[{
Entity["FoodType", "Bacon"]}], 
       EntityProperty[
        "Food", "AddedFoodTypes"] -> ContainsExactly[{}]}], 
     Quantity[3, "Slices"]],
    EntityInstance[Entity[
     "Food", {EntityProperty["Food", "FoodType"] -> ContainsExactly[{
Entity["FoodType", "HashBrown"]}], 
       EntityProperty[
        "Food", "AddedFoodTypes"] -> ContainsExactly[{}]}], 
     Quantity[1, "Servings"]],
    EntityInstance[Entity[
     "Food", {EntityProperty["Food", "FoodType"] -> ContainsExactly[{
Entity["FoodType", "OrangeJuice"]}], 
       EntityProperty[
        "Food", "AddedFoodTypes"] -> ContainsExactly[{}]}], 
     Quantity[2, "Servings"]]
    }];6가지 주요 영양소의 하루 권장 섭취량의 50%, 100% (녹색으로 표시), 150%를 나타내는 방사상으로 중첩된 육각형의 "영양 균형 그래프"를 구축합니다.
전체 Wolfram 언어 입력 표시하기
In[6]:=
compassPlot[breakfast]Out[6]=

아침 식사 뿐만 아니라 점심과 저녁 식사도 지정합니다.
In[7]:=

lunch = EntityGroup[{
    EntityInstance[Entity[
     "Food", {EntityProperty["Food", "FoodType"] -> ContainsExactly[{
Entity["FoodType", "PeanutButter"]}], 
       EntityProperty[
        "Food", "AddedFoodTypes"] -> ContainsExactly[{}]}], 
     Quantity[2, "Tablespoons"]],
    EntityInstance[Entity[
     "Food", {EntityProperty["Food", "FoodType"] -> ContainsExactly[{
Entity["FoodType", "Bread"]}], 
       EntityProperty[
        "Food", "AddedFoodTypes"] -> ContainsExactly[{}]}], 
     Quantity[2, "Slices"]],
    EntityInstance[Entity[
     "Food", {EntityProperty["Food", "FoodType"] -> ContainsExactly[{
Entity["FoodType", "Jelly"]}], 
       EntityProperty[
        "Food", "AddedFoodTypes"] -> ContainsExactly[{}]}], 
     Quantity[1, "Servings"]]
    }];In[8]:=

dinner = EntityGroup[{
    EntityInstance[Entity[
     "Food", {EntityProperty["Food", "FoodType"] -> ContainsExactly[{
Entity["FoodType", "Spaghetti"]}], 
       EntityProperty[
        "Food", "AddedFoodTypes"] -> ContainsExactly[{}]}], 
     Quantity[1, "Servings"]],
    EntityInstance[Entity[
     "Food", {EntityProperty["Food", "FoodType"] -> ContainsExactly[{
Entity["FoodType", "Meatball"]}], 
       EntityProperty[
        "Food", "AddedFoodTypes"] -> ContainsExactly[{}]}], 
     Quantity[3, "Items"]],
    EntityInstance[Entity[
     "Food", {
      EntityProperty["Food", "BrandName"] -> Entity[
        "FoodBrandName", "Bertolli"], 
       EntityProperty["Food", "FoodType"] -> ContainsExactly[{
Entity["FoodType", "Sauce"]}], 
       EntityProperty[
        "Food", "AddedFoodTypes"] -> ContainsExactly[{}]}], 
     Quantity[1.5, "Servings"]],
    EntityInstance[Entity[
     "Food", {
      EntityProperty["Food", "Flavor"] -> Entity[
        "FoodFlavor", "Cola"], 
       EntityProperty["Food", "FoodType"] -> ContainsExactly[{
Entity["FoodType", "CarbonatedBeverage"]}], 
       EntityProperty[
        "Food", "AddedFoodTypes"] -> ContainsExactly[{}]}], 
     Quantity[1, "USSodaCanVolumes"]]
    }];각 식사 후 영양소 섭취 상황을 누적하여 시각화합니다.
전체 Wolfram 언어 입력 표시하기
Out[9]=


