mops.lisp is an implementation of a simple hierarchical frame memory, such as that used for implementing Schank's Memory Organization Packets (MOPs).

A frame is a very general data structure, useful for representing different kinds of knowledge, including concepts, abstractions, indices, and so on. This package provides the basic functionality of frames, for use and extension by other packages.

A frame represents a concept. Each frame has

The slots give information about attributes of name} and have roles, e.g., color with fillers, e.g., grey. Fillers are often the names of other frames.

Here are examples of three very different concepts being represented, a concrete object, an abstraction, and an event involving the object:

clyde-1
  absts: elephant
  slots:
    name = Clyde
    age = 15
elephant
  absts: mammal
  slots:
   color = grey
event-1
  absts: event
  slots:
    actor = clyde-1
    action = ingest
    object = peanuts-1

The chain of links from a frame to its immediate abstractions, and from the immediate abstractions of their abstractions, and so on, forms an abstraction hierarchy. For example, we might have the hierarchy "clyde is an elephant, an elephant is a mammal, a mammal is an animal, and an animal is a thing."

Using the code in mops.lisp, the simple examples above could be defined as follows:

(definstance clyde-1 (m-elephant) :age 15 :name clyde)

(defmop m-elephant (m-mammal) :color grey)

(definstance event-1 (m-event)
   :actor clyde-1
   :action m-ingest
   :object peanuts-12)

A frame can have more than one abstraction, e.g., if clyde-1 performed in a circus, we might write:

(defmop clyde-1 (elephant circus-performer) ...)

MOP Functions

The following briefly describes the functions defined in mops.lisp.

(defmop name abstractions role1 filler1 role2 filler2 ...) => name
(definstance name abstractions role1 filler1 role2 filler2 ...) => name
(add-instance name slots) => name

defmop defines a MOP abstract concept. definstance defines an instance of a MOP. add-instance is the function for adding an instance that code such as a parser would call to make instances on the fly.

(mop-p name) => true or false
(instance-p name) => true or false

mop-p and instance-p test if name names a MOP or MOP instance, respectively.

(find-instances name slots) => list of instances

Returns all instances of name with slots whose fillers are equal to or abstractions of the corresponding fillers in slots. Example call:

(find-instances 'm-person (list :age 12))

(frame-of name) => frame or nil
(->frame name) => frame

These both return the internal frame for a name. -> will create one if it doesn't exist.

(absts-of name) => list of names
(slots-of name) => list of slots
(all-absts-of name) => list of names

absts-of and slots-of return the abstractions and slots explicitly defined for a MOP. all-absts-of returns the linearization of all the abstractions of name, including name}, with no duplicates, sorted by specificity, with the most specific item first.

(abstp abst spec) => true or false

abstp returns true if abst is either eql to or some abstraction of spec. Non-frames, such as numbers and strings, are abstractions of themselves.

(role-filler name role) => filler
(inherit-filler name role) => filler
(<- name role1 role2 ...) => filler

These are the basic functions for accessing fillers of slots in a frame. role-filler returns the filler, if any, of role in the frame name. inherit-filler is like role-filler but will search the abstraction hierarchy. <- does a sequence of inherit-filler's. For example (<- 'event-1 :actor :age) would get the age of the actor of event-1.

(clear-memory)
(show-frame name)
(show-memory [name stream slots-p])

clear-memory erases all frames from memory. show-frame displays a MOP in readable form. show-memory shows all the frames in memory, in tree form. If name is given, only that MOP and its children are shown. If stream is given, output is to that stream, rather than *standard-output*. If slots-p is true, the slots of each frame are shown.


Comments? Send mail to Chris Riesbeck.