Scone User's Guide

 

 

Scott E. Fahlman
Carnegie Mellon University
School
of Computer Science

 

sef@cs.cmu.edu

August 25, 2008

 


Copyright Notice:

 

This manual is copyright © 2003-2008 by Scott E. Fahlman.

Carnegie Mellon University holds the copyright to the Scone software.  The Scone software is made available to the public under the CPL 1.0 Open Source license.  A copy of this license is distributed with the software.  The license can also be found at http://www.opensource.org/licenses/cpl.php.

By using, modifying, reproducing, or distributing the Scone software, you agree to be bound by the terms and conditions set forth in the CPL 1.0 Open Source License.  If you do not agree to these terms and conditions, or if they are not legally applicable in the jurisdiction where such use takes place, then you may not use the Scone software.

Scone incorporates some parts of the NETL2 Knowledge Representation System, developed by Scott E. Fahlman for IBM Corporation between June 2001 and May 2003.  IBM holds the copyright on NETL2 and has made that software available to the author under the CPL 1.0 Open Source license.

 

 

Acknowledgment:

Development of Scone has been supported in part by the Defense Advanced Research Projects Agency (DARPA) under contract NBCHD030010.  Any opinions, findings and conclusions or recommendations expressed in this material are those of the author(s) and do not necessarily reflect the views of DARPA or the Department of Interior-National Business Center (DOI-NBC).


 

 

Table of Contents

 

1.     Overview.. 5

Note on Common Lisp Syntax. 5

2.     Running Scone. 6

3.     Loading and Saving KB Files. 8

Functions. 8

4.     Structure of Scone Elements. 8

Functions. 10

5.     Flags, Properties, and Markers. 11

Functions. 13

6.     Referring to Scone Elements. 15

6.1       Element Internal Names. 15

Functions. 17

6.2       Element External (English) Names. 18

Functions. 20

7.     Scone Elements. 21

7.1       Creating New Elements. 21

7.2       Indv Nodes. 23

Functions. 24

7.3       Type Nodes. 24

Functions. 25

7.4       IS-A Links. 26

Functions. 26

7.5       EQ Links. 26

Functions. 26

7.6       Cancel Links. 27

Functions. 27

7.7       Relations. 27

Functions. 28

7.8       Statement Links. 29

Functions. 29

7.9       Splits and Complete Splits. 30

Functions. 30

7.10     Negations. 31

Functions. 31

8.     More Functions to Create Network Structure. 32

Functions. 32

9.     Removing Elements. 33

Functions. 33

10.       Marker Scans. 33

Functions. 33

11.       Queries and Predicates. 34

Functions. 35

12.       Mark, List, and Show Functions. 35

Functions. 35

13.       Roles. 37

Functions That Create New Structure in the KB.. 37

Query Functions for Roles. 38

14.       Relations and Statements. 39

Functions. 39

15.       Cardinality. 40

16.       Miscellaneous Functions. 40

17.       Domain-Specific Structure-Creation Functions. 40

Functions. 40

18.       Scone Crib Sheet 42

19.       Alphabetical Function List 47

 


1.  Overview

Scone is a knowledge-base (KB) system intended for use as a component in a wide range of software applications.  Scone comprises a search/inference engine and a base-load of common knowledge.  Application-specific knowledge and interfaces to other applications can be added on top of this common base.

The current version of Scone is written in Common Lisp.  The primary vehicle for Scone development is CMU Common Lisp (http://www.cons.org/cmucl/), a free, high-performance implementation of Common Lisp running on Intel/Linux systems.  However, Scone also has been run successfully on commercial Common Lisp systems such as LispWorks and Allegro Common Lisp.

 Scone can be run as a server process on an Intel/Linux system, communicating with other software applications via character-stream I/O using the TCP/IP socket mechanism.  The other software applications may be written in any computer language and may be on the same machine or a different machine on the Internet.

Scone is designed for efficiency of search and inference on conventional high-end workstations, though the Scone architecture was originally designed with parallelism in mind.  Scone is therefore well suited for future implementation on a massively parallel machine or perhaps a computing grid.

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.  Scone attempts to ease this burden by relatively clean design and by separating system-efficiency concerns from knowledge-entry concerns.

This manual covers the operation and functions of the Scone software.  It is not intended to be a tutorial on knowledge representation in Scone.  Such a tutorial document is needed, and it is currently under development.

Note on Common Lisp Syntax

This manual assumes that the reader has some general familiarity with Common Lisp syntax.  As a quick reminder, if this document indicates that a function’s syntax looks like this

(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 Scone uses for element internal names is not standard Common Lisp syntax; it is a Scone-specific extension created using Lisp's character macro facility.

2.   Running Scone

Note: This information refers specifically to running Scone on an Intel/Linux system on which CMU Common Lisp has been installed.

To run a saved Scone core image just type the following at the shell:

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 Scone core image as a TCP/IP server, modify the command line as follows:

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 Scone system from scratch, do the following:

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 Scone engine lives.

4.      Execute (scone “version”) to load and start a specific version of Scone.  The default version is “current”.  As a side-effect of executing this form, the “kb” subdirectory in this version becomes the default location where the system looks for knowledge-base files.  If you want to change this default, execute something like
(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 Scone, you probably want to run the lisp process you are working on as a slave process under Hemlock, an Emacs-like editor.  Start the CMU Common Lisp system by invoking lisp, then when you get a prompt, type (ed).  This should bring up Hemlock, which will create an editor window to work in. Type control-meta-c to start a slave Lisp in its own editor buffer, which will have a name like “Slave 1”.  To create additional slave processes in separate buffers under the same Hemlock, type control-u control-meta-c.

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 Scone process, and then edit the transcript down (removing errors, prompts, etc.) to create a new KB file.

3.  Loading and Saving KB Files

The knowledge-base (or “KB”) files in Scone are just files of Common Lisp expressions and comments, following the syntax of Common Lisp.  Users can easily modify these files offline, using the text-editor of their choice.  (Emacs is recommended, as it has some special facilities for editing and indenting Lisp syntax.)  These files have the extension “.lisp”.  Since these text-format KB files are just Common Lisp source files, any Common Lisp expressions you like may be included in these files, mixed with the Scone-specific expressions that create new elements.

Functions

(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 Scone, so it is safe to checkpoint often.  The elements created by the bootstrap.lisp file are not dumped.

To create a clone of the checkpointed Scone process, start a new Scone process (with bootstrap.lisp already loaded) and then use load-kb to load the checkpoint file.

(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 Scone process, start a new Scone, load the same files as in the original Scone, and then load the checkpoint file.

4.  Structure of Scone Elements

A Scone knowledge base is made up of elements that are connected together to form a semantic network.

An element in Scone can be a node, a link, a split, or a relation.

A node represents a conceptual entity such as “George Washington” or “the typical elephant” or “the mother of Clyde”.  Note that the node represents a specific concept or meaning in each case, not a word or word-definition.  The connection between Scone elements and natural-language words or phrases is a many-to-many association  It is the job of external software (an English-language front-end to Scone) to resolve any ambiguity.

A link represents a relation or statement of some kind, such as “Clyde is an elephant” or “The wife of George is Martha” or “Every elephant hates P. T. Barnum.”

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 individuals are distinct and disjoint.

A relation is an element that defines a new relation in Scone, which can then be instantiated by statement-links.

Scone represents its long-term knowledge in the pattern of interconnections among elements.  In general, nodes are connected by links.  Each link has a few distinct wires by which it can be connected to other elements in the knowledge base.  These are designated a-wire, b-wire,  c-wire, parent-wire, context-wire, and (for split-elements only) a set of split-wires.

 

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 Scone also have a C wire.  This allows us to easily represent trinary relations and statements, such as "the distance from A to B is C".

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 Scone knowledge base, there is a cost: because a parent-wire is not a full-fledged link with an integral handle node, we cannot attach meta-information to this virtual is-a link or cancel it.  If it becomes necessary to do that, we must detach the parent wire and, replace it with a full-fledged is-a link.  The convert-parent-wire-to-link function performs that function.

Functions

(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*.

(element-type-label e)

Returns a Lisp string (such as "Integer") that indicates the type of element e.  This is used mostly in KB browsers and other user interfaces.

(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.

5.  Flags, Properties, and Markers

Every Scone element has a word full of bits representing permanent state information about that element.  These bits are known as the element’s flag bits.  Some of the flag bits are used to encode the type of the node or link: individual vs. type node, “is a” versus “equals” link, and so on.  Other flag bits encode properties of the element, such as whether a statement link is an instance of a transitive relation or whether it is negated.  As a rule, flag bits are intended for internal use by the Scone engine, and are not directly manipulated by users of the Scone system.

Every Scone element also has a property list, storing attribute-value pairs.  The set of attributes is open-ended.  Each attribute is represented by a Common Lisp keyword.  Some properties are defined and used by the Scone implementation, while others may be defined by users or by software external to Scone.

Every Scone element has storage for a number of marker bits, which are set and cleared by the Scone engine as part of  various search and inference operations.  Operations on marker bits generally refer to a specific marker using a numerical index, starting at 0. The constant n-markers indicates the maximum number of marker bits a Scone element can hold: in the current implementation, n-markers is 28, so legal markers are designated by integers 0 through 27.

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.

context-marker

Used to mark the current value of *context* and its superiors in the is-a hierarchy.

active-marker

Used to mark all the links that are active in the current context.

Scone provides simple support for allocating and freeing markers (or marker-pairs) for use by various software operations.  The variable *available-markers* indicates the number of marker-pairs available for allocation at any given time.  The get-marker function selects and reserves one of the available markers and returns its index.  The free-marker function removes a named marker from all Scone elements and returns this marker to the available-markers pool.  The with-temp-markers macro is a convenient way to allocate a temporary marker, use it while executing any number of operations, and then to reliably free it.

 

The lowest-level commands to which the Scone elements can respond generally involve setting and clearing of the marker bits, and propagating markers from one node to another across certain kinds of links.  For example, we might mark the {Clyde} node with marker 3, and then order any is-a link with marker 3 on the node below it in the hierarchy (that is, connected to the link's A-wire) to propagate marker 3 to the node above it (connected to the link's B-wire).  We send this command repeatedly until no new nodes are marked.  The effect of this sequence is to mark {Clyde} and every node above it in the type hierarchy.  These are all the nodes whose properties and relations are inherited by {Clyde}.

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 Scone.  The knowledge-base commands and queries that typical users actually execute are at a much higher level, corresponding to queries such as “What is the capital of France?” or “Does Bolivia have any seaports?”

Functions

(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.

(cancel-marker m)

Given a marker m, return the corresponding cancel-marker.

(marker-on? e m)

Predicate to determine whether element e has marker m turned on.

(marker-off? e m)

Predicate to determine whether element e has marker m turned off.

(marker-count m)

Returns the number of elements currently marked with m.

(marker-counts)

Prints a table showing the number of elements marked with each marker.

(mark e m)

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.

(mark-all m)

Marks every node in the KB with marker m.  Return the number of elements marked with m after this operation.

(unmark e m)

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.

(clear-marker m)

Clears marker m from all elements in the KB.

(clear-marker-pair m)

Clears both marker m and the corresponding cancel marker.

(clear-all-markers)

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.

(get-marker)

Reserve one of the free markers and return its index.

(free-marker m)

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 usage:

(with-temp-markers (m1 m2)
    (upscan {foo} m1)
    (upscan {bar} m2)
    (+ (marker-count m1) (marker-count m2)))

6.  Referring to Scone Elements

Many of the Scone functions described in this document take one or more elements as arguments. Within the running Scone system, each element is represented as a Common Lisp structure (sometimes called a “defstruct”).   If you have a pointer to one of these element-objects, perhaps returned by lookup-element or some other Scone function, you can supply this directly wherever an element is required.

Alternatively, you can refer to an element by its name.  There are two kinds of element names in Scone: internal names (sometimes called inames) and external names, which are  sometimes called “English names”, though other natural languages will eventually be supported. 

An internal name such as {George Washington} refers uniquely and unambiguously to a specific Scone element.  External names are not so constrained: an element may have many external names, and an external name such as "mouse" may refer to several distinct Scone elements – in this case,  one representing the animal mouse and one representing a computer pointing device.  A knowledge-base file can contain both internal and external names, but if a reference is made to an external name with more than one possible meaning. the system may pause and ask for clarification as the file is being loaded.

6.1      Element Internal Names

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 Scone element is required.

These iname strings are matched in a case-insensitive way; that is,  {Clyde},  {clyde}, and {CLYDE} all refer to the same element.  However, Scone remembers the exact string, including case, that was used when an element was first created, and that string is used whenever the system must print out a reference to the element.

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 Clyde} is a legal internal name, and names with spaces are indeed fairly common.

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 Scone namespace names currently in use is maintained by the author.  Contact the author if you want to register a new global namespace.  (Scone may eventually have to move to a more complex universal namespace scheme, of the kind found in XML-based knowledge representations, but we want to delay that move as long as possible.)

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 never a namespace designator.  (These objects are kept in a special universal namespace.)  So {123} designates an element representing an integer, and {12.34} represents a real number.  A set of brackets containing a quoted string, such as {"http://www.cmu.edu"}, is a string element.  Note that the colon in a string element is part of the string, not a namespace designator.  The Scone element {#'query-user} represents a Lisp function named query-user.

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.

Functions

(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.

(full-iname e)

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 Scone knowledge base in orderly layers.  A new element will be connected to other elements that have already been created.  But it some situations it is necessary to create forward references or circular references.  In such cases, we use the “deferred connections” mechanism.  This facility is enabled by placing (setq *defer-unknown-connections* t) at the start of a file that contains forward references.  Normally this variable is nil, and references to unknown elements signal an error.

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.

6.2      Element External (English) Names

A long-term goal for Scone is to interface it to a natural-language input-output system so that users can augment or query the knowledge base in English (or in the natural language of their choice).   At present, the system has only a simple facility for associating words or phrases (represented as Common Lisp strings) with various elements in the knowledge base.  We refer to these words and phrases collectively as external names to distinguish them from the internal element-names described in the previous section.

While most of the machinery for natural-language input and output is external to the Scone inference engine, it makes sense to maintain the dictionary mapping names to elements and elements to names as part of the core Scone system.  When a KB file full of new concepts is loaded into the knowledge base, the external names for these concepts  are loaded at the same time, as part of the information in this file.

The mapping between external names and Scone elements is many-to-many.  Scone provides a simple interface by which an external natural-language system can ask for all the Scone elements (if any) that correspond to a given name.  Similarly, the user can ask for a list of all the names (if any) that correspond to a given element.

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 “Iraq”.  There should be no whitespace surrounding the word or phrase.  In multiple-word strings (representing idiomatic phrases such as "kick the bucket") the words should be separated by a single space.

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 Scone meanings that correspond to the part of speech it has found – for example, the action "fall" rather than a noun representing a season.

Note: This syntax-tag mechanism is something of a place-holder for now. Once the natural-language interface to Scone is further developed, we will have a much better idea of what syntactic machinery really is needed.

For now, the following syntax-tags are defined:

:noun

Either a common name or a proper name for the entities represented by the element.  "Clyde" or "elephant".

:adj

An adjective like "blue", which represents a unary predicate of some kind, and is generally associated with a Scone type-node.  To describe a type, you normally combine this adjective with some noun labeling a supertype of the type-node in question.  So we would normally say "a blue object" or "a blue automobile" rather than just "a blue".

: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 India" or "India's population".

: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".

Functions

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 Scone element.  If the string is ambiguous – that is, if it is associated with more than one Scone element via the given syntax-tag – these functions call disambiguate, which asks the user to pick one of the possible meanings.

(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 Scone element.  Returns that element's syntax-tag as the second value.

 

(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.

(english element &rest r)

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 indicates that the element's internal name is used as one of the English names.  However, if the argument list contains :no-iname, any :iname in the r list is ignored.

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.  Scone users normally use the english function rather than calling this lower-level function directly.

(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 Scone element first, followed by any number of alternative names for that element.  If  syntax-tag is non-null, we look only at elements whose connection to string is of this type.  The show-synonyms function is similar, but it prints out the synonyms it finds instead of returning a list.

7.  Scone Elements

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.

7.1      Creating New Elements

Each type of Scone element has a new-function that creates it: new-indv, new-type, new-is-a, and so on.  These new-functions also check whether the element about to be added conflicts with other information currently in the KB.

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 {Clyde} {elephant}).

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 {Clyde} {elephant}).

The new-function for general statements takes three required arguments, as in

(new-statement {Clyde} {hates} {Ernie}).

In this case, {Clyde} is attached to the a-wire of the new statement link, {Ernie} is attached to the b-wire, and {hates} is the parent of the link.

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 Scone to make up a unique name for the new element.  For example, if we say

(new-indv nil {elephant})

the new individual node will be given a name like {elephant (27)}.

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 Scone system constructs itself are not saved as English names.

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.

7.2      Indv Nodes

An individual node (or indv-node) represents an individual entity rather than a type.  It is not necessarily a physical object: it can be something more abstract, such as a number or a specific date.  Individuals are normally the leaf-nodes of  Scone's is-a hierarchy.

An indv-node may be proper or generic.  A proper individual node represents a specific, first-class individual such as {George Washington} or {Paraguay} or {21 March 1948}.  Normally, proper individuals are assumed to be distinct from one another, and it is an error to equate two of them.  However, in special cases we may choose to over-ride this prohibition, for example to equate {Clark Kent} to {Superman}.

A generic individual node represents some role or defined individual, such as "Clyde's mother" or  "the first elephant on the moon".  Generic individuals can be given properties and relations, just like proper individuals: we can say things like "Clyde's mother is beautiful" or "the first elephant on the moon was an African elephant".  However, generic individuals are not assumed to be distinct from one another – in fact, we may think of a generic individual  as a stand-in for an proper individual to be named later.  It is legal to equate {mother of Clyde} to the proper indv-node {Bertha T. Elephant} or to another generic indv-node like {the first elephant on the moon} or to both of  these at once.

Some individual nodes are primitive individual nodes.  These Scone elements represent Common Lisp objects such as numbers (integers, ratios, or real numbers), strings, or functions.  There are new-functions for the various types of primitive nodes, but you normally create them at read-time by putting the desired Lisp object within curly brackets:  {3}, {22/7}, {3.14159}, {"www.radar.cs.cmu.edu"}, or {#'append}.

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 individual exists.  The default parent is {thing} and the default context is the current value of *context*.

Functions

(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 individual nodes representing various Common Lisp data objects: numbers (of any kind), integers, ratios, floating-point numbers, strings, and functions.   The value argument must be a Lisp object of the proper type.  If another Scone object with this same (eql) Lisp value already exists, we may return the existing object instead of creating a new one.  These objects are all created in the {universal} context.

(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.

7.3      Type Nodes

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 individual:  "The typical elephant is a mammal", "the color of the typical elephant is gray", and so on.  In the way they are used, type-nodes and indv-nodes are very similar, except that individual nodes are normally leaf-nodes in the is-a hierarchy, while type nodes are intended to have subtypes and instances.

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 indicate the number of instances of this type that exist in the specified (or default) context.

Functions

(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-set-node e)

Find and return any existing set-node associated with element e, which must be a type-node.

(get-set-node e)

Return the set-node associated with element e, creating it if necessary.

 

(find-type-node e)

The e argument must be a set-node (an indv node descended from {set}).  Returns the type node representing the set’s typical member.

(type-node? e)

Predicate, returns t if element e is a type-node, nil otherwise.

7.4      IS-A Links

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.

Functions

(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.

(is-a-link? e)

Predicate.  Returns t if element e is an is-a link, nil otherwise.
 

7.5      EQ Links

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 individuals to one another.  The system will complain if you try to equate two proper individuals, though you can ignore the warning and force this.

Functions

(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.

(eq-link? e)

Predicate.  Returns t if element e is an eq-link, nil otherwise.

7.6      Cancel Links

Suppose the knowledge base has a {hates} statement from {elephant} to {snake}, indicating that elephants hate snakes – or, more precisely, that the typical elephant hates the typical snake.  Suppose that Clyde is an elephant, but an atypical one: he doesn't hate snakes.  We can represent this kind of exception using a cancel link from {Clyde} to the {hates} statement inherited from {elephant}.  The effect of the cancel link is to turn off the {hates} statement – to render it inoperative – when Scone is considering the properties of {Clyde}.  The statement is still effective for other elephants.

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.

Functions

(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.

(cancel-link? e)

Predicate.  Returns t if element e is a cancel-link, nil otherwise.

7.7      Relations

Scone allows the user to create new relations and then to instantiate these using statement links.   A relation element is similar in form to a link – it has A, B, and (sometimes) C wires – but it doesn't really make an assertion of any kind.  It is simply a definition or a template for statement links that do make an assertion.

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 individual with a specific parent to be used as the A element of the new relation.  The most convenient way to do this is to supply an :a-inst-of  keyword followed by the parent element, instead of the :a keyword.  That indicates that the new-relation function should create a new individual role node with the specified parent and attach this to the new relation’s a-wire.   The :b-inst-of and :c-inst-of keywords perform the same function for the relation’s other wires.

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.  Scone deduces that.  Similarly, if we have a transitive relation, such as {taller than}, Scone will deduce that if A is taller than B and B is taller than C, then A is taller than C.

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 indicating that every elephant has a trunk, in the absence of an explicit cancellation.  Note that {exists for} is just a normal relation, albeit an important one, and it is instantiated by a normal statement-link.

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.

Functions

(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)

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 individual role node with that parent and connect this new node to the relation’s a-wire.  Similarly for :b-inst-of and :c-inst-of.  The :a-type-of, :b-type-of, and :c-type-of arguments are analogous, but they create new type-role nodes.

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.

(relation? e)

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 indv-node and a relation defining the relation between the owner and this new role-node.  Also creates an {exists for} statement indicating that for every instance of owner, there exists one instance of the role.  The iname is the name of the role-node.  The parent argument is the parent of the new role-node.  The :context is the context in which all of this new structure is created.  The :english argument is used to register English names for the role, with the default syntax-type of :role.  By default, the iname becomes one of the English names.

If :may-have is present, it indicates that only some instances of owner have this role.  No {exists for} statement is created in this case.

(new-type-role iname owner parent &key context n may-have english)

Like new-indv-role, but create a type-node instead of an indv-node.  The :n argument tells how many instances of this role exist for owner or for each instance of the owner type..

7.8      Statement Links

Once a relation has been defined, we can create statement links that instantiates that relation.

Functions

(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 {Clyde} {taller than} {Ernie})

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.

(statement-link? e)

Predicate.  Returns t if element e is a statement-link, nil otherwise.

7.9      Splits and Complete Splits

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.  Scone has efficient machinery for determining whether a new or proposed link causes a split to be violated.

So, for example, we might say

(new-split '({bird} {reptile} {mammal}))

to indicate that these are disjoint types with no common members.  However, there is no claim that the split types exhaust all the possibilities.  There may be other subtypes of {animal} or {vertebrate} that are not listed here.

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.)

Functions

(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-to-split split new-item)

Add one new-item to the members of the specified split, which may be a complete split.

(split? e)

(complete-split? e)

Predicates.  Return t if element e is of the specified type, nil otherwise.  Note that a complete-split is also a split.

7.10 Negations

For every type of link in Scone (except for the cancel link), there is a corresponding negation.  So we have the is-not-a-link, the not-eq-link, and the generic not-statement-link.  These have two uses: they can be used to over-ride an existing (probably inherited) positive statement, or  they can be put in place to guard against any future attempt to make the corresponding positive statement.

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.

Functions

(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.

8.  More Functions to Create Network Structure

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.

Functions

(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.

 

(new-members parent members

     &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.

9.  Removing Elements

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.

Functions

(remove-element e)

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-last-loaded-file)

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.

10.        Marker Scans

The various marker scans are powerful and rather complex internal functions that perform the pseudo-parallel search and inference in Scone.  Once Scone is mature, users will seldom have to deal directly with these scans, but for now they provide the means for writing any search and inference functions that Scone does not supply.

Functions

(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.

(splits-ok? m)

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.

(in-context c)

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*.

11.        Queries and Predicates

The functions described in this section are queries or predicates that do not create new elements in the Scone knowledge base.  Predicates relating to roles (as in "Is Bertha the mother of Clyde?") and to general relations and statements ("Does Bertha love Clyde?") are covered in a later section of this document.

Functions

(is-x-a-y? x y)

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.

(is-x-eq-y? x y)

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.

(can-x-be-a-y? x y)

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.

(can-x-eq-y? x y)

Like can-x-be-a-y?, but checks whether it is OK to put an eq-link between x and y.

12.        Mark, List, and Show Functions

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.

Functions

(element-counts)

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 individuals of any kind.  Intuitively, these "most specific" nodes are the best ones to use in answering a question.  The list-most-specific and show-most-specific functions list/show the most specific elements in the set marked with m.

(most-specific m)

Like list-most-specific, but always return a single element.  If the list contains more than one candidate, pick one arbitrarily.

13.        Roles

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.

Functions That Create New Structure in the KB

(x-is-the-y-of-z x y z)

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.

(the-x-of-y-is-z x y z)

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 Scone supports, so we include both of them.

(x-is-a-y-of-z x y z)

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-x-of-y-is-a-z x y z)

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.

Query Functions for Roles

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.

(find-role-node e &key wire)

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.

(find-role-link e)

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 never create a new element.

(x-is-the-y-of-what? x y)

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 individuals that are below this node in the is-a hierarchy.

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.

(can-x-be-the-y-of-z? x y z)

This predicate determines whether element x can legally be the y of z, without violating any splits

(can-x-be-a-y-of-z? x y z)

A predicate.  Checks whether x can be an instance or subtype of the specified role (which should be a type-role).

14.        Relations and Statements

These functions access information represented as relation elements and statement-links.

Functions

(statement-true? a rel b)

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".

15.        Cardinality

(Coming soon.)

16.        Miscellaneous Functions

(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 Scone makes.

17.        Domain-Specific Structure-Creation Functions

These commonly-used  functions for creating new network structure are not defined in the Scone engine file, but instead are defined in the "core" knowledge base.  They must be defined as part of the knowledge base because they build upon element structures created as the KB files are being loaded.

Functions

(new-measure magnitude unit)

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”.  Scone does not yet have the machinery to deal smoothly with plurals.


18.        Scone Crib Sheet

Pre-Assigned Markers

context-marker
active-marker

Loading KB Files

(load-kb filename &key verbose)
(checkpoint-kb &optional filename)
(checkpoint-new &optional filename)

Structure of Scone Elements

(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 Names

(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) Names

(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)

Scone Elements

(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

(new-measure magnitude unit)


19.        Alphabetical Function List



add-to-split

cancel-link?

cancel-marker

can-x-be-a-y?

can-x-be-a-y-of-z?

can-x-be-the-y-of-z?

can-x-eq-y?

checkpoint-kb

checkpoint-new

clear-all-markers

clear-marker

clear-marker-pair

commentary

complete-split?

connect-a-wire

connect-b-wire

connect-context-wire

connect-c-wire

connect-parent-wire

connect-split-wire

context-node?

convert-parent-wire-to-link

decoration

disambiguate

disconnect-a-wire

disconnect-b-wire

disconnect-context-wire

disconnect-c-wire

disconnect-parent-wire

disconnect-split-wire

disconnect-split-wires

does-x-have-a-y?

downscan

element-counts

element-type-label

english

eq-link?

eq-scan

extract-name

extract-namespace

find-a-wire

find-b-wire

find-context-wire

find-c-wire

find-incoming-a-wires

find-incoming-b-wires

find-incoming-context-wires

find-incoming-c-wires

find-incoming-parent-wires

find-incoming-split-wires

find-incoming-wires

find-parent-wire

find-role-link

find-role-node

find-set-node

find-split-wires

find-the-x-of-y

find-the-x-role-of-y

find-type-node

find-wire

float-node?

free-marker

full-iname

function-node?

generic-indv-node?

get-element-property

get-english-names

get-marker

get-set-node

get-the-x-of-y

get-the-x-role-of-y

in-context

indv-node?

in-namespace

integer-node?

is-a-link?

is-not-a-link?

is-not-eq-link?

is-x-a-y?

is-x-eq-y?

link?

list-all-x-of-y

list-children

list-elements

list-instances

list-lowermost

list-marked

list-most-specific

list-not-marked

list-parents

list-rel

list-rel-inverse

list-roles

list-subtypes

list-supertypes

list-synonyms

load-kb

lookup-definitions

lookup-element

lookup-element-predicate

lookup-element-test

make-namespace

mark

mark-all

mark-all-x-of-y

mark-boolean

mark-children

marker-count

marker-counts

marker-off?

marker-on?

mark-instances

mark-lowermost

mark-most-specific

mark-named-elements

mark-parents

mark-rel

mark-rel-inverse

mark-roles

mark-subtypes

mark-supertypes

most-specific

new-cancel

new-complete-members

new-complete-split

new-complete-split-subtypes

new-eq

new-float

new-function

new-indv

new-indv-role

new-integer

new-intersection-type

new-is-a

new-is-not-a

new-measure

new-members

new-not-eq

new-not-statement

new-number

new-ratio

new-relation

new-split

new-split-subtypes

new-statement

new-string

new-type

new-type-role

new-union-type

node?

not-statement-link?

process-deferred-connections

proper-indv-node?

ratio-node?

register-definition

relation?

remove-currently-loading-file

remove-element

remove-last-element

remove-last-loaded-file

set-element-property

show-all-x-of-y

show-children

show-elements

show-instances

show-lowermost

show-marked

show-most-specific

show-not-marked

show-parents

show-rel

show-rel-inverse

show-roles

show-subtypes

show-supertypes

show-synonyms

split?

Splits-ok?

statement-link?

statement-true?

string-node?

the-x-of-y-is-a-z

the-x-of-y-is-z

type-node?

unmark

unmark-boolean

unregister-all-names

unregister-definition

upscan

with-temp-markers

x-is-a-y-of-z

x-is-the-y-of-what?

x-is-the-y-of-z