User:Rhmccullough/Sandbox/Examples

See External References for additional details

   commands [18]
   options [19]
   methods [20]
   tutorial [21]
   grammar [22]
   predefined knowledge units [23][24]


The brief examples given below illustrate the basic features of mKR.

   * attributes

John Doe has

   email = [email protected],
   phone = 209-555-1212;
   * relation

address book is relation with

   format = [person:1, email:2, phone:3],
   meaning = { $1 has email=$2, phone=$3; };

begin relation address book;

   John Doe, [email protected], 209-555-1212;

end relation address book;

   * hierarchy

begin hierarchy tabula rasa;

   existent;
   /    group;  # abstract entity
   /    entity; # physical entity
   /    characteristic;  # property
   //       attribute;
   //       part;
   //       relation;
   //       action;
   //       interaction;
   /    proposition;

end hierarchy tabula rasa;

   * display hierarchy

existent isc* ?;

   * display classes

John Doe isa* ?;

   * action

at time = 10 am {

    John Doe do walk
        from his house
        to the store
        with purpose = buy food
    done;

};

   * definitions and context
mKE is ke;
at view = Aristotle { man is ANIMAL with rational; };
at view = OWL { man isand ANIMAL, rational; };
at view = John Doe { man is person with gender=male; };
   * questions

ke do ? done; # mKE commands ke has ?; # mKE options and variables verb isc* ?; # mKR verbs cat ? car; # relation attrs := John Doe has ?; # list of attributes

   * iteration

every p isu person { do print od $p done; };

   * conditional

if e := John Doe has email = ?; then do print od $e done; fi;

   * define enumeration, set, union, disjoint union, intersection, complement

color isany red, green, blue; digits isall 0, 1, 2, 3, 4, 5, 6, 7, 8, 9; domestic animals isor cats, dogs, parrots; integers isxor even numbers, odd numbers; busy man isand father and Chief Executive Officer; dead person isnon living person; # relative to genus person not person isnot person; # relative to existent

   * store attributes in database or table

John Doe[email] := [email protected]; John Doe[phone] := 209-555-1212;

   * print attributes

every a of John Doe { do print od John Doe[$a] done; };

   * define method

char is method with

    format = [ existent:1 ],
    meaning = {
          $1 is  ?;
          $1 has ?;
          $1 do  ? done;
    };
   * execute method

do char od John Doe done;

   * execute UNIX shell command

! cat *.txt | sort done;

   * execute mKR script

ke -m -owl <<EOF > peirce.out

 do read owl from peirce.owl done;
 do check od genus done;
 do check od unknown done;
 do simplify lattice od Thing done;
 Thing isc* ?;

EOF grep -v '^#' peirce.out > peirce.ho

Content Disclaimer

Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.

  1. The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
  2. There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
  3. It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
  4. Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
  5. Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.