# KEHOME/doc/MKRintro.html
# Feb/25/2007
MKR introduction

MKR 7.3 introduction

basic format

An MKR proposition has the format

	at context { sentence };

where context is

	space=s, time=t, view=v

View names the context, which is a list of
propositions.  Contexts are stored in
entity-characteristic-proposition hierarchies.

Sentence may be generalized to a proposition list.
Every sentence and proposition is terminated
by a semicolon.

The basic sentence is the statement:

	subject verb object pplist;

characteristic types

The object describes some characteristic of
the subject.  The verb indicates what type of
characteristic.  The basic characteristic
types and corresponding verbs are

	definition	is,isa,iss,isu
	alias		is
	hierarchy	isa,iss,isu
	group		ismem,isalt
	relation	rel
	part		haspart
	attribute	has
	action		do
	interaction	causes

There are many other MKR verbs, not shown here.
Most MKR verbs have inverses and iterative forms.

The two forms which use pplists are definitions

	subject is genus of domain with differentia;

and actions

	subject do action = event
		out  action products
		of   action domains
		with action characteristics
		od   action direct objects
		from action initial characteristics
		to   action final characteristics

Actions may also be written as productions

	product := subject do ... done;

sentence types

MKR has the classical sentence types found in
natural languages, plus some "programming" types.

	group definitions   (begin ... end)

Group definitions are used for defining
hierarchies, relations, and other groups.
The hierarchy format uses an indented outline,
similar to the table of contents of a book.
The relation format uses comma-separated phrases.

The question format is the same as a statement,
with one or more elements replaced by a question
mark.  For example

	subject has ?;
	subject do ? done;

The command format is the same as an action statement,
with the subject omitted.  For example

	do classify od unknown to view done;

Local operating system commands can be executed from MKR
scripts -- just replace "do" by "!".  For example

	! ls with -lt od *.icn to programs.txt done;
	! sort with -o person.txt od person.txt done;

The assignment format is the same as an attribute statement,
with the subject omitted, and "has" replaced by "let" or "unlet".
For example

	let kformat = mtriple;
	unlet debug;

The conditional format is

	if   proposition
	then propositionlist
	else propositionlist

The iteration formats are

	every generator {
	while proposition {
	until proposition {
		proposition list

where generator takes one of two forms

	variable genverb object;
	variable pplist;

and genverb is one of


pplist is used for list|array indexes
(e.g. GDBM database tables)
and infons (tuples) of relations.

	every index from initial to final; { ... };
	every index of myarray; { ... };
	every infon of myrelation; { ... };

The comment format begins with "#" and extends to end of line.
For example

	MKRintro.html has                  # this document
	  author="Richard H. McCullough",  # dc:creator
	  date="March 5, 2003";            # creation date

more productions

A special form of production (associative array
sytnax) is useful when accessing GDBM databases.
For example, if "John Doe" is a GDBM database table
which is indexed by the attributes of "John Doe",
then the attribute statement

	John Doe has sex = male;

can be written as

	John Doe[sex] := male;

All the attributes of "John Doe" can be accessed
with a generator.

	every attr of John Doe; {
		proposition list

Productions can also be used instead of assignments.

	let charformat = column;

can be written as

	charformat := column;

more details

MKE home