sef@cs.cmu.edu
Copyright Notice:
This manual is copyright © 2003-2008 by Scott E. Fahlman.
By using, modifying, reproducing, or distributing the
Acknowledgment:
Development of
Table of Contents
3. Loading and
Saving KB Files
4. Structure of
Scone Elements
5. Flags,
Properties, and Markers
6. Referring to
Scone Elements
6.2 Element
External (English) Names
7.9 Splits and
Complete Splits
8. More
Functions to Create Network Structure
12. Mark, List,
and Show Functions
Functions That Create New Structure in the KB
17. Domain-Specific
Structure-Creation Functions
19. Alphabetical
Function List
The current version of
The greatest problem for users of knowledge-base systems
has been the difficulty of adding new knowledge to the system and making that
knowledge fully effective. This gives
rise to spotty coverage of common-sense domains.
This manual covers the operation and functions of the
This manual assumes that the reader has some general
familiarity with Common Lisp syntax. As
a quick reminder, if this document
(some-function
a b &optional c)
then some-function is the name of the function, arguments a and b are required, while argument c is optional, with some default value. The default default value is nil – Lisp's representation for both the empty list and "false".
If a function's syntax specification looks like this
(some-function
a b &key cat dog)
then a and b are required arguments, while dog and cat are optional “keyword” arguments, which the caller can pass in any order. So some syntactically legal calls to this function would include the following
(some-function
27 'my-arg)
(some-function 27 'my-arg :cat "Felix" :dog "Fido")
(some-function 27 'my-arg :dog "Fido" :cat "Felix")
In Common Lisp, 'foo represents a quoted constant (in this case the symbol foo), and "foo" represents a string. Symbols prefixed with the colon character are called keywords, and are self-quoting; these are used for named tokens or enumerations and for labeling the keyword/value pairs in a function call.
In Common Lisp, functions may return more than one value via the values form. This is useful when a function generates more than one useful value – for example, to return both a quotient and a remainder from a division function. If the function is called normally, return values beyond the first one are discarded, but if the function is called under multiple-value-bind or similar functions, several return values are captured.
In this document we will often say "if the :foo argument is t …", but in fact any non-nil value will work in such situations. It seems needlessly confusing to say "if :foo is provided and is non-nil…" in dozens of different places.
The curly-brace syntax that
Note: This information refers specifically to
running
To run a saved
lisp
–core /directory/my-filename.core
Of course you would substitute the directory and filename of your choice. This starts a Lisp listener that is ready to continue from whatever state the Lisp was in when the core files was saved.
To create a new core-image file, run lisp, load what you like, and then execute the form (save-lisp "/directory/my-filename.core"), again with the directory and filename of your choice. The system will go through a few steps (garbage collection, “purification” of the core image), then dump the core file and exit.
Note: Saving Lisp files and running the saved
core images cannot be done when you are running as a slave Lisp under the
Hemlock editor front-end. You must use a
“raw” Common Lisp listener for this.
To start up a saved
lisp
–core /directory/my-filename.core –eval "(start-server <port>)"
where <port> is the port number you want the server process to use. If no port is supplied, the default is 6517 – an arbitrary number of no particular significance, except that it looks a bit like the word “LISP” if you stand on your head.
Once this server is running, other application programs can send Lisp forms to the server as text strings, terminated by a newline character. The server will evaluate these forms and print the result (and any additional printed output) back to the socket stream, and also to the window in which the Lisp is running.
To load and run a
1. Start up a Common Lisp system. You are now talking to the Lisp listener.
2. If necessary, compile the Lisp file engine.lisp.
3.
(load "/directory/scone-loader"), using the
directory where the
4. Execute
(scone “version”) to load and start a
specific version of
(setq *default-kb-pathname*)
(pathname "C:/scone/current/kb/anonymous.lisp")
5. Execute (load-kb "core"). This is a script that loads one or more KB files comprising the system’s common knowledge – that is, knowledge that will be useful in almost any real-world application. The unspecified parts of the pathname to this file will be filled in from the default supplied in step 4.
6. Load any additional KB files of your choice. For example, to load a KB file called mythology.lisp from the default KB directory specified in step 3, you could simply type (load-kb "mythology").
7. You can now begin typing expressions into the Lisp listener to augment or query the knowledge base. When you want to end the session, type (quit).
When developing and exploring
You can now type Lisp forms into the editor
window and edit them however you like.
When you type a newline, the form will be passed to the slave lisp
process for evaluation. The result will
be passed back and printed in the same editor buffer. One advantage of working this way is that it
creates a transcript of what you have done.
When building up a new KB file, you may choose to type the
knowledge-creating forms into a running
The knowledge-base (or “KB”) files in
(load-kb filename &key verbose)
Loads the named file, with missing parts of the pathname filled in from the default in *default-kb-pathname*. Does some internal bookkeeping so that the most recent loads can be rolled back if necessary, and so that the system knows it is in non-interactive mode during the load. Often the KB file will effectively be a script that loads a list of other KB files.
If the :verbose argument is t, the result of loading and executing each form in the file will be printed. Example of usage:
(load-kb
“geopolitics” :verbose t)
(checkpoint-kb &optional filename)
Dumps all the elements in the current KB into
a Lisp file with name filename. Any
missing components of the filename are filled in from
*default-kb-pathname*. If not supplied,
filename defaults to "checkpoint".
This does not alter the running
To create a clone of the checkpointed
(checkpoint-new &optional filename)
Like checkpoint-kb, but dumps only the
elements created since the completion of the most recent load-kb. The default filename is "checkpoint-new". To create a clone of the checkpointed
A
An element in
A node represents a conceptual entity such as
“George Washington” or “the typical elephant” or “the mother of
A link represents a relation or statement of some
kind, such as “
A split is conceptually like a link, except that it
connects to any number of elements rather than just two or three. It is used to state that a number of types
and
A relation is an element that defines a new
relation in
The A and B wires are used by links to indicate the two
elements that the link is saying something about. For example, if a link L represents the
statement “Clyde hates Jumbo”, the A wire of element L would go to {Clyde}, the B wire to {Jumbo}, the parent
wire to {hates},
and the context wire to the currently-active context, which is always held in
the dynamic Lisp variable *context*.
Some relations and statements in
In general, the parent wire of a link is used to indicate one superior class of this link in the type hierarchy. In other words, the parent wire tells us what kind of link this is. (A few built-in link types are directly recognizable.) The context wire is used for links to indicate the context in which a given statement is considered to be true.
Every element has a terminal point to which any number of incoming wires from other elements may be attached.
We think of a link as connecting two or three nodes (A and B and maybe C), and representing some statement about the relationship between these nodes: “A is a B” or “A hates B” or whatever. However, the link also is an entity in the knowledge base, representing the statement itself, and we can make statements (sometimes referred to as “meta-statements”) about this statement: who told us this piece of information, how strongly we believe it, whether exceptions are possible, and so on. So each link element really has two parts: the five wires, which are used to implement the statement the link is making, plus the marker bits, terminal point, and connection wires of a node that represents the statement itself. We sometimes refer to this built-in node as the handle node of the link.
Here is another complication: We think of a node as representing an entity, about which we can make various statements by attaching links to it. But every node (except the top-level {thing} node) will be a member of at least one superior class. So to reduce the total number of elements and to speed up some common inferences, we equip each node with a parent wire that serves as a virtual is-a link to one superior class. So the {George Washington} individual-node may have a parent-wire going to the {person} type-node, rather than an is-a link to {person}.
While this use of a node’s parent-wire significantly
reduces the number of elements required in a
(convert-parent-wire-to-link e &key context)
Argument e is an element.
Convert its parent-wire to a full-fledged is-a link, returning the new
link element. Optionally, supply a :context for the new
link; the default is the current value of *context*.
Returns a Lisp string (such as "Integer")
that
(node?
e)
(link? e)
Predicates to test whether element e is a node or link.
(connect-a-wire from to &optional may-defer)
(connect-b-wire from to &optional
may-defer)
(connect-c-wire from to &optional
may-defer)
(connect-parent-wire
from to &optional may-defer)
(connect-context-wire
from to &optional may-defer)
(connect-split-wire
from to &optional may-defer)
Low-level functions to connect the designated wire of the from element to the terminal point of the to element. If specified the wire of the from unit is already connected to some other element, disconnect it first.
If the to
argument is a name that does not yet refer to an existing element, check the may-defer
argument. If it is nil (the default), signal an error; if
it is t, push the
connection request onto the *deferred-connections*
list for later processing.
(disconnect-a-wire from)
(disconnect-b-wire from)
(disconnect-c-wire
from)
(disconnect-parent-wire
from)
(disconnect-context-wire
from)
(disconnect-split-wire
from to)
(disconnect-split-wires
from)
Low-level functions to disconnect the designated
wire of the from element from whatever it is
connected to. If that wire is not
currently connected, do nothing. The disconnect-split-wires
function disconnects all the split wires emanating from the from element. The disconnect-split-wire disconnects only
one split-wire, to the specified to
element.
(find-a-wire e)
(find-b-wire e)
(find-c-wire e)
(find-parent-wire e)
(find-context-wire e)
(find-split-wires e)
(find-wire e wire)
These are low-level functions for accessing the element connected to each of the wires of element e. The split-wires function returns a list of elements; the others return a single element. The find-wire function dispatches on its wire argument (one of :a, :b, :c, :parent, :context, or :split) and calls one of the other functions in this group.
(find-incoming-a-wires e)
(find-incoming-b-wires e)
(find-incoming-c-wires e)
(find-incoming-parent-wires
e)
(find-incoming-context-wires
e)
(find-incoming-split-wires
e)
(find-incoming-wires e)
These are low-level functions that return the list of other elements whose various wires are connected to element e. The returned list may be nil. The find-incoming-wires function dispatches on its wire argument (one of :a, :b, :c, :parent, :context, or :split) and calls one of the other functions in this group.
Every
Every
Every
Markers are normally allocated and used in pairs, a positive-marker used to mark some set of elements and an associated cancel-marker. The cancel-marker is placed on elements definitely not in the set marked with the positive marker and also on links that are cancelled when considering at this set. We speak of a user marker and its cancel marker together as a marker-pair.
The number of possible marker pairs, as well as the number of positive markers, is indicated by the constant n-marker-pairs, which will be half of n-markers (rounded down). In the current implementation n-marker-pairs is 14. So markers numbered 0-13 are positive markers, and markers 14-27 are the corresponding cancel markers. When given a positive marker m, the function (cancel-marker m) will return the corresponding cancel marker.
Some marker-pairs are
reserved for special purposes during marker scans and other operations. These are the highest-numbered marker-pairs;
markers assigned dynamically normally start at 0 and work upward. Lisp constants are used to give symbolic
names to these pre-assigned markers. Users
should use these names and not the numeric values, which may change in future
releases.
Used to mark the current value of *context* and its
superiors in the is-a hierarchy.
Used to mark all the links that are active in the current context.
The lowest-level commands to which the
It is possible for one set of markers to affect the propagations of other markers. For example, we might activate a set of links by placing marker 1 on them, and cancel a few of those links by placing marker 2 on them. We then propagate marker 3 using only links that have marker 1 set and that do not have marker 2 set.
Note that these are examples of the lowest-level
operations performed by
(get-element-property e property)
Find and return the specified property of element e. The property argument is typically a Lisp keyword.
(set-element-property e property &optional value)
Set the specified property of element e to value.
If value
is not supplied, the default value is t. Returns value.
Given a marker m, return the corresponding
cancel-marker.
Predicate to determine whether element e has marker m turned on.
Predicate to determine whether element e has marker m turned off.
Returns the number of elements currently marked with
m.
Prints a table showing the number of elements marked
with each marker.
Marks element e with marker m. If e is already marked with m, do nothing. Return
the number of elements marked with m after this operation.
Marks every node in the KB with marker m. Return the number of elements marked with m after this operation.
Removes marker m from element e.
If e is
not marked with m,
do nothing. Return the number of elements marked with m after this operation.
Clears marker m from all elements in the KB.
Clears both marker m and the corresponding cancel marker.
Clears all markers from all elements in the KB.
(mark-boolean m must-be-set must-be-clear)
The m argument is a marker. The must-be-set and must-be-clear arguments are lists of markers. Conceptually, we scan every element in the KB. If all of the must-be-set markers are on and none of the must-be-clear markers are on, turn on marker m for this element. Returns the number of elements marked with m after this operation.
So, for example, (mark-boolean 3 '(0 1) '(2)) places
marker 3 on every element that is currently marked with 0 and 1 and that is not
marked with 2.
(unmark-boolean m must-be-set must-be-clear)
Like mark-boolean,
but clears marker m
from the selected elements.
Reserve one of the free markers and return its
Clear marker-pair m and return this pair to the pool of
available marker-pairs. Note: in most
cases, you probably want to use with-temp-markers,
described below.
(with-temp-markers ( <variables> ) <body forms> )
This macro is used to temporarily allocate one or
more markers. The freshly allocated markers
are bound to the variables in the variables list. The body forms are then executed in order. Body forms may refer to these variables, but
should not modify them. The value (or
multiple values) of the last body-form are returned. The temporary markers are freed upon exit
from with-temp-markers, even if it is a non-local exit (throw or error). Example of
(with-temp-markers
(m1 m2)
(upscan {foo} m1)
(upscan {bar} m2)
(+ (marker-count m1) (marker-count
m2)))
Many of the
Alternatively, you can refer to an element by its name. There are two kinds of element names in
An internal name such as {George Washington} refers uniquely and unambiguously
to a specific
Internal names are surrounded by “curly braces”. So, for example, the internal name of the
node at the top of the type hierarchy can be referred to as {thing}.
This curly-brace notation can be used wherever a
These iname strings are matched in a case-insensitive way;
that is, {
Internal name strings may contain spaces and other
punctuation characters, but not the colon character, which is reserved for
another use (see below). So, for
example,
{mother of
Internal names are organized into namespaces. Within its namespace, an internal name must be unique. That is, it refers to only one element. Any attempt to create a second node with the same iname in a given namespace is an error.
Namespaces are designated by Common Lisp strings such as "common" or "astronomy". These namespace names must be globally
unique so that accidental collisions do not occur if we try to combine separately
developed knowledge bases. An informal
registry of
To designate an internal name without any danger of ambiguity we use its full name. This is a Common Lisp string divided into two parts by a colon. The part of the string before the colon designates the namespace, while the part after the colon is the unique internal name within that namespace. So {biology:mouse} and {computer:mouse} may co-exist without creating a conflict. There may be only one colon in an internal name string.
There is a function called in-namespace that takes a string as an argument. That string is converted to a namespace object, which becomes the value of the *namespace* variable. Whenever the system is given an iname without a colon in it (referred to as a short name), the value of the *namespace* variable is used as the default namespace. Typically a KB file will have an in-namespace form at the start and will use short-names internally, except when it is necessary to refer to an iname in another namespace.
A namespace may optionally include one other namespace, which may include another, and so on, forming a chain. If an attempt is made to look up an internal name in a given namespace and the iname is not found there, the system will look in the included namespace (if any) and then in its included namespace, and so on until the end of the chain is reached. If the iname is not found anywhere in this chain of namespaces, the name is undefined.
If we create a new iname, it will be placed directly into the current *namespace*, but an error will be signaled if the name conflicts with the same namestring in any included namespace. This namespace-inclusion mechanism is often used to include the "common" namespace in some more specialized namespace that the user is creating, so that elements like {common:thing} and {common:part} can be referred to simply as {thing} and {part}.
Links normally do not have internal names. However, if you believe that you will want to refer to a specific link, you can give it an internal name via the :iname keyword argument of the “add” function that creates the link.
For elements that represent primitive Lisp data types,
such as numbers, functions, or strings, the Lisp object itself is used as the
iname and there is
When loading a KB file, a reference to an undefined element normally signals an error. However, there are some situations where it is useful to allow forward or circular references. (This occurs, for example, in the “bootstrap.lisp” file that defines the root structures in the knowledge base.) In such situations, set *defer-unknown-connections* to t in that file. When this variable is t, unknown element references are pushed onto the *deferred-connections* list, and the engine will try to complete the connection at a later time. The load-kb function calls process-deferred-connections after each file is loaded. Users may also call process-deferred-connections directly.
(lookup-element e &optional syntax-tag)
This takes an element-designator e (an element object, internal name, or
external name string) and returns the corresponding element object. If the
argument does not correspond to an existing element in the KB, the argument is
returned unchanged. The optional syntax-tag argument may
be supplied to constrain the lookup of external names (see the discussion in
the English Names section of this manual). If this function is given a string
argument and successfully finds an element, it returns the element's syntax-tag
as the second return value.
(lookup-element-predicate e &optional syntax-tag)
(lookup-element-test e &optional syntax-tag)
Like lookup-element,
but the behavior is different if the named element does not exist. lookup-element-predicate returns nil in this case, while
lookup-element-test
signals an error.
Return the full internal name (namespace-colon-name)
of element e as a
string.
(extract-namespace string)
(extract-name string)
Given a string that may designate an element, these return the
part before the colon and the part after the colon, respectively. The returned value is a new string. If there is no colon, extract-namespace returns nil and extract-name returns the
string argument
unchanged.
(make-namespace name &key include)
Create a new empty namespace object with the
specified name (a
Lisp string). If the :include argument is supplied, this
indicates an existing namespace that is included in the new one. The :include argument may be either a namespace object or a
string designating a namespace.
(in-namespace name &key include)
The namespace designated by the name string becomes the new default
namespace (the value of the *namespace*
variable). If the specified namespace
does not already exist, it is created, using the :include argument if one is present.
(process-deferred-connections)
Normally we build a
When *defer-unknown-connections* is t and an element-creation routine is told to connect a wire to some element, specified by its iname, and if no such element exists at present in the KB, we push an entry onto the *deferred-connections* list so that we can try to create the connection later, after additional elements have been created or loaded. This allows us to handle situations with forward or circular references, even if the circularities span multiple file boundaries.
The process-deferred-connections function says that we should scan the *deferred-connections* list now to see if any of the deferred connections can now be created. Any connections successfully processed are removed from the *deferred-connections* list; the rest remain on the list. This function is called after loading each new KB file, but users may occasionally want to call it directly.
A long-term goal for
While most of the machinery for natural-language input and
output is external to the
The mapping between external names and
Note that the name strings are matched exactly, except
that the match is case-insensitive. At present there is no spelling correction
or “find an approximate match” capability.
In general, external name strings should be entered in lower-case,
except in the case of proper nouns like “
Each mapping of a name-string to an element has an
associated syntax-tag. This is a
Lisp keyword that corresponds roughly to the part of speech associated with the
name-string. This allows the NL
machinery to return only those
Note: This syntax-tag mechanism is something of a
place-holder for now. Once the natural-language interface to
For now, the following syntax-tags are defined:
:noun
Either a common name or a proper name for the
entities represented by the element. "
:adj
An adjective like "blue", which represents
a unary predicate of some kind, and is generally associated with a
:adj-noun
A word like "solid" that can be used
either as a noun or as an adjective.
These are very common in English.
:role
A word like "population" that designates a
role under some type node. Normally this
used with "of" or a possessive form: "the population of
:inverse-role
Name given to the inverse of a role relation. For example, if the role name is “parent”,
the inverse-role may be “child”. So if
we are told that "John is the child of Mary", the natural-language
machinery can convert this to "Mary is the parent of John".
:relation
A word like "employs" or "hates"
or a phrase like "taller than" representing some relation that is (grammatically)
not a role.
:inverse-relation
Name given to the inverse of a relation. For example, if the relation name is “taller
than”, the inverse-relation may be “shorter than”. So if we are told that "John shorter
than Mary", the natural-language machinery can convert this to "Mary
is taller than John".
:action
An action verb such as "hit".
See the function lookup-element, lookup-element-predicate, and lookup-element-test in the previous
section. These are used to convert a
string (and optional syntax-tag) to a single
(lookup-definitions string &optional syntax-tag)
Returns a list containing all the meanings of the string argument (if
any). Each meaning in the list will be
of the form (element .
syntax-tag). If the syntax-tag argument is
supplied, construct and return a list containing only meanings with the
specified syntax tag. This function
works only for external name strings and is called by the other functions of
the lookup-element family.
(disambiguate name definitions &optional
syntax-tag)
Given a list of definitions, as returned by lookup-definitions,
plus the name and (optional) syntax-tag
used to obtain this list, interactively query the user to see which definition
he wants. Return the selected
(get-english-names element &optional syntax-tag)
Returns a list of all the names associated with element (if any). Each name will be of the form (string . syntax-tag). If a syntax-tag argument is supplied, construct and return a
list containing only names of the specified type.
Define one or more English names for the specified element. The remaining arguments after element are
strings or syntax tags (keywords).
Initially, we assume that each string becomes an English name of element
with syntax-tag :noun,
but the tag changes in a sticky way whenever a different syntax-tag is
encountered. If the special syntax-tag :iname is encountered,
that
For example, the form
(english {swamp} :iname
"wetland" "marsh" :adj "soggy" "marshy")
says that the element {swamp}
has English names "swamp",
"wetland",
and "marsh"
(all nouns), plus the adjectives "soggy"
and "marshy"
(as in "soggy area" or "marshy area").
(register-definition string element syntax-tag)
Associates string
with element,
with the given syntax-tag.
(unregister-definition string element)
Remove all name-meaning associations between string and element, regardless of
syntax-tag.
(unregister-all-names element)
Remove all the names (regardless of syntax-tag)
associated with element. This is useful when removing the element or
to correct errors.
(mark-named-elements string m &optional syntax-tag)
All the elements associated with the name string are marked with
marker m. If syntax-tag is supplied, only meanings of the specified
type are marked.
(list-synonyms string &optional syntax-tag)
(show-synonyms name-string &optional syntax-tag)
The list-synonyms
function finds all the elements that are registered as a meaning of string in the KB. For each of these it returns a list, each element of which has a
A scone element may be a node, a link, a relation, or a split. Each of these may have some subtypes. We will describe the various built-in element types in this section, along with the low-level functions that create them and the predicates that recognize them.
Each type of
All of these new-functions have certain features in common. All will create at least one new element in the KB, and the new element object created (or the primary element created, if there are more than one) is returned as the value of executing the new-function. A knowledge-base (or KB) file is just a collection of such new-functions, with perhaps some comments and other functions mixed in.
New-functions that create a node, such as new-indv, generally take two required arguments, the internal name of the new node and the parent node. So a typical call might be something like
(new-indv
{
Most new-functions that create a link take two required arguments, the two elements that the link connects, called the A and B arguments. So a typical call might be something like
(new-is-a
{
The new-function for general statements takes three required arguments, as in
(new-statement
{
In this case, {
All new-functions take optional keyword arguments. The :context argument, if present, must be an element . This creates context-wire connections described above. The :context argument, if not supplied, usually defaults to the value of *context*, whose default value is the {general} context node. If you are creating a lot of new elements in some other context (such as {Harry Potter world}), it is probably easier to temporarily rebind *context* using in-context than to provide a :context argument for every new-call.
If iname is not a required argument for an new-function, it is still possible to add an internal name to the new element using the optional :iname keyword argument. As a rule, you should give the element a name if you think it may be necessary for some other element or external software to refer to it.
Where an iname
argument is required, a value of nil
tells
(new-indv
nil {elephant})
the new
Most of the new-functions take an :english keyword argument. This takes a list of names and syntax tags that is interpreted as in the english function. So, for example, we might see a form like this:
(new-type {swamp} {geographical area}
:english '(:iname
"wetland" "marsh" :adj "soggy"
"marshy"))
This creates new type of land area with internal name {swamp} and English names "swamp", "wetland", "marsh", and adjective names "soggy" and "marshy".
By default, the new-element's internal name becomes its
English name (or one of them), with a syntax-tag that is the default for
elements of this type: :noun
for most indv and type nodes, :role
for new roles, and :relation
for new relations. This is in addition
to whatever names are given by the :english keyword argument. However, if the first element of the :english argument is a
syntax-tag, the iname gets that syntax tag instead of the default. If you don't want the internal name to become
an English name at all, put the tag :no-iname in the :english list. As
a rule, internal names that the
So, for example, if we execute the form
(add-indv
{gizmo} {frobnitz} :english ("foo" "bar"))
the new {gizmo} node would have English names "gizmo", "foo" and "bar", all with the syntax-tag :noun. But for the form
(add-indv
{noisy} {sound level} :english '(:adj "loud"))
the new {noisy}
node has English names "noisy"
and "loud",
both with syntax-tag :adj.
An individual node (or indv-node) represents
an
An indv-node may be proper or generic. A proper individual node represents a
specific, first-class individual such as {George Washington} or {
A generic individual node represents some role or defined
individual, such as "
Some
If the caller supplies a :parent argument to new-indv, the parent-wire of the new indv-node is
connected to the specified parent node.
This is equivalent in function to creating an is-a link between the new
node and the parent. If the caller
supplies a :context
argument, this creates an {exists
for} statement from the new individual to the context, indicating
the context in which this new
(new-indv iname parent &key context generic definition english)
This creates a new individual with the specified iname and parent. (As noted above, if the iname argument is nil the system will make up a unique
name.) The user may optionally specify a
:context argument
(defaults to the value of *context*). If :generic is true, the new node is marked as a generic
individual; otherwise, it is marked as a proper individual. If :definition is present, mark this as a defined individual
and record the definition. The :english argument is
used to supply one or more English names for the new element, as described
above.
(new-number value &key
parent)
(new-integer value &key parent)
(new-ratio value &key parent)
(new-float value &key parent)
(new-string value &key parent)
(new-function value &key parent)
These functions create new
(indv-node? e)
(generic-indv-node? e)
(proper-indv-node? e)
(number-node? E)
(integer-node? e)
(ratio-node? e)
(float-node? e)
(string-node? e)
(function-node? e)
(context-node? e)
These are predicate functions that return t if argument e is an element of the specified type, and nil otherwise.
A type-node represents the typical member of
some class or set: {elephant},
{theory}, {weekday}, and so on. You can attach properties and
class-memberships to a type-node just as if it were an
Note that a type node represents the typical member of a set and not the set itself. For every type node, there is an implicit set-node that does represent the set. However, we don't actually create the set node until/unless we have something to say about the set – perhaps its cardinality. The find-set-node function accesses any existing set-node associated with a given type-node; the get-set-node function does the same thing, but creates the set-node if it doesn't already exist. If you have a set-node and want to access the associated type-node, use the find-type-node function.
As with new-indv,
the new-type
function optionally takes a
:context argument,
which translates into an {exists
for} statement. The :n argument is used to
(new-type iname parent &key context definition n english)
Creates and returns a new type-node with the
specified iname
(which will be created if the iname is nil) and parent. Optionally, the caller may supply the :context, and :english names. If :definition is present, mark this as a defined type and
record the definition.
(new-intersection-type iname parents &key context
english)
Creates and returns a new type node with name iname that represents, by definition, the intersection of the types in the parents list.
Note: As of today, the type node is created and the
definition is recorded, but the machinery to detect members of this defined
class is not yet present.
(new-union-type iname subtypes &key parent context
english)
The subtypes argument is a list of types or individuals. Creates and returns a new type node with name iname that represents, by definition, the union of these subtypes. That is, any member of this new type must be a member of exactly one of the subtypes. This restriction is enforced by creating a complete-split element. The user may optionally provide a :parent for the new type; the default is {thing}.
Find and return any existing set-node associated
with element e,
which must be a type-node.
Return the set-node associated with element e, creating it if necessary.
The e
argument must be a set-node (an indv node descended from {set}). Returns the type node representing the set’s
typical member.
Predicate, returns t if element e is a type-node, nil otherwise.
An is-a link says that element A "is a" B in the specified context, and that A should inherit any properties or type-memberships of B. We speak of B as being "above" A in the is-a hierarchy.
If A and B are both type-nodes, this is a subtype relationship; if A is an individual and B is a type, it is an instance-of relationship. The type hierarchy branches in both directions (multiple inheritance), so a node may have any number of incoming and outgoing is-a links. As noted earlier, a node's parent wire may take the place of one of these outgoing is-a links.
(new-is-a a b &key context iname english)
Creates and returns an is-a link from a to b.
Optionally, the user may specify the :context, which defaults to the current
value of *context*. Internal and English names may also be
supplied.
Predicate.
Returns t
if element e is
an is-a link, nil
otherwise.
An EQ link says that A and B are equivalent – the
represent the same entity – in the specified context. A inherits all the properties of B and B
inherits all the properties of A. It is
common to equate a proper individual with a generic individual, or two generic
(new-eq a b &key context iname english)
Creates and returns an eq link from a to b.
Optionally, the user may specify the :context, which defaults to the current
value of *context*. Internal and English names may also be
supplied.
Predicate.
Returns t
if element e is
an eq-link, nil
otherwise.
Suppose the knowledge base has a {hates} statement from {elephant} to {snake},
We could also cancel snake-hating for an entire sub-class of elephants, such as {African elephant} by connecting the cancel-link from that type-node to the hates statement. Or we could tie the cancel-link to a context: perhaps in {snake fantasy world}, everything is the same as in {general} – the real-world context – except that elephants do not hate snakes.
Cancel links are intended to cancel statements, but not class-memberships. For that, use an is-not-a link.
(new-cancel a b &key context iname english)
Creates and returns an eq link from a to b.
Optionally, the user may specify the :context, which defaults to the current
value of *context*. Internal and English names may also be
supplied.
Predicate. Returns t if element e is a cancel-link, nil otherwise.
A relation has an internal name or iname such as {taller than} or {employs}, naming the relation that holds from A to B.
The new-relation function creates a new relation-element whose wires are connected to the specified :a, :b, and (optionally) :c arguments. The :a element represents the domain of the relation, or rather the typical member of the domain set; the :b element represents the typical member of the range; the :c element, if present, is some value that is a function of a specific A and B. For example, a relation might represent the distance between A and B, with the C role being the value.
A very common situation is that the caller of new-relation will want to
create a new
So, for example the user might create a new relation as follows:
(new-relation
{reports to} :a-inst-of {person} :b-inst-of {person})
This says that when we create a {reports to} statement, both the A and B
elements must be instances of {person}. But not every {person} is involved in a {reports to} relation.
The parent wire of the relation element may connect to a more general relation, forming a type hierarchy of relations. For example, the parent of the {hates} relation might be {dislikes}, since we think of "hate" as a more specific kind of "dislike" – a particularly intense dislike.
Relations may be marked as transitive and/or symmetric,
and these attributes are inherited by the relation's subtypes and instances
(statements). If we have a symmetric
relation such as {touches},
and we know that A touches B, it is not necessary to also state that B touches
A.
While we can create role relationships directly by creating an interlinked set of new elements, we normally do this using the new-indv-role and new-type-role functions. If we want to say that the typical elephant has a trunk, we might use the following form:
(new-indv-role
{trunk} {elephant} :parent {body part})
This form performs three functions: it creates a new
role-node {trunk}
with {body part}
as its parent, it creates a relation-element named {has-trunk}, and it creates an {exists for} statement
Similarly, if we want to create a type-role, for example to say that every elephant has four legs, we can do something like this:
(new-type-role
{elephant-leg} {elephant} :parent {body part} :n 4)
These role-creation forms accept a :may-have
argument which, if present, indicates that the role may or may not be present
for a given instance of the owner. If :may-have
is present, we do not create the {exists
for} statement, but just the role-node and the relation element.
Define and return a new relation element whose name
is iname. The caller may supply :a, :b, and (optionally) :c elements directly. If the caller supplies :a-inst-of, followed by a parent
element, instead of :a,
create a new
Optionally, we may provide a :parent element and :english names for the relation element
itself, and we may mark the relation as :symmetric and :transitive As explained above, the internal name of the
new relation element becomes one of the element's English names, with
syntax-tag :relation,
unless :no-iname is included in the :english argument.
A predicate.
Returns t
if element e is a
relation element, nil
otherwise.
(new-indv-role iname owner parent &key context
may-have english)
Creates a new generic
If :may-have
is present, it
(new-type-role iname owner parent &key context n
may-have english)
Like new-indv-role,
but create a type-node instead of an
Once a relation has been defined, we can create statement links that instantiates that relation.
(new-statement a rel b &key context c iname
english)
Creates and returns a statement link representing the statement "a rel b". For example, we might say something like this:
(new-statement
{
The rel argument must be a relation element or another statement. The a and b arguments must be compatible with the a and b elements of rel, respectively. If the superior rel has a c-node, we can supply a :c argument to the statement.
Optionally, the user may specify the :context, which
defaults to the current value of *context*. Internal and English names for the statement
may also be supplied.
Predicate. Returns t if element e is a statement-link, nil otherwise.
A split is like a link or statement, but with any
number of split-wires instead of single
A and B wires. The meaning is that the
type nodes connected by the split wires are mutually disjoint: no individual
can be an instance of more than one of these types. If some of the connected nodes are
individuals, they are disjoint from one another and are not instances of any
types in the split.
So, for example, we might say
(new-split '({bird} {reptile} {mammal}))
to
A complete split is like a split, but it makes the
additional claim that the split classes, taken together, cover all the members
of some supertype. Put another way,
every member of the supertype must belong to exactly one of the types in the
complete split. So we might say
something like this:
(new-complete-split {vertebrate}
'({fish} {amphibian} {reptile} {bird}
{mammal})
A given type may have multiple splits and complete splits
under it:
(new-complete-split {person} '({male} {female}))
(new-complete-split {person} '({child} {adolescent}
{adult}))
Once a split is in place, and attempt to violate the split will be detected. However, it is possible to use a cancel-link to turn off the split for a particular individual if, for example, we want to create an individual who is both a male and a female. (However, if we do this, we may have to use a number of additional cancellations to deal with conflicting properties of this hybrid entity.)
(new-split members &key context iname english)
The members
argument is a list containing any number of
elements, usually type and individual nodes. Create and return a split element stating
that all of the members are disjoint. Optionally, the user may specify the :context in which the
split is effective, which defaults to the current value of *context*. Internal and English names for the split element
may also be supplied.
(new-complete-split supertype members &key context
iname english)
Like new-split, but also states that any instance of
the supertype
must belong to exactly one of the members.
Add one new-item to the members of the specified split, which may be a
complete split.
Predicates. Return t if element e is of the specified type, nil otherwise. Note that a complete-split is also a split.
For every type of link in
So, for example, we might say
(new-is-not-a {penguin} {flying thing})
which would negate the {flying thing} membership that would otherwise be
inherited via {bird}.
Similarly, we might say
(new-not-statement {Clyde} {hates}
{Ernie})
This statement would allow us to answer no, rather than
"don't know", if anyone asks whether Clyde hates Ernie, and it could
signal a conflict alert if later we try to claim that Clyde does hate Ernie.
(new-is-not-a a b &key context iname english)
(new-not-eq a b &key context
iname english)
(new-not-statement
a rel b &key context iname english)
These functions create and return a statement of the specified kind, contradicting any corresponding non-negated statement.
(is-not-a-link? e)
(is-not-eq-link? e)
(not-statement-link?
e)
Predicates. Return t if element e is of the specified type, nil otherwise.
These functions create multiple new subtypes or members in a given class.
In each case, the members argument is a list of items. An item may be an internal name for one of
the new elements in the group, or a list whose first element is the internal
name; in that case, the remainder of the list is treated as an :english argument for
this new element. By default, the iname
becomes one of the English names for the element, with syntax-tag :noun. If the first element of the English list is a
syntax-tag, the iname gets that tag instead.
If you don't want the iname to be used as an English name at all,
include :no-iname
in the list.
(new-split-subtypes parent members
&key context iname english)
Create a set of disjoint subtypes under parent. First we create a new split under parent. The members argument is a list of internal names, one for
each new type-node that is to be created, as described above. Optionally, provide the :context, :iname, and :english names for the new split element. Returns the new split element.
(new-complete-split-subtypes parent members
&key context iname english)
Like new-split-subtypes, but creates a complete split.
&key
context iname english)
Like new-split-subtypes,
but the items become new proper individual nodes rather than subtypes of parent. Creates and returns a split element stating
that all these new indv-nodes are distinct.
(new-complete-members parent members
&key context iname english)
Like new-complete-split-subtypes, but the items become new indv nodes rather than subtypes of parent. In other words, this states that the items list contains all the individual members of the parent set. Returns the new split element.
Beware: Wholesale and random removal of elements can leave the knowledge base in a bad state, with lots of dangling connections that could give rise to anomalous behavior. However, it is sometimes necessary to remove a few elements to repair some error or problem in the knowledge base. It is usually safe to remove the last N elements created, since these refer to earlier elements but earlier elements usually don’t refer to them, except where the deferred-connection mechanism has been used.
Disconnects all wires leading to element e and removes it from
the knowledge base. Returns
the number of elements remaining in the KB.
(remove-last-element &optional n)
Removes the last element in the knowledge-base, or
the last type/set pair. If the n argument (an integer)
is supplied, remove n
elements or pairs. Returns the number of
elements remaining in the KB.
Remove all the elements added by the last loaded
file (and any elements added individually after that file was loaded). Returns the number of elements remaining in the
KB.
(remove-currently-loading-file)
Remove all the elements, starting with the last-created,
until we have removed all elements created by the file that is currently being
loaded. This is useful for backing out of a file-load if an error aborts the
load. Returns the number of elements
remaining in the KB.
The various marker scans are powerful and rather complex
internal functions that perform the pseudo-parallel search and inference in
(upscan start-element m &key one-step augment ignore-context)
Mark start-element with marker m. Propagate this marker upwards, across parent wires and is-a links that are active in the current context, while respecting is-not-a links and cancellations. Eq-links are crossed in both directions. Places the cancel-marker corresponding to m on nodes that explicitly are not considered to be superiors of start-element.
Normally upscan clears the m marker and its cancel-marker before start-element is marked and the scan is performed. However, if the :augment argument is t, we leave any pre-existing m markers in place and they are propagated upward as well.
If the :one-step argument is t, propagate m across only one level of links or wires and then return.
If :ignore-context is true, treat all links as active, regardless of context.
Returns the number of elements marked with m after
the upscan.
(downscan start-element m &key one-step augment ignore-context)
Like upscan, but propagates marker m and its cancel-marker downward from start-element. That is, the direction is from a type to its
subtypes and instances.
(eq-scan start-element m &key one-step augment ignore-context)
Like upscan, but propagates marker m only to elements that are equivalent
to start-element. That is, this does not propagate upward or
downward in the type hierarchy, but only crosses eq links.
Some set of elements has been marked with m and upscanned. Look for any active, non-cancelled splits
that have m on
more than one of the disjoint items. If
there are none, return t,
meaning all is well. If we find an
unhappy split, return nil,
returning the unhappy split element as the second return value. If there are multiple unhappy splits, we just
return the first one we encounter.
Element c becomes the current context. That is, the *context* variable is set to c. The context-marker is then placed on c and upscanned, marking all the superiors of c in the is-a hierarchy. The cancel-marker corresponding to context-marker is placed on any elements cancelled in this context. We then place active-marker on all the links that are active in the new context. New elements are, by default, created in the current *context*.
The functions described in this section are queries or
predicates that do not create new elements in the
The x
and y arguments
are elements. This is a predicate to
determine whether x
is known to be an instance or subtype of
y in the
current context. A result of nil could mean that x is definitely not a y or that we have no
information one way or the other.
The x
and y arguments
are elements. This is a predicate to
determine whether x
is known to be equivalent to y
in the current context.
The x
and y arguments
are elements. This is a predicate to
determine whether x
can be an instance or subtype of y
in the current context. In other words,
if we were to add an is-a link from x to y,
would that violate any splits or other constraints? If
there is no problem, return t. If there is a problem, return nil and, as a second
return value, return the split or other element that is unhappy.
Like can-x-be-a-y?,
but checks whether it is OK to put an eq-link between x and y.
Most of these functions have three versions: a mark version, which marks all the members of some class (such as "instances of animal") with a specified marker; a list version", which returns a list of such elements, suitable for processing by an external Lisp function; and a show version that prints the set of elements in a human-friendly format.
The "show" functions all take some additional keyword arguments that control the printing:
The :n argument, an integer, is the maximum number of items that will be printed. The default is 100.
An :all argument of t over-rides the :n argument and forces printing of all the elements in the result set. The default is nil.
The :last argument, an integer, says to print the last n arguments in the set rather than the first n.
Normally you call a show function with only one of :n, :all, or :last.
The list and show functions generally leave result-marker on the entire set of
elements eligible to be listed or printed.
Prints a table showing how many elements of various
types exist in the KB.
(list-elements)
(show-elements &key n all last)
List or print all the elements in the KB, in the
order in which the elements were defined.
(list-marked m)
(show-marked m &key n all last)
List or print all the elements marked with marker m, in the order in
which the markers were placed.
(list-not-marked m)
(show-not-marked m &key n all
last)
List or print all the elements not marked with marker
m.
(mark-parents e m)
(list-parents e)
(show-parents e &key n all last)
Mark/list/print the immediate superiors of element e in the is-a hierarchy
(in the current context).
(mark-children e m)
(list-children e)
(show-children e &key n all last)
Mark/list/print the immediate descendants of element
e in the is-a
hierarchy (in the current context).
(mark-supertypes e m)
(list-supertypes e)
(show-supertypes e &key n all
last)
Mark/list/print all the elements above e in the is-a hierarchy (in the current
context).
(mark-subtypes e m)
(list-subtypes e)
(show-subtypes e &key n all last)
Mark/list/print all the types below e in the is-a hierarchy (in the current context).
(mark-instances e m)
(list-instances e)
(show-instances e &key n all
last)
Mark/list/print all the instances (indv nodes) under e in the current
context.
(mark-lowermost m1 m2)
(list-lowermost m)
(show-lowermost m &key n all
last)
The mark-lowermost
function examines the set of elements currently marked with m1 and places m2 on the lowermost elements of that set
– that is, on all elements marked with m1 that do not have an immediate descendant that is also
marked with m1. The list-lowermost and show-lowermost functions list/print the lowermost
elements in the set marked with m.
(mark-most-specific m1 m2)
(list-most-specific m)
(show-most-specific
m &key n all last)
The mark-most-specific
function examines the set of nodes currently marked with marker m1 and places m2 on the set of most
specific nodes in the set. That is, it finds
the lowermost elements marked with m1, and from that set selects the proper individual
nodes, if any exist; otherwise, it just selects the set of lowermost
Like list-most-specific, but always return a single element. If the list contains more than one candidate, pick one arbitrarily.
Roles are associated with type-nodes by the new-indv-role and new-type-role functions described earlier. Once a role has been created for some type, the functions below can be used to attach roles and values to instances of that type. Other functions are used to make queries about roles and values without creating new structure in the KB.
The function x-is-the-y-of-z finds or creates the node
representing “the y of z”. Check whether
x can be equated
to this node without causing any errors.
If so, create an eq-link between the role node and x.
Return the new eq-link.
Alternative form, equivalent in function to x-is-the-y-of-z,
respectively, but with different argument order. It can be hard to remember which form
The function x-is-a-y-of-z finds or creates the node representing
"the y of z". This should be a
type-node. Check whether x can be of this
type. If so, create and return an is-a
link from x to
this node.
The function the-x-of-y-is-a-z finds or creates the node representing "the x of y". Check whether this node can be of type z. If so, create an is-a link from this node to type-node z. Return the new is-a link.
These functions create no new structure in the KB.
(can-x-have-a-y?
x y)
The x
and y arguments
are elements. This predicated determines
whether a y-role is defined for element x.
(The y
argument may be either the role-node or the relation-link.) If x can have a y, return three values: t, the relation element, and the
role-node.
Element e should be a relation or statement. Find and return the associated role node of
the link. Normally we look for the
role-node on the b-wire of e,
but a different wire can be specified, as in :wire :c. If e is already a role-node, just return it.
Element e should be a role-node of some statement or relation. Find and return the associated link. If e is already a link, just return it.
(mark-roles e m)
(list-roles e)
(show-roles e &key n all last)
Mark/list/print the roles attached to element e in the current
context, whether these are directly connected or inherited.
(find-the-x-of-y x y)
(get-the-x-of-y x y)
These are synonyms for one another. Find a specific proper individual node
representing the x
role of y, and
return this node if it exists.
Otherwise, return nil. These functions
Return the most specific element whose y role is filled by x, or nil if no such element is known.
(find-the-x-role-of-y x y)
(get-the-x-role-of-y x y &key iname english)
The function find-the-x-role-of-y locates and returns a role-node specifically representing the x role of y. This role-node must be directly connected to y, and not inherited. If no such node exists, return nil. If the node does exist, the link between it and y is returned as the function’s second value.
The function get-the-x-role-of-y is identical to the
“find” version, but if no role-node is found, it creates one and returns it,
again with the associated link as the second value. Usually the goal in calling this function is
to obtain the node so that we can say something about it. The x-role of y must already have been defined for
some superior of y.
If :iname
or :english
arguments are supplied, these supply a name or names for the newly created
role-node. If not, we make up a suitable
iname.
(mark-all-x-of-y x y m)
(list-all-x-of-y x y)
(show-all-x-of-y)
Use find-the-x-of-y
to identify the type-role node representing "the x of y". Then
downscan using marker m
to mark all the subtypes and
The list and show versions are similar, but they
list or print the lowermost nodes in the marked set, and then clear the m marker.
This predicate determines whether element x can legally be the y of z, without violating any splits
A predicate.
Checks whether x
can be an instance or subtype of the specified role (which should be a
type-role).
These functions access information represented as relation elements and statement-links.
A predicate that tests whether "a rel b" is
true in the current context. If so, the
second return value is the link that actually states this fact (if there is a
single link that does this). The third
return value is that link’s c-node, if any.
If the predicate is false, return only the single value nil.
(mark-rel a rel m &key downscan)
(List-rel a rel)
(show-rel a rel &key n all last)
The a argument is an element. The rel argument is a relation-node. The mark-rel function places marker m on all elements b for which the statement "a rel b" is known to be true in the current context. Then downscan marker m unless the :downscan argument is explicitly nil. Returns the number of elements marked with m after this operation.
The list-rel
and show-rel
functions list and print the set of elements that mark-rel would mark. The show-rel function takes the same :n, :all, and :last arguments that the other
show-function take.
(mark-rel-inverse m rel b &key downscan)
(list-rel-inverse rel b)
(show-rel-inverse rel b &key n
all last)
Like mark-rel and friends, but here we cross the statement links in the opposite direction. That is, we mark/list/print all elements a such that "a rel b".
(Coming soon.)
(decoration control-string &rest arguments)
(commentary control-string &rest arguments)
The decoration and commentary functions are identical in form to the Common Lisp format function, but without a stream argument. The decoration function prints to *declaration-stream*, which may or may not be equivalent to *standard-output*. If that variable is nil, then decoration doesn't print at all.
Similarly, commentary prints to *commentary-stream*, if that is non-null.
The intent is that decoration should be used for headings,
comments on load progress, and other information that is printed for the
benefit of an interactive human user, while commentary is used to print user-visible
comments about deductions that
These commonly-used
functions for creating new network structure are not defined in the
This function creates and returns an individual of type {measure}, which is the combination of a magnitude (i.e. a number) and a unit, which should be an instance of {unit}. So the measure represents something like “16.0 ton”. The magnitude may be an integer, ratio, or a float. A specific sub-type of {measure} is chosen based on the type of unit.
Note that the unit should be a singular form: "ton" rather
than “tons”.
Pre-Assigned Markers
Loading KB Files
(load-kb filename &key verbose)
(checkpoint-kb &optional filename)
(checkpoint-new &optional filename)
Structure of
(convert-parent-wire-to-link e &key context)
(element-type-label e)
(node? e)
(link? e)
(connect-a-wire from to &optional may-defer)
(connect-b-wire from to &optional may-defer)
(connect-c-wire from to &optional may-defer)
(connect-parent-wire from to &optional may-defer)
(connect-context-wire from to &optional may-defer)
(connect-split-wire from to &optional may-defer)
(disconnect-a-wire from)
(disconnect-b-wire from)
(disconnect-c-wire from)
(disconnect-parent-wire from)
(disconnect-context-wire from)
(disconnect-split-wire from to)
(disconnect-split-wires from)
(find-a-wire e)
(find-b-wire e)
(find-c-wire e)
(find-parent-wire e)
(find-context-wire e)
(find-split-wires e)
(find-wire e wire)
(find-incoming-a-wires e)
(find-incoming-b-wires e)
(find-incoming-c-wires e)
(find-incoming-parent-wires e)
(find-incoming-context-wires e)
(find-incoming-split-wires e)
(find-incoming-wires e wire)
Flags, Properties, and Markers
(get-element-property e property)
(set-element-property e property &optional value)
(cancel-marker m)
(marker-on? e m)
(marker-off? e m)
(marker-count m)
(marker-counts)
(mark e m)
(mark-all m)
(unmark e m)
(clear-marker m)
(clear-marker-pair m)
(clear-all-markers)
(mark-boolean m must-be-set must-be-clear)
(unmark-boolean m must-be-set must-be-clear)
(get-marker)
(free-marker m)
(with-temp-markers ( <variables> ) <body
forms> )
Element Internal
(lookup-element e &optional syntax-tag)
(lookup-element-predicate e &optional syntax-tag)
(lookup-element-test e &optional syntax-tag)
(full-iname e)
(extract-namespace string)
(extract-name string)
(make-namespace name &key include)
(in-namespace name &key include)
(process-deferred-connections)
Element External (English)
(lookup-definitions string &optional syntax-tag)
(disambiguate name definitions &optional syntax-tag)
(get-english-names element &optional syntax-tag)
(english element &rest r)
(register-definition string element syntax-tag)
(unregister-definition string element)
(unregister-all-names element)
(mark-named-elements string m &optional syntax-tag)
(list-synonyms string &optional syntax-tag)
(show-synonyms name-string &optional syntax-tag)
(new-indv iname parent &key context generic definition english)
(new-number value &key parent)
(new-integer value &key parent)
(new-ratio value &key parent)
(new-float value &key parent)
(new-string value &key parent)
(new-function value &key parent)
(new-type iname parent &key context definition n english)
(new-intersection-type iname parents &key context
english)
(new-union-type iname subtypes &key parent context
english)
(new-is-a a b &key context iname english)
(new-eq a b &key context iname english)
(new-cancel a b &key context iname english)
(new-relation iname &key a a-inst-of a-type-of b
b-inst-of b-type-of
c c-inst-of c-type-of parent
symmetric transitive english)
(new-statement a rel b &key context c iname english)
(new-indv-role iname owner parent &key context
may-have english)
(new-type-role iname owner parent &key context n
may-have english)
(new-split members &key context iname english)
(new-complete-split supertype members &key
context iname english)
(add-to-split split new-item)
(new-is-not-a a b &key context iname english)
(new-not-eq a b &key context iname english)
(new-not-statement a rel b &key context iname english)
(indv-node? e)
(generic-indv-node? e)
(proper-indv-node? e)
(number-node? e)
(integer-node? e)
(ratio-node? e)
(float-node? e)
(string-node? e)
(function-node? e)
(context-node? e)
(type-node? e)
(is-a-link? e)
(eq-link? e)
(cancel-link? e)
(relation? e)
(statement-link? e)
(split? e)
(complete-split? e)
(is-not-a-link? e)
(is-not-eq-link? e)
(not-statement-link? e)
(find-set-node e)
(get-set-node e)
(find-type-node e)
More Functions to Create Network Structure
(new-split-subtypes parent members
&key context iname english)
(new-complete-split-subtypes parent members
&key context iname english)
(new-members parent members
&key context iname english)
(new-complete-members parent members
&key context iname english)
Removing Elements
(remove-element e)
(remove-last-element &optional n)
(remove-last-loaded-file)
(remove-currently-loading-file)
Marker Scans
(upscan start-element m &key one-step augment ignore-context)
(downscan start-element m &key one-step augment ignore-context)
(eq-scan start-element m &key one-step augment ignore-context)
(splits-ok? m)
(in-context c)
Queries and Predicates
(is-x-a-y? x y)
(is-x-eq-y? x y)
(can-x-be-a-y? x y)
(can-x-eq-y? x y)
Mark, List, and Show Functions
(element-counts)
(list-elements)
(show-elements &key n all last)
(list-marked m)
(show-marked m &key n all last)
(list-not-marked m)
(show-not-marked m &key n all last)
(mark-parents e m)
(list-parents e)
(show-parents e &key n all last)
(mark-children e m)
(list-children e)
(show-children e &key n all last)
(mark-supertypes e m)
(list-supertypes e)
(show-supertypes e &key n all last)
(mark-subtypes e m)
(list-subtypes e)
(show-subtypes e &key n all last)
(mark-instances e m)
(list-instances e)
(show-instances e &key n all last)
(mark-lowermost m m2)
(list-lowermost m)
(show-lowermost m &key n all last)
(mark-most-specific m m1)
(list-most-specific)
(show-most-specific m &key n all last)
(most-specific m)
Roles
(x-is-the-y-of-z x y z)
(the-x-of-y-is-z x y z)
(x-is-a-y-of-z x y z)
(the-x-of-y-is-a-z x y z)
(does-x-have-a-y? x y)
(find-role-node e &key wire)
(find-role-link e)
(mark-roles e m)
(list-roles e)
(show-roles e &key n all last)
(find-the-x-of-y x y)
(get-the-x-of-y x y)
(x-is-the-y-of-what? x y)
(find-the-x-role-of-y x y)
(get-the-x-role-of-y x y &key iname english)
(mark-all-x-of-y x y m)
(list-all-x-of-y x y)
(show-all-x-of-y)
(can-x-be-the-y-of-z? x y z)
(can-x-be-a-y-of-z? x y z)
Relations and Statements
(statement-true? a rel b)
(mark-rel a rel m &key downscan)
(list-rel a rel)
(show-rel a rel &key n all last)
(mark-rel-inverse m rel b &key downscan)
(list-rel-inverse rel b)
(show-rel-inverse rel b &key n all last)
Miscellaneous Functions
(decoration control-string &rest arguments)
(commentary control-string &rest arguments)
Domain-Specific Structure-Creation Functions