The KM2 NOTATION PROCESSOR
KM2 is a powerful macro-processor which allows to generate automatically files written with trees and graphs and icons.
Today, KM2 uses the XMind format, but will use other sources in the future.

1. Introduction to the KM2 processor

1.1. introduction to SGH schemes


SGH is a shortcut for Script (=writing), Graphics and Hyperlinks.

1.1.1. Using SGH schemes


The studies in Knowledge Management have led to important results :
SGH schemes try to solve these issues by :
SGH schemes are quite known in the world of mind-mapping. KM2 is (presently) based on a writing tool which is Xmind (notably Xmind 8 pro).
SGH schemes are richer than 'usual' mind maps : the TABLE' notion is used extensively.

Tables are just tables, but propose a structured presentation of the knowledge which is not accessible through trees.
Examples of SGH schemes
The water cycle

The water cycle
It is hard to explain simply the water cycle :
  • where to start
  • the differences between objects, processes, etc
  • a text breaks intrinsically the cycle as it gives a huge privilege to the starting point.

a drawing is worth a thousand words.

1.2. The KM2 processor

The KM2 processor is based on the conjunction of several ideas :

1.2.1. From graphs to documents


The first idea is to represent texts by trees, graphs and drawings :
Then the drawing is converted into documents, should they be text or programms or whatever.
The final form of the conversion is defined by the language.
==> From the same tree many differents texts can be generated.


Programms and text in KM2 are described by Xmind trees.
The processor uses a depth first walking routine to generate documents in several languages : python, prolog, html, C, java, javascript, etc.
The KM2 processor works in 2 steps :
  • Generate a python list
  • prints this list to a given file

The standard order of walking through the tree is called "depth first" : this is the baisc linearisation of a tree as depicted on the right.
Example :

1.2.2. Control of the mapping


When visiting nodes, some nodes have a special syntax that is processed according to a set of standard and user-defined rules.

1.2.3. Extension of the base langage with notations


There are rules for many languages and text documents.
for more information about python, check the M2 for python documentation here.

Example for html :
SOURCE IN KM2



Generated by KM2 :


This is just
  • an example of possibilities
  • of writing
  • other texts

We have 2 bugs here :
  • A gentle bug
  • A hard bug

for more information about python, check the M2 for python documentation here.

Example for Python :
SOURCE IN KM2



Generated by KM2 :

def fact (n) :
#    DESCRIPTION
#        returns the factorial of any number
    if n < 2 :
        return 1
    else :
        return n * fact (n-1)


Example for javascript :
SOURCE IN KM2



Generated by KM2 :

function fact (n) {
//     DESCRIPTION
//         returns the factorial of any number
    if (n < 2) {
        return 1;
        }
    else {
        return n * fact (n-1);
    }
}


One of the most striking possibilities of KM2 is the easiness in which many languages can be mixed and reused to genertae documents.
There is a subtle difference between a notation and a macro :
  • A notation describes the EXTERNAL view of an SGH
  • A macro can be associated to a notation, and explains HOW the SGH scheme associated to this notation can be transformed into something else.
The same notation can be used in different contexts with different macros and generate various behaviours of the processor. A notation can be used without a macro : it is just a language convention.

1.2.4. Python as the embedded programming language for extensions

1.3. For advanced users

using constants, etc

1.3.1. Programming in KM2, using constants, etc

1.3.2. Non-linearity with the KM2 processor






...