[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4. Communicating with PowerLoom

There are a variety of modes users can choose from for interacting with the PowerLoom system. The simplest is to use the PowerLoom command interpreter. The interpreter supports a type-in window that allows line-at-a-time entry of commands. You can use the interpreter to load files of PowerLoom declarations, to create and edit knowledge base objects, to ask queries, and to modify settings in the execution environment.

A second mode of interaction involves writing an application that makes calls to the PowerLoom API (see section PowerLoom API). PowerLoom implements an extensive list of procedures that can be called to control the logic system. These procedures range from very specific procedures to assert or query a single fact, to general procedures that interpret arbitrary queries. The STELLA translator offers users a choice of Common Lisp, Java, or C++ -based versions of the PowerLoom system; users can choose whichever is the best match for their language of choice for their applications.

Starting with PowerLoom version 4.0, an experimental Java-based GUI is available to browse, query and edit knowledge bases (see section PowerLoom GUI). Additionally, the Ontosaurus Web Browser offers a convenient way to view the contents of PowerLoom knowledge bases from a standard Web browser (see section Ontosaurus).


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.1 Command Interpreter

Currently, the primary means for interacting with PowerLoom is its command interpreter. The command interpreter can be used either interactively, or it can be invoked directly from a program to evaluate individual commands. All PowerLoom commands (see section Commands) can be evaluated using the command interpreter.

The interactive command interpreter is invoked by calling the function powerloom without any arguments. In the Java versions of PowerLoom, the interpreter in called by the main routine in the class PowerLoom within the logic package. In the C++ versions of PowerLoom, powerloom is also called within the main routine. In the Lisp version, (STELLA::powerloom) has to be called explicitly. However, in Lisp it is not really necessary to use the command interpreter, since all commands can also be executed directly at the Lisp top level(8).

The interactive command interpreter functions as a simple read/eval/print loop that prompts for input with a |= prompt, reads a user command from standard input, evaluates it, and prints the result to standard output. To exit the command interpreter, type quit or stop.

To evaluate commands directly from a program, the PowerLoom API provides the following evaluator functions:

Function: evaluate ((command OBJECT) (module MODULE) (environment ENVIRONMENT)) : OBJECT

Evaluate the command command within module and return the result. Currently, only the evaluation of (possibly nested) commands and global variables is supported. Commands are simple to program in Common Lisp, since they are built into the language, and relatively awkward in Java and C++. Users of either of those languages are more likely to want to call s-evaluate.

Function: evaluate-string ((expression STRING)) : OBJECT

Evaluate the expression represented by expression and return the result. This is equivalent to (evaluate (unstringify expression)).


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

4.2 Persistent Knowledge Bases

Serious users of PowerLoom will want to construct knowledge bases that persist between sessions. PowerLoom’s primary medium of persistence is file-based; users construct their knowledge bases by entering PowerLoom statements into ASCII-formatted files, and then using the load command to load them into PowerLoom. There is also a save-module command that saves the current assertions of a module to a file. Large-scale persistence via a backend database is currently under development and will become available in one of the next releases.


[ << ] [ >> ]           [Top] [Contents] [Index] [ ? ]

This document was generated by Hans Chalupsky on January 6, 2023 using texi2html 1.82.