Class Knowledgebase

This class represents a knowledge base. The constructor that takes a toolkit creates a root knowledge base. The lobby can be accessed by the method getLobbyt(). The constructor that takes another knowledgebase creates a child knowledge base. The parent knowledge base can be accessed by the method getParent(). An interactor can be obtained from a knowledge base via the method iterable().

After creation, the knowledge base will be uninitialized. To initialize the knowledge base the methods initKnowledgebase() should be used. For a root knowledge base this will initialize the capabilities already defined in the toolkit. The method finiKnowledgebase() will in turn finish a knowledge base. For a root knowledgebase this will finish the currently initialized capabilities of the knowledge base and render the knowledge base unusable.

A knowledgebase provides a context for a base URL. The base URL is used in resolving relative write paths. The GUI and the non-GUI console will initialize the base URL to the current user directory. Otherwise the base URL is left uninitialized. A knowledgebase also pro-vides a context for a locale. The GUI console will initialize the locale to the settings. Otherwise the locale is set to the JVM locale.

A knowledge base also provides a context for a class path. The class path is used in resolving path/1 and library/1 read paths. The class path is also used to resolve class names. Classes can be loaded via the method stringToClass(). The method respects short hands as defined in the foreign function interface. The possibly shortened class name can be reconstructed by the method classToString().

The current class loader can be retrieve via the method getLoader(). The method addClassPath() allows adding further paths to the class loader. The currently added paths can be queried with the method getClassPaths(). The GUI console will automatically add the paths defined in the settings. The GUI and the non-GUI console will also add the paths defined in the command line.

The method stringToCapability() allows retrieving a capability by name. The capability need not already be defined in the toolkit. All that is need is that the corresponding class is found in the added paths.

The getErrorProperties() allows retrieving the union of all error properties that have been loaded and registered so far. The method might return different properties for different locales. The method getCache() gives the actual local cache for a given error property. To find a cache the error property need not be registered but at least loaded.


import java.util.ArrayList;
import java.util.Locale;
import java.util.Properties;
import java.util.HashMap;
import matula.util.system.AbstractDecoder;
import matula.util.system.AbstractRecognizer;

public class Knowledgebase extends AbstractRecognizer {
public final static String OP_ON;
public final static String OP_OFF;
public final static String OP_NIL;
public final static String OP_CONS;
public final static String OP_SUB;
public final static String OP_TRUE;

public Knowledgebase(Toolkit k);
public Knowledgebase(Knowledgebase p);

 public Lobby getLobby();
public Knowledgebase getParent();

public Interpreter iterable();
public static void initKnowledgebase(Interpreter inter)
throws InterpreterMessage, InterpreterException;
public static void initKnowledgebase(Interpreter inter, boolean prompt)
throws InterpreterMessage, InterpreterException;
public void finiKnowledgebase()
throws InterpreterMessage;

public ClassLoader getLoader();
 public void addClassPath(String path)
 throws InterpreterMessage;
public String[] getClassPaths()
throws InterpreterMessage;

public Capability stringToCapability(String n)
throws InterpreterMessage;

public AbstractDecoder pathToDecoder(String path);

public Properties getErrorProperties(Locale locale);
public HashMap<String,Properties> getCache(String key);