11. Miscellaneous
This is a catch-all section for documented functions, methods and
relations that haven't been categorized yet into any of the previous
sections. They are in random order and many of them will never be part
of the official PowerLoom interface. So beware!
- Method: 2-d-element ((array 2-D-ARRAY) (row INTEGER) (column INTEGER)) : (LIKE (ANY-VALUE SELF))
- Return the element of array at position [row, column].
- Method: 2-d-element ((array 2-D-FLOAT-ARRAY) (row INTEGER) (column INTEGER)) : FLOAT
- Return the element of array at position [row, column].
- Method: 2-d-element-setter ((array 2-D-ARRAY) (value OBJECT) (row INTEGER) (column INTEGER)) : (LIKE (ANY-VALUE SELF))
- Set the element of array at position [row, column]
to value and return the result.
- Method: 2-d-element-setter ((array 2-D-FLOAT-ARRAY) (value FLOAT) (row INTEGER) (column INTEGER)) : (LIKE (ANY-VALUE SELF))
- Set the element of array at position [row, column]
to value and return the result.
- Command: add-testing-example ((form CONS) (score PARTIAL-MATCH-SCORE)) :
- Add a query and score pair to the master list of
testing examples
- Command: add-training-example ((form CONS) (score PARTIAL-MATCH-SCORE)) :
- Add a query and score pair to the master list of
training examples
- Function: all-asserted-types ((self OBJECT)) : (CONS OF NAMED-DESCRIPTION)
- Return a set of all of the types that are
asserted to be satisfied by self.
- Function: all-class-instances ((type SURROGATE)) : CONS
- Return a set of instances that belong to the class type.
- Function: all-cycles ((module MODULE) (local? BOOLEAN)) : (CONS OF CONS)
- Return a list of lists of descriptions that are
provably co-extensional.
- Function: all-direct-subrelations ((relation NAMED-DESCRIPTION) (removeEquivalents? BOOLEAN)) : (CONS OF NAMED-DESCRIPTION)
- Return a set of relations that immediately specialize
relation. If removeEquivalents? (recommended), don't include any
relations equivalent to relation.
- Function: all-direct-superrelations ((relation NAMED-DESCRIPTION) (removeEquivalents? BOOLEAN)) : (CONS OF NAMED-DESCRIPTION)
- Return a set of relations that immediately subsume
relation. If removeEquivalents? (recommended), don't include any
relations equivalent to relation.
- Function: all-direct-types ((self OBJECT)) : (CONS OF LOGIC-OBJECT)
- Return a set of most specific types that are
satisfied by self.
- Function: all-equivalent-relations ((relation NAMED-DESCRIPTION) (reflexive? BOOLEAN)) : (CONS OF NAMED-DESCRIPTION)
- Return a list of all relations equivalent to relation.
If reflexive?, include relation in the list.
- Function: all-facts-of-instance ((self OBJECT) (includeunknownfacts? BOOLEAN) (elaborate? BOOLEAN)) : (LIST OF PROPOSITION)
- Return a list of all definite (TRUE or FALSE) propositions
attached to self.
- Command: all-facts-of-n ((n INTEGER) &rest (instanceRefs NAME)) : (CONS OF PROPOSITION)
- This is a generalization of
all-facts-of
(which see). With n = 0
and only one instance this command behaves just like all-facts-of
.
Otherwise, returns a cons list of all definite (TRUE or FALSE) propositions
that reference any of the instances listed in instanceRefs, plus if n >= 1
all propositions that reference any instances that are arguments of
propositions collected in the previous step, plus if n >= 2... and so on.
That is, if we only consider binary propositions, this can be viewed as
growing a graph with instances as its nodes and predicates as its arcs
starting from the set of seed instanceRefs to depth n-1.
Caution: with a fully connected KB and large enough n this could return
the whole knowledge base.
The returned propositions include those asserted to be true or false by
default, but it does not include propositions that are found to be
true only by running the query engine. Facts inferred to be true by
the forward chainer will be included. Hence, the returned list of
facts may be longer in a context where the forward chainer has been
run then in one where it has not (see run-forward-rules
).
- Function: all-instances ((module MODULE) (local? BOOLEAN)) : (ITERATOR OF LOGIC-OBJECT)
- Iterate over all instances (or individuals) visible from module.
Only instances that haven't been deleted will be considered. If local?,
only return instances created locally in module.
- Function: all-named-descriptions ((module MODULE) (local? BOOLEAN)) : (ITERATOR OF NAMED-DESCRIPTION)
- Iterate over all named descriptions visible from module.
If local?, return only named descriptions interned in module.
If module is null, return all named descriptions interned everywhere.
- Function: all-named-instances ((module MODULE) (local? BOOLEAN)) : (ITERATOR OF LOGIC-OBJECT)
- Iterate over all named instances (or individuals) visible from module.
Only instances that haven't been deleted will be considered. If local?,
only return instances created locally in module.
- Function: all-named-terms ((module MODULE) (local? BOOLEAN)) : (ITERATOR OF OBJECT)
- Iterate over all named terms visible from module. A term can be an
instance (or individual) as well as a description. Only terms that
haven't been deleted will be considered. If local?, only return
terms created locally in module.
- Function: all-propositions ((module MODULE) (local? BOOLEAN)) : (ITERATOR OF PROPOSITION)
- Iterate over all conceived propositions visible from module.
Only propositions that haven't been deleted will be considered.
If local?, only return propositions conceived locally in module.
- Function: all-relation-values ((relation SURROGATE) (nMinusOneArguments CONS)) : CONS
- Return a set of values that satisfy the relation
relation (a surrogate) applied to nMinusOneArguments plus that last value.
- Command: all-sentences-of ((instanceRef OBJECT)) : (CONS OF STRING-WRAPPER)
- Return a list of sentences describing facts about instanceRef.
- Function: all-slot-value-types ((self LOGIC-OBJECT) (relation SURROGATE)) : (CONS OF NAMED-DESCRIPTION)
- Return a set of the most specific types for fillers
of the slot relation applied to self.
- Function: all-slot-values ((self LOGIC-OBJECT) (relation SURROGATE)) : CONS
- Return a set of values for the slot relation (a surrogate)
applied to self (an object).
- Function: all-subrelations ((relation NAMED-DESCRIPTION) (removeequivalents? BOOLEAN)) : (CONS OF NAMED-DESCRIPTION)
- Return a set of all (named) relations that specialize
relation.
- Function: all-superrelations ((relation NAMED-DESCRIPTION) (removeequivalents? BOOLEAN)) : (CONS OF NAMED-DESCRIPTION)
- Return a set of all relations that subsume relation.
- Function: all-terms ((module MODULE) (local? BOOLEAN)) : (ITERATOR OF OBJECT)
- Return a list of all terms visible from module. A term can be an
instance (or individual) as well as a description. Only terms that
haven't been deleted will be considered. If local?, only return
terms created locally in module.
- Function: all-types ((self OBJECT)) : (CONS OF NAMED-DESCRIPTION)
- Return a set of all of the types that are
satisfied by self.
- Function: all-unnamed-terms ((module MODULE) (local? BOOLEAN)) : ITERATOR
- Iterate over all unnamed terms visible from module. A term can be
an instance (or individual) as well as a description. Only terms that
haven't been deleted will be considered. If local?, only return
terms created locally in module.
- Function: allocate-supported-closure-iterator ((startnode CONS) (allocateadjacencyiterator FUNCTION-CODE) (filterfunction FUNCTION-CODE)) : SUPPORTED-CLOSURE-ITERATOR
- Similar to
allocate-transitive-closure-iterator
(which see),
but return a SUPPORTED-CLOSURE-ITERATOR instead.
- Function: allocate-transitive-closure-iterator ((startNode OBJECT) (allocateAdjacencyIterator FUNCTION-CODE) (filterFunction FUNCTION-CODE)) : ITERATOR
- Return an iterator that generates the transitive
closure of applying iterators generated by allocateAdjacencyIterator
to startNode. If filterFunction is non-null, that function is applied
as a filter to each node generated (nodes filtered out still generate
descendants, but they don't get returned).
- Macro: apply-ask (&body (body CONS)) : OBJECT
- Execute a yes/no query composed of input-variables
inputVariables
and body queryBody
. Before executing, bind variables
to inputBindings
(in sequence).
(apply-ask inputVariables queryBody inputBindings)
- Function: apply-kappa? ((description DESCRIPTION) (vector VECTOR)) : BOOLEAN
- Apply (inherit) the description description
to members of the vector vector. Return TRUE if no clash was detected.
Constraint propagation happens only if it is enabled prior to calling
apply-kappa?
.
- Macro: apply-retrieve (&body (body CONS)) : OBJECT
- Execute a query composed of io-variables
variables
and body queryBody
. Before executing, bind variables to inputBindings
(in sequence). If one variable is left unbound, returns a cons list of
bindings of that variable. If two or more are unbound, returns
a cons list of cons lists of bindings:
(apply-retrieve variables queryBody inputBindings)
- Command: ask-partial (&rest (proposition&options PARSE-TREE)) : FLOAT
- Similar to
ask
(which see), but return the highest partial match score
for the supplied proposition instead of a truth value. If the option
:MAXIMIZE-SCORE? is set to FALSE, return after the first partial match score
has been generated.
- Function: bottom? ((self OBJECT)) : BOOLEAN
- Return TRUE if self is the undefined individual BOTTOM.
- Command: call-all-facts-of ((instanceRef OBJECT)) : (LIST OF PROPOSITION)
- Return a list of all definite (TRUE or FALSE) propositions
that reference the instance instanceRef.
- Function: call-ask ((query OBJECT)) : TRUTH-VALUE
- Callable version of
ask
(which see). Accepts queries
specified by a query iterator, or specified as a CONS-list of arguments as they
would be supplied to ask
. Raises LOGIC-EXCEPTIONs in case of illegal
queries and logical expressions.
- Function: call-defconcept ((arguments CONS)) : NAMED-DESCRIPTION
- Callable version of the
defconcept
command (which see).
Expects the same arguments as defconcept
but supplied as a list.
- Function: call-deffunction ((arguments CONS)) : NAMED-DESCRIPTION
- Callable version of the
deffunction
command (which see).
Expects the same arguments as deffunction
but supplied as a list.
- Function: call-defobject ((arguments CONS)) : LOGIC-OBJECT
- Callable version of the
defobject
command (which see).
Expects the same arguments as defobject
but supplied as a list.
- Function: call-defproposition ((arguments CONS)) : PROPOSITION
- Callable version of the
defproposition
command (which see).
Expects the same arguments as defproposition
but supplied as a list.
- Function: call-defrelation ((arguments CONS)) : NAMED-DESCRIPTION
- Callable version of the
defrelation
command (which see).
Expects the same arguments as defrelation
but supplied as a list.
- Function: call-list-undefined-relations ((module MODULE) (local? BOOLEAN)) : CONS
- Callable version of
list-undefined-relations
(which see).
- Function: call-propagate-constraints ((context CONTEXT)) :
- Trigger constraint propagation over all propositions
in the module or world context.
- Function: call-retrieve ((query OBJECT)) : QUERY-ITERATOR
- Callable version of
retrieve
(which see). Accepts queries
specified by a query iterator, or specified as a CONS-list of arguments as they
would be supplied to retrieve
. Raises LOGIC-EXCEPTIONs in case of illegal
queries and logical expressions.
- Function: call-retrieve-partial ((query OBJECT)) : QUERY-ITERATOR
- Callable version of
retrieve-partial
(which see). Accepts queries
specified by a query iterator, or specified as a CONS-list of arguments as they
would be supplied to retrieve-partial
. Raises LOGIC-EXCEPTIONs in case of
illegal queries and logical expressions.
- Function: call-run-forward-rules ((module MODULE) (force? BOOLEAN)) :
- Run forward inference rules in module module. If module
is NULL, the current module will be used. If forward inferencing is already
up-to-date in the designated module, no additional inferencing will occur,
unless force? is set to TRUE, in which case all forward rules are run or rerun.
- Function: call-set-inference-level ((levelKeyword KEYWORD) (module MODULE)) : KEYWORD
- Set the inference level of module to the level specified
by levelKeyword. If module is NULL and we are inside a query, set the
level of the current query iterator. Otherwise, set the level globally.
- Function: class? ((objectRef OBJECT)) : BOOLEAN
- Return TRUE if objectRef denotes a class.
- Function: coerce-to-instance ((self OBJECT) (original OBJECT)) : LOGIC-OBJECT
- Return the logic instance referred to by self.
- Function: coerce-to-instance-or-literal ((self OBJECT) (original OBJECT)) : OBJECT
- Return the logic instance referred to by self, or self if it is a
literal (e.g., string or number) that can't be coerced.
- Function: coerce-to-vector ((self OBJECT)) : VECTOR
- Return a vector containing the elements in self.
Coerce each element of self to be a logic object or literal.
- Function: collection? ((objectRef OBJECT)) : BOOLEAN
- Return TRUE if objectRef denotes a relation or a class.
- Command: conceive-term ((tree OBJECT)) : OBJECT
- tree is a term expression (a string or an s-expression),
or is a class reference (a symbol or surrogate). Return a (possibly
newly-conceived) term representing the internalized representation of that term.
- Function: conjoin-truth-values ((tv1 TRUTH-VALUE) (tv2 TRUTH-VALUE)) : TRUTH-VALUE
- Return the logical conjunction of truth values tv1 and tv2.
- Method: consify ((self QUERY-ITERATOR)) : CONS
- Generate all solutions for the query self, and collect them into a cons list
of result tuples. If
:SINGLETONS? TRUE
, collect a list of atoms rather than a
list of lists for tuples of arity=1.
- Method: consify ((self QUERY-SOLUTION-TABLE)) : CONS
- Collect all solutions of self into a cons list and return the result.
- Method: consify ((self JUSTIFICATION)) : CONS
- Return a CONS tree representation of the proof self.
Each proof step is represented as a CONS tree of the form
(<proposition> (<key> <value>...) <antecedent>...)
where each <antecedent> is a CONS tree representing a subproof. The
consification follows the original proof structure literally, i.e., no
uninteresting nodes such as patterns or AND-introductions are suppressed.
- Method: consify-current-solutions ((self QUERY-ITERATOR)) : CONS
- Collect the current solutions of self into a cons list
of result tuples. If
:SINGLETONS? TRUE
, collect a list of atoms rather than a
list of lists for tuples of arity=1.
- Function: consify-justification ((self JUSTIFICATION) (style KEYWORD)) : CONS
- Return a CONS tree representation of the proof self.
Each proof step is represented as a CONS tree of the form
(<proposition> (<key> <value>...) <antecedent>...)
where each <antecedent> is a CONS tree representing a subproof.
style indicates what nodes in the proof tree should be suppressed.
:RAW preserves the original structure literally, :VERBOSE keeps AND-
introductions but suppresses all auxiliary (non-logical) nodes such as
pattern nodes, and :BRIEF additionally suppresses AND-introduction nodes.
- Function: constant? ((objectRef OBJECT)) : BOOLEAN
- Return TRUE if objectRef denotes a literal or scalar.
- Method: copy ((self JUSTIFICATION)) : (LIKE SELF)
- Return a copy of the proof starting at self. Allocates
all new justification objects, but structure-shares other information such
as propositions and substitutions.
- Command: create ((name GENERALIZED-SYMBOL) &rest (type GENERALIZED-SYMBOL)) : OBJECT
- Create a logic object with name name and return it.
If type is also supplied, assert that the object belongs to that type.
- Function: create-2-d-array ((nof-rows INTEGER) (nof-columns INTEGER) &rest (values OBJECT)) : 2-D-ARRAY
- Create a two-dimensional array with nof-rows rows and
nof-columns columns, and initialize it in row-major-order from values.
Missing values will be padded with NULL, extraneous values will be ignored.
- Function: create-2-d-float-array ((nof-rows INTEGER) (nof-columns INTEGER) &rest (values FLOAT)) : 2-D-FLOAT-ARRAY
- Create a two-dimensional array with nof-rows rows and
nof-columns columns, and initialize it in row-major-order from values.
Missing values will be padded with NULL, extraneous values will be ignored.
- Function: create-float-vector (&rest (values FLOAT)) : FLOAT-VECTOR
- Return a vector containing values, in order.
- Function: create-marker-storage ((supportRecall? BOOLEAN)) : MARKER-TABLE
- Return a new marker storage object, used to
remember with objects have been
marked
. If supportRecall?
is set, then the iterator recall-marked-objects
can be invoked
on the new marker storage object.
- Function: create-vector (&rest (values OBJECT)) : VECTOR
- Return a vector containing values, in order.
- Command: current-inference-level () : NORMAL-INFERENCE-LEVEL
- Return the current inference level that is active in the
current query, the current module, or, otherwise, globally.
- Function: default-truth-value? ((self TRUTH-VALUE)) : BOOLEAN
- Return TRUE if self is a default truth value.
- Macro: define-arithmetic-operation-on-wrappers ((name SYMBOL) (operation-name SYMBOL)) : OBJECT
- Defines name as an arithmetic comparision operation using the
test
test-name
. It will take two wrapped number parameters and return a wrapped number.
The code will use the appropriate test for the specific subtype of wrapped number
actually passed in, and return the appropriate subtype of wrapped number based on
the normal arithmetic contagion rules.
For example, if both input parameters are wrapped integers then the output will be
a wrapped integer. If the inputs are a wrapped integer and a wrapped float then
the output will be a wrapped float, etc.
- Macro: define-arithmetic-test-on-wrappers ((name SYMBOL) (test-name SYMBOL)) : OBJECT
- Defines name as an arithmetic comparision operation using the
test test-name. It will take two wrapped number parameters and return a
boolean
.
The code will use the appropriate test for the specific subtype of wrapped number
actually passed in.
- Macro: define-computed-constraint ((name SYMBOL) (var-list CONS) (constraint-test CONS) &body (position-computations CONS)) : OBJECT
- Defines name to be a constraint computation which uses constraint-test
to determine if a fully bound set of variables satisfies the constraint. The forms in
position-computations are used to compute the value for each of the positions. All such
computations must set the variable
value
to be the result computed for the missing position.
Setting value
to null
for any such computation means that that particular argument cannot be
computed from the others. The input variables in var-list will be bound to the N arguments
to the constraint.
The generated function will return a Stella Object and take as inputs the values of
the N arguments to the constraint. A value of null
means that the value is not available.
If all arguments are not null
, then the return value will be a Stella wrapped boolean indicating
whether the constraint is satisified or not.
If more than one input value is null
, then this constraint code will not be called.
- Function: deobjectify-tree ((self OBJECT)) : OBJECT
- Return a copy of self where all logic objects are
replaced by their
generated
parse-tree version. This is useful to
convert the result of a retrieval query into a regular parse tree.
- Method: describe-object ((self NAMED-DESCRIPTION) (stream OUTPUT-STREAM) (mode KEYWORD)) :
- Prints a description of self to stream stream. mode
can be :terse, :verbose, or :source. Used by
describe
.
- Method: description-name ((self NAMED-DESCRIPTION)) : SYMBOL
- Return the name of the description self.
- Method: description-name ((self DESCRIPTION)) : SYMBOL
- Return the name of the description self, if it has one.
- Function: destroy-instance ((self OBJECT)) :
- Destroy all propositions that reference self,
and mark it as
deleted?
, thereby making it invisible within class
extensions.
- Function: destroy-object ((self OBJECT)) :
- Destroy self which can be a term or a proposition. Destroy all
propositions that reference self and mark it as
deleted?
(thereby
making it invisible within class extensions).
- Function: destroy-proposition ((proposition PROPOSITION)) : PROPOSITION
- Retract and destroy the proposition proposition.
Recursively destroy all propositions that reference proposition.
Also, destroy all satellite propositions of proposition.
- Function: destroy-term ((self LOGIC-OBJECT)) :
- Destroy all propositions that reference self,
and mark it as
deleted?
, thereby making it invisible within class
extensions. Unlink descriptions from native relations.
- Function: direct-superrelations ((self RELATION)) : (ITERATOR OF (LIKE SELF))
- Return direct super classes/slots of self.
- Function: disabled-powerloom-feature? ((feature KEYWORD)) : BOOLEAN
- Return true if the STELLA feature is currently disabled.
- Function: disjoin-truth-values ((tv1 TRUTH-VALUE) (tv2 TRUTH-VALUE)) : TRUTH-VALUE
- Return the logical disjunction of truth values tv1 and tv2.
- Function: disjoint-terms? ((d1 DESCRIPTION) (d2 DESCRIPTION)) : BOOLEAN
- Return TRUE if d1 and d2 belong to disjoint partitions.
- Function: do-clear-instances ((module MODULE)) :
- Function version of
clear-instances
that evaluates its argument.
- Function: do-save-module ((module MODULE) (store OBJECT)) :
- Save module to the persistent store store which can
either be an output stream or a persistent OBJECT-STORE.
- Method: empty? ((self QUERY-SOLUTION-TABLE)) : BOOLEAN
- Return TRUE if self has zero entries.
- Method: empty? ((self FLOAT-VECTOR)) : BOOLEAN
- Return TRUE if self has length 0.
- Function: enabled-powerloom-feature? ((feature KEYWORD)) : BOOLEAN
- Return true if the STELLA feature is currently enabled.
- Method: estimated-length ((self PAGING-INDEX)) : INTEGER
- Return the estimated length of the sequences in self,
which could be too large if some of the members have been deleted.
- Function: explain-why ((label STRING) (style KEYWORD) (maxdepth INTEGER) (stream OUTPUT-STREAM)) :
- Programmer's interface to WHY function.
- Function: explain-whynot ((label STRING) (style KEYWORD) (maxdepth INTEGER) (summary? BOOLEAN) (stream OUTPUT-STREAM)) :
- Programmer's interface to the WHYNOT function.
- Function: false-truth-value? ((self TRUTH-VALUE)) : BOOLEAN
- Return TRUE if self represents some form of falsehood.
- Method: fetch-instance ((store OBJECT-STORE) (name OBJECT)) : OBJECT
- Fetch the instance identified by name (a string or symbol) from store
and return it as an appropriate logic object. This needs to be appropriately
specialized on actual OBJECT-STORE implementations.
- Method: fetch-relation ((store OBJECT-STORE) (name OBJECT)) : NAMED-DESCRIPTION
- Fetch the relation identified by name (a string or symbol) from store
and return it as a named description. This needs to be appropriately
specialized on actual OBJECT-STORE implementations.
- Method: fill-array ((self 2-D-ARRAY) &rest (values OBJECT)) :
- Fill the two-dimensional array self in row-major-order
from values. Missing values will retain their old values, extraneous values
will be ignored.
- Method: fill-array ((self 2-D-FLOAT-ARRAY) &rest (values FLOAT)) :
- Fill the two-dimensional array self in row-major-order
from values. Missing values will retain their old values, extraneous values
will be ignored.
- Function: finalize-objects () :
- Finalize all currently unfinalized objects.
The user-level entry point for this is
(process-definitions)
.
- Function: find-direct-supers-and-subs ((self DESCRIPTION) (onlysupers? BOOLEAN)) : (CONS OF DESCRIPTION) (CONS OF DESCRIPTION) (CONS OF DESCRIPTION)
- Classify self and return three values, its direct
supers, direct subs, and a list of equivalent descriptions.
Setting
supersOnly?
may speed up the computation (perhaps by a lot).
If description
is nameless and has no dependent propositions, then
it is automatically removed from the hierarchy after classification.
- Function: find-direct-supers-of-instance ((self OBJECT)) : (CONS OF LOGIC-OBJECT)
- Classify self and return a list of most specific
named descriptions among all descriptions that it satisfies.
- Command: find-instance ((instanceRef OBJECT)) : OBJECT
- Return the nearest instance with name instanceRef
visible from the current module. instanceRef can be a string, symbol,
or surrogate. If instanceRef is a surrogate, the search originates
in the module the surrogate was interned in.
- Command: find-rule ((ruleName NAME)) : PROPOSITION
- Search for a rule named ruleName. Like
get-rule
,
but find-rule
implicity quotes its input argument.
- Function: function? ((relationRef OBJECT)) : BOOLEAN
- Return TRUE if relationRef references a function.
- Function: generate-expression ((self LOGIC-OBJECT) (canonicalizevariablenames? BOOLEAN)) : OBJECT
- Return an s-expression representing the source expression for self.
- Method: generate-specialized-term ((self LOGIC-THING)) : OBJECT
- Method to generate a specialized term for self. This is designed
to allow for extension of the term generation code to cover other
types of objects for the logic. This particular method will signal
an error unless there is a surrogate-value-inverse link set.
- Function: get-class ((instanceRef OBJECT)) : LOGIC-OBJECT
- Return the nearest class with name instanceRef
visible from the current module. instanceRef can be a string, symbol,
or surrogate. If instanceRef is a surrogate, the search originates
in the module the surrogate was interned in.
- Function: get-instance ((instanceRef OBJECT)) : OBJECT
- Return the nearest instance with name instanceRef
visible from the current module. instanceRef can be a string, symbol,
or surrogate. If instanceRef is a surrogate, the search originates
in the module the surrogate was interned in.
- Function: get-module ((moduleRef OBJECT)) : MODULE
- Return a module named moduleRef.
- Function: get-relation ((instanceRef OBJECT)) : LOGIC-OBJECT
- Return the nearest relation with name instanceRef
visible from the current module. instanceRef can be a string, symbol,
or surrogate. If instanceRef is a surrogate, the search originates
in the module the surrogate was interned in.
- Function: get-self-or-prototype ((instanceRef OBJECT)) : LOGIC-OBJECT
- Used to convert a computation to reference so-called
template
slots rather than own
slots: If instanceRef denotes a class,
return a prototype of that class. Otherwise, return instanceRef.
- Function: get-slot-maximum-cardinality ((self LOGIC-OBJECT) (relation SURROGATE)) : INTEGER
- Return a maximum value for the number of fillers of relation
relation (a surrogate) applied to the instance self (an object).
- Function: get-slot-minimum-cardinality ((self LOGIC-OBJECT) (relation SURROGATE)) : INTEGER
- Return a minimum value for the number of fillers of relation
relation (a surrogate) applied to the instance self (an object).
- Function: get-slot-value ((self LOGIC-OBJECT) (relation SURROGATE)) : OBJECT
- Return a single value for the slot relation (a surrogate)
applied to self (an object).
- Function: get-slot-value-type ((self LOGIC-OBJECT) (relation SURROGATE)) : NAMED-DESCRIPTION
- Return a most specific type for fillers of the slot relation
(a surrogate) applied to self. If there is more than one, pick one.
- Function: get-why-justification ((label STRING)) : JUSTIFICATION
- Returns the current WHY justification. May also throw one of the
following subtypes of EXPLAIN-EXCEPTION:
EXPLAIN-NO-QUERY-EXCEPTION
EXPLAIN-NO-SOLUTION-EXCEPTION
EXPLAIN-NO-MORE-SOLUTIONS-EXCEPTION
EXPLAIN-NOT-ENABLED-EXCEPTION
EXPLAIN-NO-SUCH-LABEL-EXCEPTION
EXPLAIN-QUERY-TRUE-EXCEPTION
- Function: get-whynot-justifications ((query QUERY-ITERATOR) (label STRING) (mapping EXPLANATION-MAPPING)) : (LIST OF JUSTIFICATION)
- Programmer's interface to WHYNOT function. Derive
justifications why query failed, or, if label was supplied as non-NULL,
lookup its justification relative to mapping and return the result.
- Command: in-dialect ((dialect NAME)) : KEYWORD
- Change the current logic dialect to dialect.
Currently supported dialects are
KIF
, STELLA
, and PREFIX-STELLA
.
The STELLA dialects are not recommended for the construction of knowledge
bases, they are mainly used internally by PowerLoom.
- Method: insert-at ((self QUERY-SOLUTION-TABLE) (key (LIKE (ANY-KEY SELF))) (value (LIKE (ANY-VALUE SELF)))) :
- Insert value identified by key into self. If a solution
with that key already exists, destructively modify it with the slot values of
value. This is necessary to preserve the order of solutions in self.
- Function: invert-truth-value ((self TRUTH-VALUE)) : TRUTH-VALUE
- Return the logical negation of self.
- Method: length ((self QUERY-SOLUTION-TABLE)) : INTEGER
- Return the number of entries in self.
- Command: list-features () : LIST
- Return a list containing two lists, a list of currently enabled PowerLoom
features, and a list of all available PowerLoom features.
- Command: list-unclassified-instances ((module NAME) (local? BOOLEAN)) : (CONS OF LOGIC-OBJECT)
- Collect all instances in module (or in any module if module
is NULL) that were not (or will not be) classified due to their lack of
non-inferable/primitive type assertions.
- Command: list-unclassified-relations ((module NAME) (local? BOOLEAN)) : (CONS OF NAMED-DESCRIPTION)
- Collect all named description in module (or in any module if module
is NULL) that were not (or will not be) classified due to their lack of
non-inferable/primitive ancestor relations.
- Command: list-undefined-relations ((module NAME) (local? BOOLEAN)) : (CONS OF NAMED-DESCRIPTION)
- Return a list of as yet undefined concepts and relations in module.
These relations were defined by the system, since they were referenced
but have not yet been defined by the user. If module is NULL look in
the current module. If local? only look in module but not in any
modules it inherits.
- Method: listify ((self QUERY-ITERATOR)) : LIST
- Just like
QUERY-ITERATOR.consify
but return a LIST instead.
- Function: load-stream ((stream INPUT-STREAM)) :
- Read logic commands from stream and evaluate them.
- Function: logic-class? ((self CLASS)) : BOOLEAN
- Return TRUE if the class self or one of its
supers supports indices that record extensions referenced by
the logic system. Also return true for literal classes.
- Function: logic-form-less? ((o1 OBJECT) (o2 OBJECT)) : BOOLEAN
- A sorting predicate for objects o1 and o2 that can appear in logical
forms. Performs a combined numeric and lexocographic sort that accounts
for lists, collections and propositions. Numbers precede all other values,
null
follows all other values.
- Function: logic-module? ((self MODULE)) : BOOLEAN
- Return TRUE if self is a logic module, implying
that relations defined within it define a knowledge base. A module
is a logic module iff it inherits the module
PL-KERNEL
.
- Method: lookup ((self QUERY-SOLUTION-TABLE) (key (LIKE (ANY-KEY SELF)))) : (LIKE (ANY-VALUE SELF))
- Lookup the solution identified by key in self and
return its value, or NULL if no such solution exists.
- Function: natural-deduction-mode? () : BOOLEAN
- True if normalization is governed by natural
deduction semantics.
- Method: non-empty? ((self QUERY-SOLUTION-TABLE)) : BOOLEAN
- Return TRUE if self has at least 1 entry.
- Method: non-empty? ((self FLOAT-VECTOR)) : BOOLEAN
- Return TRUE if self has length > 0.
- Method: nth ((self QUERY-SOLUTION-TABLE) (position INTEGER)) : (LIKE (ANY-VALUE SELF))
- Return the nth solution in self, or NULL if it is empty.
- Function: object-name ((self OBJECT)) : SYMBOL
- Return the name symbol for the logic object self.
- Function: object-name-string ((self OBJECT)) : STRING
- Return the name string for the logic object self.
- Function: object-surrogate ((self OBJECT)) : SURROGATE
- Return the surrogate naming the logic object self.
- Function: object-surrogate-setter ((self OBJECT) (name SURROGATE)) : SURROGATE
- Return the name of the logic object self to name.
- Method: pop ((self QUERY-SOLUTION-TABLE)) : (LIKE (ANY-VALUE SELF))
- Remove and return the first solution of self or NULL
if the table is empty.
- Function: powerloom () :
- Run the PowerLoom listener. Read logic commands from the
standard input, evaluate them, and print their results. Exit if the user
entered
bye
, exit
, halt
, quit
, or stop
.
- Function: pretty-print-logical-form ((form OBJECT) (stream OUTPUT-STREAM)) :
- Pretty-print the logical form form to stream according
to the current setting of
*logic-dialect*
.
- Method: print-array ((self 2-D-ARRAY) (stream NATIVE-OUTPUT-STREAM)) :
- Print the array self to stream.
- Method: print-array ((self 2-D-FLOAT-ARRAY) (stream NATIVE-OUTPUT-STREAM)) :
- Print the array self to stream.
- Function: print-extension-sizes ((module MODULE) (sizeCutoff INTEGER)) :
- Print the extension sizes of concepts visible in module.
If module is NULL the current module is used. Do not report extensions
with size less than sizeCutoff (default is 10).
- Function: print-goal-stack ((frame CONTROL-FRAME) (verbose? BOOLEAN)) :
- Print stack of goals. Assumes that query has been interrupted
with a full stack of control frames.
- Function: print-logical-form ((form OBJECT) (stream OUTPUT-STREAM)) :
- Print the logical form form to stream according to
the current setting of
*logic-dialect*
. Pretty-printing is controlled
by the current setting of *prettyPrintLogicalForms?*
.
- Function: print-logical-form-in-dialect ((self OBJECT) (dialect KEYWORD) (stream OUTPUT-STREAM)) :
- Produce a stringified version of a logical representation
of self and write it to the stream stream. Use the dialect dialect,
or use the current dialect if dialect is NULL.
- Function: print-unformatted-logical-form ((form OBJECT) (stream OUTPUT-STREAM)) :
- Print the logical form form to stream according to
the current setting of
*logic-dialect*
. Pretty-printing is explicitly
forced to be turned off.
- Function: print-whynot-justification ((justification JUSTIFICATION) (stream OUTPUT-STREAM) (maxDepth INTEGER) (style KEYWORD) (summary? BOOLEAN)) :
- Print a WHYNOT justification to stream according to
maxDepth and style. Print a summary only if summary? is TRUE.
- Function: random-float ((n FLOAT)) : FLOAT
- Generate a random integer in the interval [0..n-1].
n must be <= 2^15.
- Method: recall-marked-objects ((self MARKER-TABLE)) : LIST-ITERATOR
- Return an iterator that generates all marked objects
recorded in self.
- Function: record-justifications? () : BOOLEAN
- Return TRUE if every query records justifications to enable
the explanation of concluded results.
- Function: register-logic-dialect-print-function ((dialect KEYWORD) (fn FUNCTION-CODE-WRAPPER)) :
- Register fn as a logic-object print function for dialect.
Each function should have the signature
((self OBJECT) (stream OUTPUT-STREAM))
.
Any return values will be ignored.
- Function: relation-name ((self NAMED-DESCRIPTION)) : STRING
- Given a relation object, return it's name.
- Function: relation? ((objectRef OBJECT)) : BOOLEAN
- Return TRUE if objectRef denotes a relation or a class.
- Method: remove-at ((self QUERY-SOLUTION-TABLE) (key (LIKE (ANY-KEY SELF)))) :
- Remove the solution identified by key from self.
To preserve the solution ordering chain, the solution is marked as deleted
and will be completely removed upon the next iteration through self.
- Method: remove-deleted-members ((self PAGING-INDEX)) : (LIKE SELF)
- Destructively remove all deleted members of self.
- Function: reset-query-caches () :
- Zero out all caches managed by the query optimizer,
so that it will reoptimize subgoal queries upon next invocation.
- Function: retract-facts-of-instance ((self LOGIC-OBJECT)) :
- Retract all definite (TRUE or FALSE) propositions attached to self.
- Command: retrieve-partial (&rest (tree PARSE-TREE)) : QUERY-ITERATOR
- Partial-match version of
retrieve
(which see) that generates scored
partial solutions based on the current partial match strategy. By supplying
BEST
instead of ALL
, or by adding the option :SORT-BY :SCORE
, the generated
solutions will be sorted so that solutions with higher scores come first.
Use the :MATCH-MODE
option to override the global default setting established
by set-partial-match-mode
, e.g., use :MATCH-MODE :NN
to use the neural
net partial match mode. The :MINIMUM-SCORE
option can be used to only
retrieve solutions that have at least the specified minimum match score.
By default, retrieve-partial
does not maximize the match scores of its returned
bindings. To only get maximal scores use :MAXIMIZE-SCORE? TRUE
(this is not
yet implemented - you can use ask-partial
to maximize scores for individual
solutions by hand).
- Command: run-forward-rules ((moduleRef NAME) &rest (force KEYWORD)) :
- Run forward inference rules in module moduleRef. If moduleRef is NULL, the
current module will be used. If forward inferencing is already up-to-date
in the designated module, no additional inferencing will occur, unless the
optional keyword
:force
is included, in which case all
forward rules are run or rerun.
Calling run-forward-rules
temporarily puts the module into a mode where
future assertional (monotonic) updates will trigger additional forward
inference. Once a non-monotonic update is performed, i.e., a retraction
or clipping of relation value, all cached forward inferences will be discarded
and forward inferencing will be disabled until this function is
called again.
- Command: run-powerloom-tests () :
- Run the PowerLoom test suite. Currently this simply runs all demos and
echos commands and their results to standard output. The output can then
be diffed with previously validated runs to find deviations.
- Function: satisfies? ((instanceOrTuple OBJECT) (relationRef OBJECT)) : TRUTH-VALUE
- Try to prove whether instanceOrTuple satisfies the
definition of the relation relationRef and return the result truth value
of the query. instanceOrTuple can be a single object, the name or surrogate
of an object, or a collection (a list or vector) of objects. relationRef
can be a relation, description, surrogate or relation name.
- Command: save-all-neural-networks ((file STRING)) :
- Save all neural networks to file (if file is non-NULL).
If networks are saved periodically (see
set-save-network-cycle
) this file
name will be used to perform periodic saves.
- Command: set-error-print-cycle ((i INTEGER)) :
- Set number of cycles between which error rates are saved to
the file established by the last call to
save-all-neural-networks
appended
with extension .err
. A number <= 0 (or NULL) turns off periodic saving.
- Command: set-inference-level ((level NAME) (module NAME)) : KEYWORD
- Set the inference level of module to the level specified
by
levelKeyword
. If module is NULL, set the level globally.
- Method: set-marker ((self MARKER-TABLE) (object OBJECT)) :
- Record membership of object in the marker
storage object self.
- Command: set-num-neighbors ((d INTEGER)) :
- Sets the number of nearest neighbors to predict from.
- Command: set-num-training-per-case ((d INTEGER)) :
- Sets the number of training examples for each case in the training set.
- Function: set-powerloom-feature ((feature KEYWORD)) :
- Enable the PowerLoom environment feature feature.
- Command: set-save-network-cycle ((i INTEGER)) :
- Set number of cycles between which networks are saved to the
file established by the last call to
save-all-neural-networks
. A number <= 0
or a NULL number turns off periodic saving.
- Method: sort ((self QUERY-SOLUTION-TABLE) (predicate FUNCTION-CODE)) : (LIKE SELF)
- Perform a stable, destructive sort of self according to
predicate, and return the result. If predicate has a
<
semantics, the
result will be in ascending order.
- Function: specializes? ((subObject OBJECT) (superObject OBJECT)) : TRUTH-VALUE
- Try to prove if the description associated with subObject
specializes the description for superObject and return the result truth
value of the query.
- Function: strengthen-truth-value ((tv1 TRUTH-VALUE) (tv2 TRUTH-VALUE)) : TRUTH-VALUE
- If tv2 has greater strength than tv1, adapt the strength of tv1 (not
its value!) and return the result. Otherwise, return tv1 unmodified.
- Function: strict-truth-value? ((self TRUTH-VALUE)) : BOOLEAN
- Return TRUE if self is a strict truth value.
- Function: termify ((self OBJECT)) : OBJECT
- Convert self into an equivalent PowerLoom object
that can be passed as an argument wherever an instance is expected.
- Function: test-closed-slot? ((relation SURROGATE)) : BOOLEAN
- Return TRUE if relation (a surrogate) is asserted to
be closed or if the current module closes all relations.
- Function: test-function-slot? ((relation SURROGATE)) : BOOLEAN
- Return TRUE if relation (a surrogate) is a function.
- Method: test-marker? ((self MARKER-TABLE) (object OBJECT)) : BOOLEAN
- Return TRUE if object is stored (marked) in self.
- Function: test-relation-on-arguments? ((relation SURROGATE) (arguments CONS)) : BOOLEAN
- Return TRUE if relation (a surrogate) is TRUE when
applied to arguments.
- Function: test-slot-value? ((self LOGIC-OBJECT) (relation SURROGATE) (filler OBJECT)) : BOOLEAN
- Return TRUE if the proposition
(<relation> <self> <filler>)
is true.
- Function: test-special-marker-table? ((self OBJECT)) : BOOLEAN
- Return TRUE if the object self is stored (marked)
in the table pointed at by the special variable *specialMarkerTable*.
Designed for use by
remove-if
.
- Function: test-subrelation? ((subrelation SURROGATE) (superrelation SURROGATE)) : BOOLEAN
- Return TRUE if subrelation specializes superrelation.
- Function: test-type-on-instance? ((self OBJECT) (type SURROGATE)) : BOOLEAN
- Return TRUE if self satisfies type.
- Function: true-truth-value? ((self TRUTH-VALUE)) : BOOLEAN
- Return TRUE if self represents some form of truth.
- Command: unassert ((proposition PARSE-TREE)) :
- Retract the truth or falsity of proposition. This is a more general
version of
retract
that also handles falsity. For example, if we
assert the proposition "(not (sad Fred))", and then execute the statement
"(unassert (sad Fred))", the truth value of the proposition "(sad Fred)"
will be set to UNKNOWN. If we had called retract
in place of unassert
,
the proposition "(sad Fred)" would remain set to FALSE. Note that for this
unassertion to succeed, the logic constant Fred
and the relation sad
must
already be defined.
- Function: unassert-fact ((self PROPOSITION)) :
- Retract the truth or falsity of the proposition self
- Function: unknown-truth-value? ((self TRUTH-VALUE)) : BOOLEAN
- Return TRUE if self represents UNKNOWN.
- Function: unset-powerloom-feature ((feature KEYWORD)) :
- Disable the PowerLoom environment feature feature.
- Function: upclassify-all-descriptions () :
- Classify all named descriptions.
- Function: upclassify-all-instances () :
- Classify all named instances.
- Function: upclassify-instances ((module MODULE) (local? BOOLEAN)) :
- Classify instances local to module and inherited
by module. If local?, don't classify inherited descriptions. If
module is NULL, classify descriptions in all modules.
- Function: upclassify-named-descriptions ((module MODULE) (local? BOOLEAN)) :
- Classify named descriptions local to module and inherited
by module. If local?, don't classify inherited descriptions. If
module is NULL, classify descriptions in all modules.
- Function: weaken-truth-value ((tv1 TRUTH-VALUE) (tv2 TRUTH-VALUE)) : TRUTH-VALUE
- If tv2 has lesser strength than tv1, adapt the strength of tv1 (not
its value!) and return the result. Otherwise, return tv1 unmodified.
- Macro: with-logic-environment ((moduleForm OBJECT) (environment OBJECT) &body (body CONS)) : OBJECT
- Execute body within the module resulting from moduleForm.
*module*
is an acceptable moduleForm. It will locally rebind
*module*
and *context*
and shield the outer bindings from changes.
- Macro: within-classification-session ((descriptionorinstance KEYWORD) &body (body CONS)) : OBJECT
- Used during classification. Execute body within the indicated
classification session and inference world.
- Macro: within-meta-cache (&body (body CONS)) : OBJECT
- Execute body within the meta cache of the current module.
Set appropriate special variables.
- Function: is-true-proposition1 ((relation-and-arguments OBJECT) (module MODULE) (environment OBJECT)) : BOOLEAN
- Return TRUE if a proposition (
relation
args
) has
been asserted (or inferred by forward chaining).
- Function: main () :
- Main PowerLoom entry point for your code in C++ and Java.
- Command: initialize-kernel-kb () :
- Bootstrap the PowerLoom built-in kernel KB.
This document was generated
by Hans Chalupsky on September, 30 2003
using texi2html