Jump to content

mKR

From Wikiversity

mKR is a high-level programming language which supports the knowledge representation primitives required to create, edit and search knowledge bases. It follows the procedural programming paradigm, using variables and procedures, but also makes use of naturalistic words and phrases, as well as the epistemological notions of definition and context.

mKE (my Knowledge Explorer) is an intelligent knowledge base assistant -- a computer program which communicates using the mKR language.

Introduction

[edit | edit source]

I am User:Rhmccullough, AKA Dr. Richard H. McCullough, AKA Dick McCullough. I have always been interested in Artificial Intelligence and Epistemology, but my work at Bell Labs was mostly focused on electronics and software development. After I retired from Bell Labs, I devoted my time and energy to designing a new knowledge representation language, mKR (my Knowledge Representation). mKE (my Knowledge Explorer) is an interactive program which interprets mKR statements, questions and commands and records the results in mKB (my Knowledge Base). The "my" adjective emphasizes the focus on personal context, adjusted to fit any situation and purpose.

I wrote my first mKR program in 1996. I implemented mKE using the Unicon language, and executed it on my own personal computer running the UNIX operating system. As mKR and mKE evolved, I created a website with free downloads of mKE, and ported mKE to Windows and Mac OS X. In 2014, I started a non-profit company, Context Knowledge Systems, to continue the development and support of mKR and mKE.

The purpose of this resource is to show you how to use mKR for practical applications. After some brief remarks about mKR design philosophy and special features, you will find an expanding collection of specific examples. The Context Knowledge Systems website includes a complete definition of mKR, an mKR/mKE tutorial, and complete source code for mKE.Rhmccullough (discusscontribs) 16:00, 26 September 2014 (UTC)

Design features

[edit | edit source]
  • Simple English

mKR's syntax is similar to English, simplified so that the same name is used regardless of tense and number, verbs are always in the infinitive, and attributes always take the first person singular. Starting with mKR's built-in vocabulary, which includes all Natural Semantic Metalanguage concepts, [1] the user adds his own English words and phrases. These features make mKR easy to use.

  • UNIX shell

From the UNIX shell, mKR inherits the conceptual and syntax elements of variables, methods, conditionals, iteration and wildcards. [2] These features give mKR its computational power.

  • Context

mKR "implements" the context theories of Ayn Rand[3] [4] and Keith Devlin.[5] The basic mKR statement takes the form

   in context { subject verb object pplist; };

context (aka situation) names a list of sentences, which logically define the context. pplist is an optional list of preposition phrase modifiers.

mKR uses entity-property-sentence hierarchies as a visual aid in grasping the meaning of knowledge, and as a primary means of input/output. For example, see the myhi hierarchy in the next section. These features give mKR the power to enhance the Real Intelligence of its user.

Special features

[edit | edit source]

The brief examples given below illustrate some special features of mKR.

  • relation
address book is relation with
   relType = (person, email, phone),
   meaning = {$1 has email = $2, has phone = $3;},
   relKey = "$1";
begin relation address book;
rel Dick McCullough, rhm@PioneerCa.com, 707-255-3093;
rel John Doe, john@PioneerCA.com, 209-555-1212;
rel Jane Doe, jane@PioneerCA.com, 209-555-1212;
end relation address book;
do dbopen od address book, relation, gdbm; # open GDBM table containing relation
do write relation od address book;         # write address book
? has phone = 209-555-1212;                # find person(s) with phone number
  • hierarchy
begin hierarchy myhi;
ho 0,   U:existent;
ho 1,      entity;
ho 2,          hierarchy;
ho 2,          relation;
ho 2,          view;
ho 2,          person;
ho 3,              u:Dick McCullough;
ho 3,              u:John Doe;
ho 3,              u:Jane Doe;
ho 2,          organization;
ho 3,              u:Context Knowledge Systems;
ho 3,              u:Wikiversity;
ho 2,          animal;
ho 2,          plant;
ho 2,          thing;
ho 3,              u:mKE;
ho 1,      property;
ho 2,          attribute;
ho 3,              space;
ho 3,              time;
ho 2,          part;
ho 2,          action;
ho 3,              method;
ho 1,      sentence;
ho 2,          context;
ho 2,          statement;
ho 2,          question;
ho 2,          command;
ho 2,          assignment;
ho 2,          conditional;
ho 2,          iteration;
ho 2,          group;
end hierarchy myhi;
do dbopen od myhi, hierarchy, gdbm;     # open GDBM table containing hierarchy
do write hierarchy od myhi;             # write hierarchy in outline format
in hierarchy = myhi { person isc* ?; }; # display subhierarchy
  • UNIX shell commands
! ls $DBDIR;                              # list the GDBM tables
! rm $DBDIR/myhi*;                        # remove the myhi hierarchy
! webdir http://mkrmke.net/knowledge/   # list files in web directory
cks := http://ContextKnowledgeSystems.org/CKS.html;
! boilerpipe $cks;                        # extract text from web page
! wordbag $cks;                           # word count of web page

Examples

[edit | edit source]

mKR special properties: is, do, ho, rel, meaning

[edit | edit source]
is is used to state aliases and definitions
  alias is concept;
  concept is genus with differentia;
do is used to describe actions and commands
  agent do action ppList;
  do command ppList;
ho is used to define a hierarchy unit
  ho level, concept;
rel is used to define a relation unit
  rel value_1, value_2, ..., value_n;
meaning is used to define the interpretation/translation
of a relation unit or a method execution
  meaning = { sentence_1; sentence_2; ..., sentence_n; }

Ambiguity

[edit | edit source]
gsu representation of hierarchy
  gsu[concept] := GSU(g, s, u);
  g is set of all genus (generalization) of concept
  s is set of all species (specialization) of concept
  u is set of all unit (instance) of concept
ambiguity of a concept, sentence, or hierarchy
  A := sum(log(*g))
where *g denotes the size of the genus set
Tree structured lattice has minimum ambiguity = 0
Fully connected lattice has maximum ambiguity = N log(N)


Genealogy

[edit | edit source]
introduction
The genealogy application illustrates several important issues
to consider in any application.
1. identify the essential relations
2. implement the "meaning" procedures
3. permanent storage of results
4. standard interface to other programs
knowledge model
The four essential relations are
    birth-death
    marriage-divorce
    parent-child
    aka
See aka.rel, birth.rel, child.rel, marriage.rel, family.mkr.
Additional information such as
    address, phone, email
    education
    occupation
can be included.
See note.rel, address.rel, phone.rel, school.rel, work.rel


Unicon procedures
The initial implementation of meaning procedures can use mKR methods.
The high level mKR sentences can be easily changed to match your
evolving notions of how the knowledge relations will be used.
Then you can use the mKR "clock" command to measure execution times
and decide if you want to use any Unicon procedures.
mKE uses Unicon procedures for the four essential relations.
See aka.icn, birth.icn, child.icn, marriage.icn.

GDBM tables
As the size of the knowledge base increases, processing time increases,
and you may want to save the results in permanent storage.
mKR uses the standard database interfaces of Unicon for this purpose.
GDBM is a simple database which is included with  Windows, Linux and
Mac OS X operating systems. See hoio.icn, mkr_table.icn.
standard GEDCOM file
There are commercial Genealogy programs which can search many sources
of additional information. For example, the Family Tree Maker 2014
available from Ancestry.com searches public records, newspapaers,
and other family trees.
In order to take  advantage of these specialized programs,
mKE reads and writes standard GEDCOM files.
See ged_read.icn, ged_write.icn.
family tree
mKE creates a person hierarchy using the mKR statements
    child iss mother;
    child iss father;
This simple hierarchy allows you to use all the standard
mKE commands for searching and displaying hierarchies.
For example
    p := do find od richard h with value in familytree;
    in hierarchy = familytree;
    $p isa**n ?;  # display n generations of ancestors
    $p isc* ?;    # display all descendants

See also

[edit | edit source]

References

[edit | edit source]
  1. 1996, Anna Wierzbicka, Semantics: Primes and Universals, Oxford University Press.
  2. 1995, Morris I. Bolsky, David G. Korn, The New KornShell Command and Programming Language, Prentice-Hall.
  3. 1990, Ayn Rand, Introduction to Objectivist Epistemology, Expanded Second Edition, Meridian.
  4. 2014, Harry Binswanger, How We Know, TOF Publications.
  5. 1995, Keith Devlin, Logic and Information, Cambridge University Press.
[edit | edit source]