rfi-p> exec nutrimine

relfun
rfi-p> %%%### File "nutrimine1.bat"
rfi-p> 
rfi-p> sp
rfi-p> 
rfi-p> % NUTRIMINE: A Micro-Nutrient Knowledge Base (Batch)            25-Mar-98
rfi-p> % ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
rfi-p> % http://www.dfki.uni-kl.de/~vega/relfun+/nutrimine.bat    (-exec-> *.script)
rfi-p> % [-txt2html-> http://www.dfki.uni-kl.de/~vega/relfun+/nutrimine.script.html]
rfi-p> 
rfi-p> % Harold Boley
rfi-p> % boley@informatik.uni-kl.de
rfi-p> 
rfi-p> date()
[25,mar,1998,14,42]
rfi-p> destroy
rfi-p> 
rfi-p> consult "/home/boley/relfun/nutrimine/nutrimine.rfp"
Reading file "/home/boley/relfun/nutrimine/nutrimine.rfp"
rfi-p> 
rfi-p> % Show all bookmarks (here, about vitamin nutrients):
rfi-p> 
rfi-p> tupof(bmark(Nutri))
["http://www.tee.org/BHSD/bhsd159.html",
 "http://www.tee.org/BHSD/bhsd164.html",
 "http://www.tee.org/BHSD/bhsd166.html"]
rfi-p> 
rfi-p> %%%### eof
rfi-p> 
rfi-p> 
rfi-p> %%%### File "nutrimine2.bat"
rfi-p> 
rfi-p> % The nutrifood function shows which food contains how much vitamin C ...
rfi-p> nutrifood(vitamin-c,Food)       % repeatedly returns mg/kg amounts
mg/kg[620]
Food=strawberry
rfi-p> more                            % (milligram nutrients per kilogram food)
mg/kg[13000]
Food=acerola
rfi-p> more                            % for corresponding Food bindings
mg/kg[1100]
Food=broccoli
rfi-p> 
rfi-p> % ... and shows possible other nutrients contained in strawberries:
rfi-p> nutrifood(Nutri,strawberry)
mg/kg[0.3]
Nutri=beta-carotene
rfi-p> more
mg/kg[620]
Nutri=vitamin-c
rfi-p> more
unknown
rfi-p> 
rfi-p> % Nutrient doses for individuals after US Recommended Dietary Allowance:
rfi-p> nutridose(Nutri,Individual,usrda)   % mg/d (milligram nutrients per day)
mg/d[3]
Nutri=beta-carotene
Individual=linus
rfi-p> more
mg/d[30]
Nutri=vitamin-c
Individual=linus
rfi-p> more
mg/d[15]
Nutri=vitamin-e
Individual=linus
rfi-p> more
unknown
rfi-p> 
rfi-p> %%%### eof
rfi-p> 
rfi-p> 
rfi-p> %%%### File "nutrimine3.bat"
rfi-p> 
rfi-p> % Give list of nutrient-amount pairs for strawberries:
rfi-p> nutramount(strawberry)         % returns list of lists with mg/kg amounts
[[beta-carotene,mg/kg[0.3]],[vitamin-c,mg/kg[620]]]
rfi-p> 
rfi-p> % Constructor-like function g normalizes grams to kilograms:
rfi-p> g(500)                         % returns obvious kg fraction
kg[0.5]
rfi-p> 
rfi-p> % Constructor-like function lb normalizes pounds to kilograms:
rfi-p> lb(1)                          % returns same kg fraction
kg[0.5]
rfi-p> 
rfi-p> % lb nested into nutraport argument giving the portion of strawberries:
rfi-p> nutraport(strawberry,lb(1))    % returns list of lists with mg amounts
[[beta-carotene,mg[0.15]],[vitamin-c,mg[310.0]]]
rfi-p> 
rfi-p> % Add up all nutrients N of 0.5 kg strawberries and 0.1 kg acerolas:
rfi-p> nutraddup([[strawberry,kg[0.5]],[acerola,kg[0.1]]])   % [...,[N,mg],...]
[[vitamin-c,mg[1610.0]],[beta-carotene,mg[0.15]]]
rfi-p> 
rfi-p> %%%### eof
rfi-p> 
rfi-p> 
rfi-p> %%%### File "nutrimine4.bat"
rfi-p> 
rfi-p> listing nutreat
nutreat(Nutrient,Food,Individual,Recommender) :- 
         mg/kg[Nutrifood] .= nutrifood(Nutrient,Food),
         mg/d[Nutridose] .= nutridose(Nutrient,Individual,Recommender),
         Eat .= /(meanrange(Nutridose),*(Nutrifood,1.0)) &
         [Individual,
          for,
          mg/d[Nutridose],
          Nutrient,
          following,
          Recommender,
          eat,
          kg/d[Eat],
          of,
          mg/kg[Nutrifood],
          Food].
rfi-p> 
rfi-p> % How much strawberries should Linus eat for stored DGE nutrient doses?
rfi-p> nutreat(Nutrient,strawberry,linus,dge)  % returns hints with kg/d amounts
[linus,
 for,
 mg/d[1],
 beta-carotene,
 following,
 dge,
 eat,
 kg/d[3.3333333333333335],
 of,
 mg/kg[0.3],
 strawberry]
Nutrient=beta-carotene
rfi-p> more
[linus,
 for,
 mg/d[75],
 vitamin-c,
 following,
 dge,
 eat,
 kg/d[0.12096774193548388],
 of,
 mg/kg[620],
 strawberry]
Nutrient=vitamin-c
rfi-p> more
unknown
rfi-p> 
rfi-p> % How much acerola should one eat for the recommenders' vitamin C doses?
rfi-p> nutreat(vitamin-c,acerola,Individual,Recommender)
[linus,
 for,
 mg/d[75],
 vitamin-c,
 following,
 dge,
 eat,
 kg/d[0.0057692307692307696],
 of,
 mg/kg[13000],
 acerola]
Individual=linus
Recommender=dge
rfi-p> more
[linus,
 for,
 mg/d[30],
 vitamin-c,
 following,
 usrda,
 eat,
 kg/d[0.002307692307692308],
 of,
 mg/kg[13000],
 acerola]
Individual=linus
Recommender=usrda
rfi-p> more
[Anon11569*3,
 for,
 mg/d[range[50,200]],
 vitamin-c,
 following,
 bs,
 eat,
 kg/d[0.009615384615384616],
 of,
 mg/kg[13000],
 acerola]
Individual=Anon11569*3
Recommender=bs
rfi-p> more
[Anon11581*3,
 for,
 mg/d[range[500,3000]],
 vitamin-c,
 following,
 cooper,
 eat,
 kg/d[0.1346153846153846],
 of,
 mg/kg[13000],
 acerola]
Individual=Anon11581*3
Recommender=cooper
rfi-p> 
rfi-p> % 2-prefix from tuple/list of all nutreat hints, appended to ellipsis:
rfi-p> app(2start(tupof(nutreat(Nutrient,Food,Individual,Recommender))),
           ["..."])
[[linus,
  for,
  mg/d[1],
  beta-carotene,
  following,
  dge,
  eat,
  kg/d[3.3333333333333335],
  of,
  mg/kg[0.3],
  strawberry],
 [linus,
  for,
  mg/d[3],
  beta-carotene,
  following,
  usrda,
  eat,
  kg/d[10.0],
  of,
  mg/kg[0.3],
  strawberry],
 "..."]
rfi-p> 
rfi-p> %%%### eof
rfi-p> 
rfi-p> 
rfi-p> %%%### File "nutrimine5.bat"
rfi-p> 
rfi-p> % Transform all functions to relations with extra first result argument:
rfi-p> relationalize
rfi-p> listing nutreat
nutreat([Individual,
         for,
         mg/d[Nutridose],
         Nutrient,
         following,
         Recommender,
         eat,
         kg/d[Eat],
         of,
         mg/kg[Nutrifood],
         Food],
        Nutrient,
        Food,
        Individual,
        Recommender)
     :- nutrifood(mg/kg[Nutrifood],Nutrient,Food),
        nutridose(mg/d[Nutridose],Nutrient,Individual,Recommender),
        meanrange(_1,Nutridose),
        _2 .= *(Nutrifood,1.0),
        Eat .= /(_1,_2).
rfi-p> 
rfi-p> % ellipsis, appended to 1-postfix from tuple/list of all nutreat hints:
rfi-p> app(["..."],
           start1(tupof(nutreat(Result,Nutrient,Food,Individual,Recommender),
                        Result)))
["...",
 [Anon12686*5,
  for,
  mg/d[range[200,1200]],
  vitamin-e,
  following,
  cooper,
  eat,
  kg/d[3.3333333333333335],
  of,
  mg/kg[210],
  hazelnut]]
rfi-p> 
rfi-p> %%%### eof
rfi-p> 
rfi-p> 
rfi-p> %%%### File "nutrimine6.bat"
rfi-p> 
rfi-p> replace "/home/boley/relfun/nutrimine/nutrimine.rfp"
Reading file "/home/boley/relfun/nutrimine/nutrimine.rfp"
rfi-p> consult "/home/rfm/RELFUN/RFM/demo/applications/elements/elements.rfp"
Reading file "/home/rfm/RELFUN/RFM/demo/applications/elements/elements.rfp"
rfi-p> 
rfi-p> % List the vitamin-C (i.e., ascorbic-acid) molecule:
rfi-p> 
rfi-p> listing molecule(ascorbic_acid,molh,_,_)
molecule(ascorbic_acid,
         molh,
         [atom[1,6],
          atom[2,6],
          atom[3,6],
          atom[4,8],
          atom[5,6],
          atom[6,6],
          atom[7,8],
          atom[8,8],
          atom[9,8],
          atom[10,6],
          atom[11,8],
          atom[12,8],
          atom[13,1],
          atom[14,1],
          atom[15,1],
          atom[16,1],
          atom[17,1],
          atom[18,1],
          atom[19,1],
          atom[20,1]],
         [bond[1,2,2],
          bond[2,3,1],
          bond[3,4,1],
          bond[4,5,1],
          bond[1,5,1],
          bond[3,6,1],
          bond[1,7,1],
          bond[2,8,1],
          bond[5,9,2],
          bond[6,10,1],
          bond[6,11,1],
          bond[10,12,1],
          bond[3,13,1],
          bond[6,14,1],
          bond[7,15,1],
          bond[8,16,1],
          bond[10,17,1],
          bond[10,18,1],
          bond[11,19,1],
          bond[12,20,1]]).
rfi-p> 
rfi-p> % Show the number of atoms of vitamin C:
rfi-p> 
rfi-p> molecule(ascorbic_acid,molh,ListOfAtoms,_) & len(ListOfAtoms)
20
Listofatoms=[atom[1,6],
             atom[2,6],
             atom[3,6],
             atom[4,8],
             atom[5,6],
             atom[6,6],
             atom[7,8],
             atom[8,8],
             atom[9,8],
             atom[10,6],
             atom[11,8],
             atom[12,8],
             atom[13,1],
             atom[14,1],
             atom[15,1],
             atom[16,1],
             atom[17,1],
             atom[18,1],
             atom[19,1],
             atom[20,1]]
rfi-p> 
rfi-p> % Convert "small" (pro)vitamins' atomic numbers to symbols
rfi-p> % (The conv-atom-list function accesses the ELEMENTS KB:
rfi-p> % http://www.dfki.uni-kl.de/~vega/relfun+/elements.rfp,
rfi-p> % http://www.dfki.uni-kl.de/~vega/relfun+/elements.rfp.html):
rfi-p> 
rfi-p> 
rfi-p> molecule(Nutri,molh,ListOfAtoms,_), <(len(ListOfAtoms),95) &
                                                conv-atom-list(ListOfAtoms)
[atom[1,c],
 atom[2,c],
 atom[3,c],
 atom[4,o],
 atom[5,c],
 atom[6,c],
 atom[7,o],
 atom[8,o],
 atom[9,o],
 atom[10,c],
 atom[11,o],
 atom[12,o],
 atom[13,h],
 atom[14,h],
 atom[15,h],
 atom[16,h],
 atom[17,h],
 atom[18,h],
 atom[19,h],
 atom[20,h]]
Nutri=ascorbic_acid
Listofatoms=[atom[1,6],
             atom[2,6],
             atom[3,6],
             atom[4,8],
             atom[5,6],
             atom[6,6],
             atom[7,8],
             atom[8,8],
             atom[9,8],
             atom[10,6],
             atom[11,8],
             atom[12,8],
             atom[13,1],
             atom[14,1],
             atom[15,1],
             atom[16,1],
             atom[17,1],
             atom[18,1],
             atom[19,1],
             atom[20,1]]
rfi-p> more
[atom[1,c],
 atom[2,c],
 atom[3,c],
 atom[4,c],
 atom[5,c],
 atom[6,c],
 atom[7,o],
 atom[8,c],
 atom[9,c],
 atom[10,c],
 atom[11,c],
 atom[12,c],
 atom[13,c],
 atom[14,c],
 atom[15,c],
 atom[16,c],
 atom[17,c],
 atom[18,c],
 atom[19,c],
 atom[20,c],
 atom[21,c],
 atom[22,c],
 atom[23,c],
 atom[24,c],
 atom[25,c],
 atom[26,c],
 atom[27,c],
 atom[28,c],
 atom[29,c],
 atom[30,c],
 atom[31,o],
 atom[32,h],
 atom[33,h],
 atom[34,h],
 atom[35,h],
 atom[36,h],
 atom[37,h],
 atom[38,h],
 atom[39,h],
 atom[40,h],
 atom[41,h],
 atom[42,h],
 atom[43,h],
 atom[44,h],
 atom[45,h],
 atom[46,h],
 atom[47,h],
 atom[48,h],
 atom[49,h],
 atom[50,h],
 atom[51,h],
 atom[52,h],
 atom[53,h],
 atom[54,h],
 atom[55,h],
 atom[56,h],
 atom[57,h],
 atom[58,h],
 atom[59,h],
 atom[60,h],
 atom[61,h],
 atom[62,h],
 atom[63,h],
 atom[64,h],
 atom[65,h],
 atom[66,h],
 atom[67,h],
 atom[68,h],
 atom[69,h],
 atom[70,h],
 atom[71,h],
 atom[72,h],
 atom[73,h],
 atom[74,h],
 atom[75,h],
 atom[76,h],
 atom[77,h],
 atom[78,h],
 atom[79,h],
 atom[80,h],
 atom[81,h]]
Nutri=alpha_tocopherol
Listofatoms=[atom[1,6],
             atom[2,6],
             atom[3,6],
             atom[4,6],
             atom[5,6],
             atom[6,6],
             atom[7,8],
             atom[8,6],
             atom[9,6],
             atom[10,6],
             atom[11,6],
             atom[12,6],
             atom[13,6],
             atom[14,6],
             atom[15,6],
             atom[16,6],
             atom[17,6],
             atom[18,6],
             atom[19,6],
             atom[20,6],
             atom[21,6],
             atom[22,6],
             atom[23,6],
             atom[24,6],
             atom[25,6],
             atom[26,6],
             atom[27,6],
             atom[28,6],
             atom[29,6],
             atom[30,6],
             atom[31,8],
             atom[32,1],
             atom[33,1],
             atom[34,1],
             atom[35,1],
             atom[36,1],
             atom[37,1],
             atom[38,1],
             atom[39,1],
             atom[40,1],
             atom[41,1],
             atom[42,1],
             atom[43,1],
             atom[44,1],
             atom[45,1],
             atom[46,1],
             atom[47,1],
             atom[48,1],
             atom[49,1],
             atom[50,1],
             atom[51,1],
             atom[52,1],
             atom[53,1],
             atom[54,1],
             atom[55,1],
             atom[56,1],
             atom[57,1],
             atom[58,1],
             atom[59,1],
             atom[60,1],
             atom[61,1],
             atom[62,1],
             atom[63,1],
             atom[64,1],
             atom[65,1],
             atom[66,1],
             atom[67,1],
             atom[68,1],
             atom[69,1],
             atom[70,1],
             atom[71,1],
             atom[72,1],
             atom[73,1],
             atom[74,1],
             atom[75,1],
             atom[76,1],
             atom[77,1],
             atom[78,1],
             atom[79,1],
             atom[80,1],
             atom[81,1]]
rfi-p> 
rfi-p> 
rfi-p> 
rfi-p> % When browsing the *.html version, readers may now click at the source:
rfi-p> % http://www.dfki.uni-kl.de/~vega/relfun+/nutrimine.rfp.html
rfi-p> 
rfi-p> %%%### eof