edu.isi.powerloom
Class PLI

java.lang.Object
  extended by edu.isi.powerloom.PLI

public class PLI
extends java.lang.Object


Field Summary
static boolean $POWERLOOM_INITIALIZEDp$
           
static Environment ASSERTION_ENV
           
static Environment INFERENCE_ENV
           
static Keyword KWD_CASE_SENSITIVEp
           
static Keyword KWD_SUBSET_OF
           
static Surrogate SGT_PLI_ENVIRONMENT
           
static Surrogate SGT_PLI_PL_ITERATOR
           
static Symbol SYM_PLI_F_GET_INFERRED_BINARY_PROPOSITION_VALUES_QUERY_000
           
static Symbol SYM_PLI_pI
           
static Symbol SYM_PLI_pR
           
static Symbol SYM_PLI_PROPER_SUBRELATION
           
static Symbol SYM_PLI_pV
           
static Symbol SYM_PLI_STARTUP_PLI
           
static Symbol SYM_STELLA_LEVEL
           
static Environment TAXONOMIC_ENV
           
 
Constructor Summary
PLI()
           
 
Method Summary
static TruthValue ask(Cons query, Module module, Environment environment)
          Returns a truth value for query in module and environment.
static Proposition assertBinaryProposition(LogicObject relation, Stella_Object arg, Stella_Object value, Module module, Environment environment)
          Assert that the proposition (relation arg value) is TRUE in module.
static Proposition assertNaryProposition(Stella_Object relationAndArguments, Module module, Environment environment)
          Assert that the proposition represented by the list RelationAndArguments satisfies the relation relation.
static Proposition assertProposition(Proposition proposition, Module module, Environment environment)
          Assert that the proposition proposition is true in module.
static Proposition assertUnaryProposition(LogicObject relation, Stella_Object arg, Module module, Environment environment)
          Assert that the proposition (relation arg) is TRUE in module.
static Module changeModule(Module module)
          Set the current module to module and return it.
static void clearCaches()
          Clear all query and memoization caches.
static Module clearModule(Module module)
          Destroy the contents of the module module as well as the contents of all of its children, recursively.
static PlIterator conceive(Stella_Object sentence, Module module, Environment environment)
          Create one or more proposition objects from the sentence sentence in the module module.
static LogicObject createConcept(java.lang.String name, LogicObject parent, Module module, Environment environment)
          Create a concept named name in the designated module, with the designated parent superconcept (which can be left undefined).
static LogicObject createEnumeratedList(Cons members, Module module, Environment environment)
          Create a logical term that denotes a list containing members in module using environment.
static LogicObject createEnumeratedSet(Cons members, Module module, Environment environment)
          Create a logical term that denotes the enumerated set containing members in module using environment.
static LogicObject createFunction(java.lang.String name, int arity, Module module, Environment environment)
          Create a function named name with arity arity in the designated module.
static Keyword createKeyword(java.lang.String name)
          Returns the Stella keyword name, creating it if necessary.
static Module createModule(java.lang.String name, Module parent, boolean caseSensitiveP)
          Creates a new module name as a child of parent.
static LogicObject createObject(java.lang.String name, LogicObject concept, Module module, Environment environment)
          Create an object named name of type concept in the designated module.
static LogicObject createRelation(java.lang.String name, int arity, Module module, Environment environment)
          Create a relation named name with arity arity in the designated module.
static Symbol createSymbol(java.lang.String name, Module module, Environment environment)
          Returns the Stella symbol name visible in module, creating it if necessary.
static void destroyObject(LogicObject renamed_Object)
          Delete the object renamed_Object, retracting all facts attached to it.
static Stella_Object evaluate(Stella_Object command, Module module, Environment environment)
          Evaluate the command command within module and return the result.
static java.lang.String generateUniqueName(java.lang.String prefix, Module module, Environment environment)
          Generates a name based on prefix with a number appended that is not currently in use in moduleD In a non-case-sensitive module, the returned name will be all upper case (This latter feature may change!)
static int getArity(LogicObject relation)
          Return the arity of the relation relation.
static Proposition getBinaryProposition(LogicObject relation, Stella_Object arg1, Stella_Object arg2, Module module, Environment environment)
          Return a proposition such that (relation arg1 arg2) is true.
static PlIterator getBinaryPropositions(LogicObject relation, Stella_Object arg1, Stella_Object arg2, Module module, Environment environment)
          Return propositions such that (relation arg1 arg2) is true.
static PlIterator getChildModules(Module module)
          Return the modules that are immediate children of module.
static int getColumnCount(Stella_Object obj)
          Return the number of columns in obj, which must be of type proposition, cons, vector or PL-iterator.
static LogicObject getConcept(java.lang.String name, Module module, Environment environment)
          Return a class/concept named name that is local to or visible from the module module.
static Stella_Object getConceptInstanceMatchingValue(LogicObject concept, LogicObject relation, Stella_Object value, Module module, Environment environment)
          Return a member of concept concept that has an attribute matching value for the binary relation relation, i.e., _relationLresultGValue_ holds.
static PlIterator getConceptInstances(LogicObject concept, Module module, Environment environment)
          Return instances of the concept concept.
static PlIterator getConceptInstancesMatchingValue(LogicObject concept, LogicObject relation, Stella_Object value, Module module, Environment environment)
          Return members of concept concept that have an attribute matching value for the binary relation relation, i.e., _relationLresultGValue_ holds.
static PlIterator getDirectConceptInstances(LogicObject concept, Module module, Environment environment)
          Return instances of concept concept.
static PlIterator getDirectSubrelations(LogicObject relation, Module module, Environment environment)
          Return relations that directly specialize relation.
static PlIterator getDirectSuperrelations(LogicObject relation, Module module, Environment environment)
          Return relations that directly generalize relation.
static PlIterator getDirectTypes(LogicObject renamed_Object, Module module, Environment environment)
          Return most specific concepts that renamed_Object belongs to.
static LogicObject getDomain(LogicObject relation)
          Return the type (a concept) for the first argument to the binary relation relation.
static Cons getEnumeratedCollectionMembers(Stella_Object collection, Module module, Environment environment)
          Returns the members of an enumerated collection.
static Module getHomeModule(LogicObject renamed_Object)
          Return the module in which renamed_Object was created.
static PlIterator getInferredBinaryPropositionValues(LogicObject relation, Stella_Object arg, Module module, Environment environment)
          Return all values v such that (relation arg v) has been asserted or can be inferred.
static Keyword getKeyword(java.lang.String name)
          Returns the Stella KEYWORD name if it exists.
static Module getModule(java.lang.String name, Environment environment)
          Return a module named name.
static PlIterator getModules(boolean kbModulesOnlyP)
          Return all modules currently loaded into PowerLoom.
static java.lang.String getName(Stella_Object obj)
          Return the fully qualified name of obj, if it has one.
static java.lang.String getNameInModule(Stella_Object obj, Module module, Environment environment)
          Return the name, qualified as necessary, so that obj can be found from module.
static LogicObject getNthDomain(LogicObject relation, int n)
          Return the type (a concept) for the the nth argument of the relation relation.
static double getNthFloat(Stella_Object sequence, int n, Module module, Environment environment)
          Return the floating point value in the nth column of sequence.
static int getNthInteger(Stella_Object sequence, int n, Module module, Environment environment)
          Return an integer representation of the value in the nth column of sequence.
static LogicObject getNthLogicObject(Stella_Object sequence, int n, Module module, Environment environment)
          Return a logic object representation of the value in the nth column of sequence.
static java.lang.String getNthString(Stella_Object sequence, int n, Module module, Environment environment)
          Return a string representation of the value in the nth column of sequence.
static Stella_Object getNthValue(Stella_Object sequence, int n, Module module, Environment environment)
          Return the value in the nth column of sequence.
static Stella_Object getObject(java.lang.String name, Module module, Environment environment)
          Look for an object named name that is local to or visible from the module module.
static Symbol getOperator(java.lang.String name)
          Returns the logical operator object (a Stella SYMBOL) for name.
static PlIterator getParentModules(Module module)
          Return the modules that are immediate parents of module.
static LogicObject getPredicate(Proposition prop)
          Return the concept or relation predicate for the proposition prop.
static PlIterator getProperSubrelations(LogicObject relation, Module module, Environment environment)
          Return relations that specialize relation.
static PlIterator getProperSuperrelations(LogicObject relation, Module module, Environment environment)
          Return relations that generalize relation.
static Proposition getProposition(Stella_Object relationAndArguments, Module module, Environment environment)
          Return a proposition matching relationAndArguments that has been asserted (or inferred by forward chaining).
static PlIterator getPropositions(Stella_Object relationAndArguments, Module module, Environment environment)
          Return propositions matching relationAndArguments that have been asserted (or inferred by forward chaining).
static PlIterator getPropositionsInModule(Module module, Environment environment)
          Return propositions that have been conceived in the module module.
static PlIterator getPropositionsOf(LogicObject renamed_Object, Module module, Environment environment)
          Return all propositions that have renamed_Object among their arguments, and that are TRUE in the scope of the module module.
static LogicObject getRange(LogicObject relation)
          Return the type (a concept) for fillers of the binary relation relation.
static LogicObject getRelation(java.lang.String name, Module module, Environment environment)
          Return a concept or relation named name that is local to or visible from the module module.
static PlIterator getRelationExtension(LogicObject relation, Module module, Environment environment)
          Return propositions that satisfy relation.
static PlIterator getRules(LogicObject relation, Module module, Environment environment)
          Return rules attached to the concept/relation relation in either antecedent or consequent position.
static java.lang.String getShortName(Stella_Object obj)
          Return the short name of obj, if it has one.
static Symbol getSymbol(java.lang.String name, Module module, Environment environment)
          Returns the Stella SYMBOL name visible in module if it exists.
static PlIterator getTypes(LogicObject renamed_Object, Module module, Environment environment)
          Return all named concepts that renamed_Object belongs to.
static void initialize()
          Initialize the PowerLoom logic system.
static boolean isA(Stella_Object renamed_Object, LogicObject concept, Module module, Environment environment)
          Return TRUE if renamed_Object is a member of the concept concept.
static boolean isDefault(TruthValue tv)
          Tests whether tv is a default truth value.
static boolean isEnumeratedCollection(Stella_Object obj)
          Test whether obj is an enumerated collection.
static boolean isEnumeratedList(Stella_Object obj)
          Test whether obj is an enumerated list
static boolean isEnumeratedSet(Stella_Object obj)
          Test whether obj is an enumerated set.
static boolean isFalse(TruthValue tv)
          Tests whether tv is a false truth value.
static boolean isFloat(Stella_Object obj)
          Test whether obj is of type FLOAT (double)
static boolean isInconsistent(TruthValue tv)
          Tests whether tv is an inconsistent truth value.
static boolean isInteger(Stella_Object obj)
          Test whether obj is of type INTEGER
static boolean isLogicObject(Stella_Object obj)
          Test whether obj is of type LOGIC-OBJECT
static boolean isNumber(Stella_Object obj)
          Test whether obj is of type NUMBER.
static boolean isStrict(TruthValue tv)
          Tests whether tv is a strict (non-default) truth value.
static boolean isString(Stella_Object obj)
          Test whether obj is of type STRING
static boolean isSubrelation(LogicObject sub, LogicObject renamed_Super, Module module, Environment environment)
          Return TRUE if sub is a subconcept/subrelation of renamed_Super.
static boolean isTrue(TruthValue tv)
          Tests whether tv is a true truth value.
static boolean isTrueBinaryProposition(LogicObject relation, Stella_Object arg, Stella_Object value, Module module, Environment environment)
          Return TRUE if the proposition (relation arg value) has been asserted (or inferred by forward chaining).
static boolean isTrueProposition(Proposition proposition, Module module, Environment environment)
          Return TRUE if proposition is TRUE in the module module.
static boolean isTrueProposition1(Stella_Object relationAndArguments, Module module, Environment environment)
          Return TRUE if a proposition (relation args) has been asserted (or inferred by forward chaining).
static boolean isTrueUnaryProposition(LogicObject relation, Stella_Object arg, Module module, Environment environment)
          Return TRUE if the proposition (relation arg) has been asserted (or inferred by forward chaining).
static boolean isUnknown(TruthValue tv)
          Tests whether tv is an unknown truth value.
static void load(java.lang.String filename, Environment environment)
          Read logic commands from the file named filename and evaluate them.
static void loadNativeStream(java.io.PushbackInputStream stream, Environment environment)
          Read logic commands from the native input stream stream and evaluate them.
static void loadStream(InputStream stream, Environment environment)
          Read logic commands from the STELLA stream stream and evaluate them.
static void main(java.lang.String[] argv058)
          Main PowerLoom entry point for your code in C++ and Java.
static double objectToFloat(Stella_Object self)
          Coerce self to a float, or throw a Stella Exception if the coersion is not feasible.
static int objectToInteger(Stella_Object self)
          Coerce self to an integer, or throw a Stella Exception if the coersion is not feasible.
static java.lang.String objectToParsableString(Stella_Object self)
          Return a string representing a printed representation of the object self.
static java.lang.String objectToString(Stella_Object self)
          Return a printed representation of the term self as a string.
static void registerSpecialistFunction(java.lang.String name, java.lang.reflect.Method functionReference, Module module, Environment environment)
          Register name as a function name in module which will invoke the native code procedure described by functionReferenceD The name is a fully-qualified name which will be interpreted by the normal rules for reading names in PowerLoom.
static void resetPowerloom()
          Reset PowerLoom to its initial state.
static Proposition retractBinaryProposition(LogicObject relation, Stella_Object arg, Stella_Object value, Module module, Environment environment)
          Retract that the proposition (relation arg value) is TRUE in module.
static Proposition retractNaryProposition(Stella_Object relationAndArguments, Module module, Environment environment)
          Retract the proposition that arguments satisfies the relation relation.
static Proposition retractProposition(Proposition proposition, Module module, Environment environment)
          Retract the truth of the proposition proposition in module.
static Proposition retractUnaryProposition(LogicObject relation, Stella_Object arg, Module module, Environment environment)
          Retract that the proposition (relation arg) is TRUE in module.
static PlIterator retrieve(Cons query, Module module, Environment environment)
          Returns an iterator of variable bindings that when substituted for the open variables in query satisfy the query proposition.
static void runForwardRules(Stella_Object module, boolean forceP)
          Run forward inference rules in module module.
static TruthValue sAsk(java.lang.String query, java.lang.String moduleName, Environment environment)
          Returns a truth value for query in module moduleName and environment.
static PlIterator sAssertProposition(java.lang.String sentence, java.lang.String moduleName, Environment environment)
          Assert that the logical sentence sentence is true in the module named moduleName.
static void saveModule(Module module, java.lang.String filename, java.lang.String ifexists, Environment environment)
          Save the contents of the module mod into a file named filename.
static Module sChangeModule(java.lang.String name, Environment environment)
          Set the current module to the module named name.
static Module sClearModule(java.lang.String name, Environment environment)
          Destroy the contents of the module named name, as well as the contents of all of its children, recursively.
static PlIterator sConceive(java.lang.String sentence, java.lang.String moduleName, Environment environment)
          Create one or more proposition objects from the sentence sentence in the module named moduleName.
static LogicObject sCreateConcept(java.lang.String name, java.lang.String parentName, java.lang.String moduleName, Environment environment)
          Create a concept named name in the designated module, with with the concept named parentName as superconcept (which can be left undefined).
static LogicObject sCreateFunction(java.lang.String name, int arity, java.lang.String moduleName, Environment environment)
          Create a function named name with arity arity in the designated module.
static Module sCreateModule(java.lang.String name, java.lang.String parentName, boolean caseSensitiveP, Environment environment)
          Creates a new module name as a child of parentName.
static LogicObject sCreateObject(java.lang.String name, java.lang.String conceptName, java.lang.String moduleName, Environment environment)
          Create an object named name of type conceptName in the designated module.
static LogicObject sCreateRelation(java.lang.String name, int arity, java.lang.String moduleName, Environment environment)
          Create a relation named name with arity arity in the designated module.
static void sDestroyObject(java.lang.String objectName, java.lang.String moduleName, Environment environment)
          Delete the object named objectName, retracting all facts attached to it.
static Stella_Object sEvaluate(java.lang.String command, java.lang.String moduleName, Environment environment)
          Evaluate the command represented by the string command within module and return the result.
static int sGetArity(java.lang.String relationName, java.lang.String moduleName, Environment environment)
          Return the arity of the relation named relationName.
static PlIterator sGetChildModules(java.lang.String name, Environment environment)
          Return the modules that are immediate children of module name.
static LogicObject sGetConcept(java.lang.String name, java.lang.String moduleName, Environment environment)
          Return a class/concept named name that is local to or visible from the module moduleName.
static PlIterator sGetConceptInstances(java.lang.String conceptName, java.lang.String moduleName, Environment environment)
          Return instances of concept conceptName.
static PlIterator sGetDirectConceptInstances(java.lang.String conceptName, java.lang.String moduleName, Environment environment)
          Return instances of concept conceptName.
static LogicObject sGetDomain(java.lang.String relationName, java.lang.String moduleName, Environment environment)
          Return the type (concept) for the first argument to the binary relation relationName.
static PlIterator sGetInferredBinaryPropositionValues(java.lang.String relationName, java.lang.String argName, java.lang.String moduleName, Environment environment)
          Return all values v such that (relationName argName v) has been asserted or can be inferred.
static LogicObject sGetNthDomain(java.lang.String relationName, int n, java.lang.String moduleName, Environment environment)
          Return the type (a concept) for the nth argument of the relation named relationName.
static Stella_Object sGetObject(java.lang.String name, java.lang.String moduleName, Environment environment)
          Look for an object named name that is local to or visible from the module moduleName.
static PlIterator sGetParentModules(java.lang.String name, Environment environment)
          Return the modules that are immediate parents of module name.
static Proposition sGetProposition(java.lang.String relationAndArguments, java.lang.String moduleName, Environment environment)
          Return a proposition matching relationAndArguments that has been asserted (or inferred by forward chaining).
static PlIterator sGetPropositions(java.lang.String relationAndArguments, java.lang.String moduleName, Environment environment)
          Return propositions matching relationAndArguments that have been asserted (or inferred by forward chaining).
static PlIterator sGetPropositionsOf(java.lang.String objectName, java.lang.String moduleName, Environment environment)
          Return all propositions that have the object named objectName among their arguments, and that are TRUE in the scope of the module moduleName.
static LogicObject sGetRange(java.lang.String relationName, java.lang.String moduleName, Environment environment)
          Return the type (a concept) for fillers of the binary relation relationName.
static LogicObject sGetRelation(java.lang.String name, java.lang.String moduleName, Environment environment)
          Return a concept or relation named name that is local to or visible from the module moduleName.
static PlIterator sGetRelationExtension(java.lang.String relationName, Module module, Environment environment)
          Return propositions that satisfy the relation named relationName.
static PlIterator sGetRules(java.lang.String relationName, java.lang.String moduleName, Environment environment)
          Return rules attached to the concept/relation named relationName found in the module named moduleName.
static boolean sIsTrueProposition(java.lang.String relationAndArguments, java.lang.String moduleName, Environment environment)
          Return TRUE if a proposition that prints as the string relationAndArguments is true in the module named moduleName.
static void sPrintRules(java.lang.String name, OutputStream stream, java.lang.String moduleName, Environment environment)
          Print rules attached to the concept/relation named name.
static void sRegisterSpecialistFunction(java.lang.String name, java.lang.String nativeName, java.lang.String moduleName, Environment environment)
          Register name as a function name in the module named moduleName.
static PlIterator sRetractProposition(java.lang.String sentence, java.lang.String moduleName, Environment environment)
          Retract the truth of the logical sentence sentence in the module named moduleName.
static PlIterator sRetrieve(java.lang.String query, java.lang.String moduleName, Environment environment)
          Returns an iterator of variable bindings that when substituted for the open variables in query satisfy the query proposition.
static void sSaveModule(java.lang.String moduleName, java.lang.String filename, java.lang.String ifexists, Environment environment)
          Save the contents of the module moduleName into a file named filename.
static Stella_Object stringToObject(java.lang.String string, LogicObject type, Module module, Environment environment)
          Evaluate string with respect to module and environment and return the corresponding logical term.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

$POWERLOOM_INITIALIZEDp$

public static boolean $POWERLOOM_INITIALIZEDp$

SGT_PLI_ENVIRONMENT

public static Surrogate SGT_PLI_ENVIRONMENT

SYM_STELLA_LEVEL

public static Symbol SYM_STELLA_LEVEL

ASSERTION_ENV

public static Environment ASSERTION_ENV

TAXONOMIC_ENV

public static Environment TAXONOMIC_ENV

INFERENCE_ENV

public static Environment INFERENCE_ENV

SGT_PLI_PL_ITERATOR

public static Surrogate SGT_PLI_PL_ITERATOR

SYM_PLI_pR

public static Symbol SYM_PLI_pR

SYM_PLI_pI

public static Symbol SYM_PLI_pI

SYM_PLI_pV

public static Symbol SYM_PLI_pV

SYM_PLI_F_GET_INFERRED_BINARY_PROPOSITION_VALUES_QUERY_000

public static Symbol SYM_PLI_F_GET_INFERRED_BINARY_PROPOSITION_VALUES_QUERY_000

SYM_PLI_PROPER_SUBRELATION

public static Symbol SYM_PLI_PROPER_SUBRELATION

KWD_CASE_SENSITIVEp

public static Keyword KWD_CASE_SENSITIVEp

KWD_SUBSET_OF

public static Keyword KWD_SUBSET_OF

SYM_PLI_STARTUP_PLI

public static Symbol SYM_PLI_STARTUP_PLI
Constructor Detail

PLI

public PLI()
Method Detail

initialize

public static void initialize()
Initialize the PowerLoom logic system. This function needs to be called by all applications before using PowerLoom. If it is called more than once, every call after the first one is a no-op.


resetPowerloom

public static void resetPowerloom()
Reset PowerLoom to its initial state. CAUTION: This will destroy all loaded knowledge bases and might break other loaded STELLA systems if they do reference PowerLoom symbols in their code.


clearCaches

public static void clearCaches()
Clear all query and memoization caches.


getKeyword

public static Keyword getKeyword(java.lang.String name)
Returns the Stella KEYWORD name if it exists. Case sensitive.

Parameters:
name -
Returns:
Keyword

getSymbol

public static Symbol getSymbol(java.lang.String name,
                               Module module,
                               Environment environment)
Returns the Stella SYMBOL name visible in module if it exists. name is ALWAYS treated case sensitively.

Parameters:
name -
module -
environment -
Returns:
Symbol

getOperator

public static Symbol getOperator(java.lang.String name)
Returns the logical operator object (a Stella SYMBOL) for name. If no such operator exists then a noSuchObject exception is thrown.

Parameters:
name -
Returns:
Symbol

getObject

public static Stella_Object getObject(java.lang.String name,
                                      Module module,
                                      Environment environment)
Look for an object named name that is local to or visible from the module module.

Parameters:
name -
module -
environment -
Returns:
Stella_Object

sGetObject

public static Stella_Object sGetObject(java.lang.String name,
                                       java.lang.String moduleName,
                                       Environment environment)
Look for an object named name that is local to or visible from the module moduleName. A module name of null or the empty string refers to the current module. If no module can be found with the name moduleName, then a Stella noSuchContextException is thrown.

Parameters:
name -
moduleName -
environment -
Returns:
Stella_Object

getConcept

public static LogicObject getConcept(java.lang.String name,
                                     Module module,
                                     Environment environment)
Return a class/concept named name that is local to or visible from the module module.

Parameters:
name -
module -
environment -
Returns:
LogicObject

sGetConcept

public static LogicObject sGetConcept(java.lang.String name,
                                      java.lang.String moduleName,
                                      Environment environment)
Return a class/concept named name that is local to or visible from the module moduleName. A module name of null or the empty string refers to the current module. If no module can be found with the name moduleName, then a Stella noSuchContextException is thrown.

Parameters:
name -
moduleName -
environment -
Returns:
LogicObject

getRelation

public static LogicObject getRelation(java.lang.String name,
                                      Module module,
                                      Environment environment)
Return a concept or relation named name that is local to or visible from the module module.

Parameters:
name -
module -
environment -
Returns:
LogicObject

sGetRelation

public static LogicObject sGetRelation(java.lang.String name,
                                       java.lang.String moduleName,
                                       Environment environment)
Return a concept or relation named name that is local to or visible from the module moduleName. A module name of null or the empty string refers to the current module. If no module can be found with the name moduleName, then a Stella noSuchContextException is thrown.

Parameters:
name -
moduleName -
environment -
Returns:
LogicObject

getNameInModule

public static java.lang.String getNameInModule(Stella_Object obj,
                                               Module module,
                                               Environment environment)
Return the name, qualified as necessary, so that obj can be found from module. If there is no name for the object return null.

Parameters:
obj -
module -
environment -
Returns:
String

getName

public static java.lang.String getName(Stella_Object obj)
Return the fully qualified name of obj, if it has one. Otherwise return null.

Parameters:
obj -
Returns:
String

getShortName

public static java.lang.String getShortName(Stella_Object obj)
Return the short name of obj, if it has one. Otherwise return null.

Parameters:
obj -
Returns:
String

objectToString

public static java.lang.String objectToString(Stella_Object self)
Return a printed representation of the term self as a string.

Parameters:
self -
Returns:
String

objectToInteger

public static int objectToInteger(Stella_Object self)
Coerce self to an integer, or throw a Stella Exception if the coersion is not feasible. Floating point values will be coerced by rounding.

Parameters:
self -
Returns:
int

objectToFloat

public static double objectToFloat(Stella_Object self)
Coerce self to a float, or throw a Stella Exception if the coersion is not feasible.

Parameters:
self -
Returns:
double

objectToParsableString

public static java.lang.String objectToParsableString(Stella_Object self)
Return a string representing a printed representation of the object self. Like objectToString, but puts escaped double quotes around strings.

Parameters:
self -
Returns:
String

stringToObject

public static Stella_Object stringToObject(java.lang.String string,
                                           LogicObject type,
                                           Module module,
                                           Environment environment)
Evaluate string with respect to module and environment and return the corresponding logical term. type is a concept used to assist the correct interpretation of string.

Currently type only has an effect on the interpretation of literal types.

Parameters:
string -
type -
module -
environment -
Returns:
Stella_Object

getProposition

public static Proposition getProposition(Stella_Object relationAndArguments,
                                         Module module,
                                         Environment environment)
Return a proposition matching relationAndArguments that has been asserted (or inferred by forward chaining). relationAndArguments is a sequence containing objects and nulls. The first argument must be the name of a relation. A null value acts like a wild card. If more than one proposition matches the input criteria, the selection among satisficing propositions is arbitrary. This procedure is normally applied to single-valued relations or functions.

Parameters:
relationAndArguments -
module -
environment -
Returns:
Proposition

sGetProposition

public static Proposition sGetProposition(java.lang.String relationAndArguments,
                                          java.lang.String moduleName,
                                          Environment environment)
Return a proposition matching relationAndArguments that has been asserted (or inferred by forward chaining). relationAndArguments is a string that begins with a left parenthesis, followed by a relation name, one or more argument identifiers, and terminated by a right parenthesis. Each argument identifier can be the name of a logical constant, a literal reference (e.g., a number), the null identifier, or a variable (an identifier that begins with a question mark). Each occurrence of a null or a variable acts like a wild card. If more than one proposition matches the input criteria, the selection among satisficing propositions is arbitrary. This procedure is normally applied to single-valued relations or functions.

A module name of null or the empty string refers to the current module. If no module can be found with the name moduleName, then a Stella noSuchContextException is thrown.

Parameters:
relationAndArguments -
moduleName -
environment -
Returns:
Proposition

getPropositions

public static PlIterator getPropositions(Stella_Object relationAndArguments,
                                         Module module,
                                         Environment environment)
Return propositions matching relationAndArguments that have been asserted (or inferred by forward chaining). relationAndArguments is a sequence containing objects and nulls. The first argument must be the name of a relation. A null value acts like a wild card.

Parameters:
relationAndArguments -
module -
environment -
Returns:
PlIterator

sGetPropositions

public static PlIterator sGetPropositions(java.lang.String relationAndArguments,
                                          java.lang.String moduleName,
                                          Environment environment)
Return propositions matching relationAndArguments that have been asserted (or inferred by forward chaining). relationAndArguments is a string that begins with a left parenthesis, followed by a relation name, one or more argument identifiers, and terminated by a right parenthesis. Each argument identifier can be the name of a logical constant, a literal reference (e.g., a number), the null identifier, or a variable (an identifier that begins with a question mark). Each occurrence of a null or a variable acts like a wild card.

A module name of null or the empty string refers to the current module. If no module can be found with the name moduleName, then a Stella noSuchContextException is thrown.

Parameters:
relationAndArguments -
moduleName -
environment -
Returns:
PlIterator

getBinaryProposition

public static Proposition getBinaryProposition(LogicObject relation,
                                               Stella_Object arg1,
                                               Stella_Object arg2,
                                               Module module,
                                               Environment environment)
Return a proposition such that (relation arg1 arg2) is true. The relation argument must be bound to a relation. One or both of the arg1 and arg2 arguments may be set to NULL, which is interpreted as a wildcard. If more than one proposition matches the input criteria, the selection is arbitrary. This procedure is normally applied to single-valued relations or functions.

Parameters:
relation -
arg1 -
arg2 -
module -
environment -
Returns:
Proposition

getBinaryPropositions

public static PlIterator getBinaryPropositions(LogicObject relation,
                                               Stella_Object arg1,
                                               Stella_Object arg2,
                                               Module module,
                                               Environment environment)
Return propositions such that (relation arg1 arg2) is true. The relation argument must be bound to a relation. One or both of the arg1 and arg2 arguments may be set to NULL, which is interpreted as a wildcard.

Parameters:
relation -
arg1 -
arg2 -
module -
environment -
Returns:
PlIterator

getInferredBinaryPropositionValues

public static PlIterator getInferredBinaryPropositionValues(LogicObject relation,
                                                            Stella_Object arg,
                                                            Module module,
                                                            Environment environment)
Return all values v such that (relation arg v) has been asserted or can be inferred.

Parameters:
relation -
arg -
module -
environment -
Returns:
PlIterator

sGetInferredBinaryPropositionValues

public static PlIterator sGetInferredBinaryPropositionValues(java.lang.String relationName,
                                                             java.lang.String argName,
                                                             java.lang.String moduleName,
                                                             Environment environment)
Return all values v such that (relationName argName v) has been asserted or can be inferred.

A module name of null or the empty string refers to the current module. If no module can be found with the name moduleName, then a Stella noSuchContextException is thrown.

Parameters:
relationName -
argName -
moduleName -
environment -
Returns:
PlIterator

getPropositionsOf

public static PlIterator getPropositionsOf(LogicObject renamed_Object,
                                           Module module,
                                           Environment environment)
Return all propositions that have renamed_Object among their arguments, and that are TRUE in the scope of the module module.

Parameters:
renamed_Object -
module -
environment -
Returns:
PlIterator

sGetPropositionsOf

public static PlIterator sGetPropositionsOf(java.lang.String objectName,
                                            java.lang.String moduleName,
                                            Environment environment)
Return all propositions that have the object named objectName among their arguments, and that are TRUE in the scope of the module moduleName. A module name of null or the empty string refers to the current module. If no module can be found with the name moduleName, then a Stella noSuchContextException is thrown.

Parameters:
objectName -
moduleName -
environment -
Returns:
PlIterator

getPropositionsInModule

public static PlIterator getPropositionsInModule(Module module,
                                                 Environment environment)
Return propositions that have been conceived in the module module.

Parameters:
module -
environment -
Returns:
PlIterator

isTrueUnaryProposition

public static boolean isTrueUnaryProposition(LogicObject relation,
                                             Stella_Object arg,
                                             Module module,
                                             Environment environment)
Return TRUE if the proposition (relation arg) has been asserted (or inferred by forward chaining).

Parameters:
relation -
arg -
module -
environment -
Returns:
boolean

isTrueBinaryProposition

public static boolean isTrueBinaryProposition(LogicObject relation,
                                              Stella_Object arg,
                                              Stella_Object value,
                                              Module module,
                                              Environment environment)
Return TRUE if the proposition (relation arg value) has been asserted (or inferred by forward chaining).

Parameters:
relation -
arg -
value -
module -
environment -
Returns:
boolean

isTrueProposition1

public static boolean isTrueProposition1(Stella_Object relationAndArguments,
                                         Module module,
                                         Environment environment)
Return TRUE if a proposition (relation args) has been asserted (or inferred by forward chaining).

Parameters:
relationAndArguments -
module -
environment -
Returns:
boolean

isTrueProposition

public static boolean isTrueProposition(Proposition proposition,
                                        Module module,
                                        Environment environment)
Return TRUE if proposition is TRUE in the module module.

Parameters:
proposition -
module -
environment -
Returns:
boolean

sIsTrueProposition

public static boolean sIsTrueProposition(java.lang.String relationAndArguments,
                                         java.lang.String moduleName,
                                         Environment environment)
Return TRUE if a proposition that prints as the string relationAndArguments is true in the module named moduleName. A module name of null or the empty string refers to the current module. If no module can be found with the name moduleName, then a Stella noSuchContextException is thrown.

Parameters:
relationAndArguments -
moduleName -
environment -
Returns:
boolean

isSubrelation

public static boolean isSubrelation(LogicObject sub,
                                    LogicObject renamed_Super,
                                    Module module,
                                    Environment environment)
Return TRUE if sub is a subconcept/subrelation of renamed_Super.

Parameters:
sub -
renamed_Super -
module -
environment -
Returns:
boolean

getProperSubrelations

public static PlIterator getProperSubrelations(LogicObject relation,
                                               Module module,
                                               Environment environment)
Return relations that specialize relation. Non-reflexive.

Parameters:
relation -
module -
environment -
Returns:
PlIterator

getDirectSubrelations

public static PlIterator getDirectSubrelations(LogicObject relation,
                                               Module module,
                                               Environment environment)
Return relations that directly specialize relation. Non-reflexive.

Parameters:
relation -
module -
environment -
Returns:
PlIterator

getProperSuperrelations

public static PlIterator getProperSuperrelations(LogicObject relation,
                                                 Module module,
                                                 Environment environment)
Return relations that generalize relation. Non-reflexive.

Parameters:
relation -
module -
environment -
Returns:
PlIterator

getDirectSuperrelations

public static PlIterator getDirectSuperrelations(LogicObject relation,
                                                 Module module,
                                                 Environment environment)
Return relations that directly generalize relation. Non-reflexive.

Parameters:
relation -
module -
environment -
Returns:
PlIterator

isA

public static boolean isA(Stella_Object renamed_Object,
                          LogicObject concept,
                          Module module,
                          Environment environment)
Return TRUE if renamed_Object is a member of the concept concept.

Parameters:
renamed_Object -
concept -
module -
environment -
Returns:
boolean

getConceptInstances

public static PlIterator getConceptInstances(LogicObject concept,
                                             Module module,
                                             Environment environment)
Return instances of the concept concept. Include instances of subconcepts of concept. Depending on concept, the return values could be (wrapped) literals.

Parameters:
concept -
module -
environment -
Returns:
PlIterator

sGetConceptInstances

public static PlIterator sGetConceptInstances(java.lang.String conceptName,
                                              java.lang.String moduleName,
                                              Environment environment)
Return instances of concept conceptName. Include instances of subconcepts of conceptName. Depending on conceptName, the return values could be (wrapped) literals.

A module name of null or the empty string refers to the current module. If no module can be found with the name moduleName, then a Stella noSuchContextException is thrown.

Parameters:
conceptName -
moduleName -
environment -
Returns:
PlIterator

getDirectConceptInstances

public static PlIterator getDirectConceptInstances(LogicObject concept,
                                                   Module module,
                                                   Environment environment)
Return instances of concept concept. Exclude instances of subconcepts of concept. Depending on concept, the return values could be (wrapped) literals.

Parameters:
concept -
module -
environment -
Returns:
PlIterator

sGetDirectConceptInstances

public static PlIterator sGetDirectConceptInstances(java.lang.String conceptName,
                                                    java.lang.String moduleName,
                                                    Environment environment)
Return instances of concept conceptName. Exclude instances of subconcepts of conceptName. Depending on conceptName, the return values could be (wrapped) literals.

A module name of null or the empty string refers to the current module. If no module can be found with the name moduleName, then a Stella noSuchContextException is thrown.

Parameters:
conceptName -
moduleName -
environment -
Returns:
PlIterator

getConceptInstancesMatchingValue

public static PlIterator getConceptInstancesMatchingValue(LogicObject concept,
                                                          LogicObject relation,
                                                          Stella_Object value,
                                                          Module module,
                                                          Environment environment)
Return members of concept concept that have an attribute matching value for the binary relation relation, i.e., _relationLresultGValue_ holds.

Parameters:
concept -
relation -
value -
module -
environment -
Returns:
PlIterator

getConceptInstanceMatchingValue

public static Stella_Object getConceptInstanceMatchingValue(LogicObject concept,
                                                            LogicObject relation,
                                                            Stella_Object value,
                                                            Module module,
                                                            Environment environment)
Return a member of concept concept that has an attribute matching value for the binary relation relation, i.e., _relationLresultGValue_ holds.

Parameters:
concept -
relation -
value -
module -
environment -
Returns:
Stella_Object

getTypes

public static PlIterator getTypes(LogicObject renamed_Object,
                                  Module module,
                                  Environment environment)
Return all named concepts that renamed_Object belongs to.

Parameters:
renamed_Object -
module -
environment -
Returns:
PlIterator

getDirectTypes

public static PlIterator getDirectTypes(LogicObject renamed_Object,
                                        Module module,
                                        Environment environment)
Return most specific concepts that renamed_Object belongs to.

Parameters:
renamed_Object -
module -
environment -
Returns:
PlIterator

getRelationExtension

public static PlIterator getRelationExtension(LogicObject relation,
                                              Module module,
                                              Environment environment)
Return propositions that satisfy relation. Include propositions that satisfy subrelations of relation.

Parameters:
relation -
module -
environment -
Returns:
PlIterator

sGetRelationExtension

public static PlIterator sGetRelationExtension(java.lang.String relationName,
                                               Module module,
                                               Environment environment)
Return propositions that satisfy the relation named relationName. Include propositions that satisfy subrelations of the relation.

Parameters:
relationName -
module -
environment -
Returns:
PlIterator

getModule

public static Module getModule(java.lang.String name,
                               Environment environment)
Return a module named name.

Parameters:
name -
environment -
Returns:
Module

getHomeModule

public static Module getHomeModule(LogicObject renamed_Object)
Return the module in which renamed_Object was created.

Parameters:
renamed_Object -
Returns:
Module

getModules

public static PlIterator getModules(boolean kbModulesOnlyP)
Return all modules currently loaded into PowerLoom. If kbModulesOnlyP is true, then Stella modules that are used only for program code are not included in the list.

Parameters:
kbModulesOnlyP -
Returns:
PlIterator

createModule

public static Module createModule(java.lang.String name,
                                  Module parent,
                                  boolean caseSensitiveP)
Creates a new module name as a child of parent. The flag caseSensitiveP controls whether names read in this module will be case sensitive or not.

Parameters:
name -
parent -
caseSensitiveP -
Returns:
Module

sCreateModule

public static Module sCreateModule(java.lang.String name,
                                   java.lang.String parentName,
                                   boolean caseSensitiveP,
                                   Environment environment)
Creates a new module name as a child of parentName. The flag caseSensitiveP controls whether names read in this module will be case sensitive or not.

Parameters:
name -
parentName -
caseSensitiveP -
environment -
Returns:
Module

changeModule

public static Module changeModule(Module module)
Set the current module to module and return it. If module is null, then no switch is performed and the current module is returned.

Parameters:
module -
Returns:
Module

sChangeModule

public static Module sChangeModule(java.lang.String name,
                                   Environment environment)
Set the current module to the module named name. The return value is the module named name unless name is null or the empty string. In that case, the current module is returned. If no module named name exists, a Stella noSuchContextException is thrown.

Parameters:
name -
environment -
Returns:
Module

clearModule

public static Module clearModule(Module module)
Destroy the contents of the module module as well as the contents of all of its children, recursively.

Parameters:
module -
Returns:
Module

sClearModule

public static Module sClearModule(java.lang.String name,
                                  Environment environment)
Destroy the contents of the module named name, as well as the contents of all of its children, recursively. If no module named name exists, a Stella noSuchContextException is thrown.

Parameters:
name -
environment -
Returns:
Module

getChildModules

public static PlIterator getChildModules(Module module)
Return the modules that are immediate children of module.

Parameters:
module -
Returns:
PlIterator

sGetChildModules

public static PlIterator sGetChildModules(java.lang.String name,
                                          Environment environment)
Return the modules that are immediate children of module name. If no module named name exists, a Stella noSuchContextException is thrown.

Parameters:
name -
environment -
Returns:
PlIterator

getParentModules

public static PlIterator getParentModules(Module module)
Return the modules that are immediate parents of module.

Parameters:
module -
Returns:
PlIterator

sGetParentModules

public static PlIterator sGetParentModules(java.lang.String name,
                                           Environment environment)
Return the modules that are immediate parents of module name. If no module named name exists, a Stella noSuchContextException is thrown.

Parameters:
name -
environment -
Returns:
PlIterator

generateUniqueName

public static java.lang.String generateUniqueName(java.lang.String prefix,
                                                  Module module,
                                                  Environment environment)
Generates a name based on prefix with a number appended that is not currently in use in moduleD In a non-case-sensitive module, the returned name will be all upper case (This latter feature may change!)

Parameters:
prefix -
module -
environment -
Returns:
String

createKeyword

public static Keyword createKeyword(java.lang.String name)
Returns the Stella keyword name, creating it if necessary. name is treated case-sensitively. This should generally not be necessary to do.

Parameters:
name -
Returns:
Keyword

createSymbol

public static Symbol createSymbol(java.lang.String name,
                                  Module module,
                                  Environment environment)
Returns the Stella symbol name visible in module, creating it if necessary. name is ALWAYS treated case-sensitively, even if module is case insensitive. This should generally not be necessary to do.

Parameters:
name -
module -
environment -
Returns:
Symbol

createObject

public static LogicObject createObject(java.lang.String name,
                                       LogicObject concept,
                                       Module module,
                                       Environment environment)
Create an object named name of type concept in the designated module. Both name and concept can be null. If name is null then an object will be created with a new, non-conflicting name based on the name of concept, or system-generated if no concept is specified. If concept is null, then the object will be of type THING. It is an error to create an object with the same name as an existing object.

Note that the string can be a qualified name, in which case the object will be created in the module specified, but with a name as determined by the qualified name. Vertical bars in the name string are interpreted as Stella escape characters.

Note that because names in modules that are not case-sensitive are canonicalized, the name of the returned object may not match name exactly.

Return the object.

Parameters:
name -
concept -
module -
environment -
Returns:
LogicObject

sCreateObject

public static LogicObject sCreateObject(java.lang.String name,
                                        java.lang.String conceptName,
                                        java.lang.String moduleName,
                                        Environment environment)
Create an object named name of type conceptName in the designated module. Both name and conceptName can be null strings. If name is a null string then an object will be created with a new, non-conflicting name based on conceptName, or system-generated if no concept nameis specified. If conceptName is the null string, then the object will be of type THING.

A module name of null or the empty string refers to the current module. If no module can be found with the name moduleName, then a Stella noSuchContextException is thrown.

Note that because names in modules that are not case-sensitive are canonicalized, the name of the returned object may not match name exactly.

Return the object.

Parameters:
name -
conceptName -
moduleName -
environment -
Returns:
LogicObject

createConcept

public static LogicObject createConcept(java.lang.String name,
                                        LogicObject parent,
                                        Module module,
                                        Environment environment)
Create a concept named name in the designated module, with the designated parent superconcept (which can be left undefined). Additional superconcepts can be added via assertions of the subsetOf relation. Note that a specified parent concept needs to be created separately.

Note that because names in modules that are not case-sensitive are canonicalized, the name of the returned object may not match name exactly.

Parameters:
name -
parent -
module -
environment -
Returns:
LogicObject

sCreateConcept

public static LogicObject sCreateConcept(java.lang.String name,
                                         java.lang.String parentName,
                                         java.lang.String moduleName,
                                         Environment environment)
Create a concept named name in the designated module, with with the concept named parentName as superconcept (which can be left undefined). Additional superconcepts can be added via assertions of the subsetOf relation. Note that a specified parent concept needs to be created separately.

A module name of null or the empty string refers to the current module. If no module can be found with the name moduleName, then a Stella noSuchContextException is thrown.

Note that because names in modules that are not case-sensitive are canonicalized, the name of the returned object may not match name exactly.

Parameters:
name -
parentName -
moduleName -
environment -
Returns:
LogicObject

createRelation

public static LogicObject createRelation(java.lang.String name,
                                         int arity,
                                         Module module,
                                         Environment environment)
Create a relation named name with arity arity in the designated module. Domain and range information can be added via assertions of nthDomain (or domain and range) relations.

Note that because names in modules that are not case-sensitive are canonicalized, the name of the returned object may not match name exactly.

Parameters:
name -
arity -
module -
environment -
Returns:
LogicObject

sCreateRelation

public static LogicObject sCreateRelation(java.lang.String name,
                                          int arity,
                                          java.lang.String moduleName,
                                          Environment environment)
Create a relation named name with arity arity in the designated module. Domain and range information can be added via assertions of nthDomain (or domain and range) relations.

A module name of null or the empty string refers to the current module. If no module can be found with the name moduleName, then a Stella noSuchContextException is thrown.

Note that because names in modules that are not case-sensitive are canonicalized, the name of the returned object may not match name exactly.

Parameters:
name -
arity -
moduleName -
environment -
Returns:
LogicObject

createFunction

public static LogicObject createFunction(java.lang.String name,
                                         int arity,
                                         Module module,
                                         Environment environment)
Create a function named name with arity arity in the designated module. Domain and range information can be added via assertions of nthDomain (or domain and range) relations.

Note that because names in modules that are not case-sensitive are canonicalized, the name of the returned object may not match name exactly.

Parameters:
name -
arity -
module -
environment -
Returns:
LogicObject

sCreateFunction

public static LogicObject sCreateFunction(java.lang.String name,
                                          int arity,
                                          java.lang.String moduleName,
                                          Environment environment)
Create a function named name with arity arity in the designated module. Domain and range information can be added via assertions of domain, nthDomain and range relations.

A module name of null or the empty string refers to the current module. If no module can be found with the name moduleName, then a Stella noSuchContextException is thrown.

Note that because names in modules that are not case-sensitive are canonicalized, the name of the returned object may not match name exactly.

Parameters:
name -
arity -
moduleName -
environment -
Returns:
LogicObject

registerSpecialistFunction

public static void registerSpecialistFunction(java.lang.String name,
                                              java.lang.reflect.Method functionReference,
                                              Module module,
                                              Environment environment)
Register name as a function name in module which will invoke the native code procedure described by functionReferenceD The name is a fully-qualified name which will be interpreted by the normal rules for reading names in PowerLoom. The function must conform to the signature for specialist functions.

The exact form of functionReference depends on the underlying programming language. The following type mappings are used: C++: Common Lisp: FUNCTION (result of #' or (FUNCTION ...)) Java: java.lang.reflect.Method

Parameters:
name -
functionReference -
module -
environment -

sRegisterSpecialistFunction

public static void sRegisterSpecialistFunction(java.lang.String name,
                                               java.lang.String nativeName,
                                               java.lang.String moduleName,
                                               Environment environment)
Register name as a function name in the module named moduleName. This function will the native code named nativeName. The name is a fully-qualified name which will be interpreted by the normal rules for reading names in PowerLoom. The nativeName will be processed in a manner that depends on the underlying programming language. The following type mappings are used: C++: Not available. Error signaled. Common Lisp: The native-name is read by READ-FROM-STRING and then the SYMBOL-FUNCTION is taken. Java: A fully package-qualified name is required. It is looked up using the Reflection tools. The function found must conform to the signature for specialist functions.

Parameters:
name -
nativeName -
moduleName -
environment -

createEnumeratedList

public static LogicObject createEnumeratedList(Cons members,
                                               Module module,
                                               Environment environment)
Create a logical term that denotes a list containing members in module using environment. Useful for passing lists as arguments to parameterized queries.

Parameters:
members -
module -
environment -
Returns:
LogicObject

createEnumeratedSet

public static LogicObject createEnumeratedSet(Cons members,
                                              Module module,
                                              Environment environment)
Create a logical term that denotes the enumerated set containing members in module using environment.

Parameters:
members -
module -
environment -
Returns:
LogicObject

destroyObject

public static void destroyObject(LogicObject renamed_Object)
Delete the object renamed_Object, retracting all facts attached to it.

Parameters:
renamed_Object -

sDestroyObject

public static void sDestroyObject(java.lang.String objectName,
                                  java.lang.String moduleName,
                                  Environment environment)
Delete the object named objectName, retracting all facts attached to it.

A module name of null or the empty string refers to the current module. If no module can be found with the name moduleName, then a Stella noSuchContextException is thrown.

Parameters:
objectName -
moduleName -
environment -

assertUnaryProposition

public static Proposition assertUnaryProposition(LogicObject relation,
                                                 Stella_Object arg,
                                                 Module module,
                                                 Environment environment)
Assert that the proposition (relation arg) is TRUE in module. Return the asserted proposition.

Parameters:
relation -
arg -
module -
environment -
Returns:
Proposition

assertBinaryProposition

public static Proposition assertBinaryProposition(LogicObject relation,
                                                  Stella_Object arg,
                                                  Stella_Object value,
                                                  Module module,
                                                  Environment environment)
Assert that the proposition (relation arg value) is TRUE in module. Return the asserted proposition.

Parameters:
relation -
arg -
value -
module -
environment -
Returns:
Proposition

assertNaryProposition

public static Proposition assertNaryProposition(Stella_Object relationAndArguments,
                                                Module module,
                                                Environment environment)
Assert that the proposition represented by the list RelationAndArguments satisfies the relation relation.

Parameters:
relationAndArguments -
module -
environment -
Returns:
Proposition

retractUnaryProposition

public static Proposition retractUnaryProposition(LogicObject relation,
                                                  Stella_Object arg,
                                                  Module module,
                                                  Environment environment)
Retract that the proposition (relation arg) is TRUE in module. Return the asserted proposition.

Parameters:
relation -
arg -
module -
environment -
Returns:
Proposition

retractBinaryProposition

public static Proposition retractBinaryProposition(LogicObject relation,
                                                   Stella_Object arg,
                                                   Stella_Object value,
                                                   Module module,
                                                   Environment environment)
Retract that the proposition (relation arg value) is TRUE in module. Return the asserted proposition.

Parameters:
relation -
arg -
value -
module -
environment -
Returns:
Proposition

retractNaryProposition

public static Proposition retractNaryProposition(Stella_Object relationAndArguments,
                                                 Module module,
                                                 Environment environment)
Retract the proposition that arguments satisfies the relation relation.

Parameters:
relationAndArguments -
module -
environment -
Returns:
Proposition

assertProposition

public static Proposition assertProposition(Proposition proposition,
                                            Module module,
                                            Environment environment)
Assert that the proposition proposition is true in module. Return the asserted proposition.

Parameters:
proposition -
module -
environment -
Returns:
Proposition

sAssertProposition

public static PlIterator sAssertProposition(java.lang.String sentence,
                                            java.lang.String moduleName,
                                            Environment environment)
Assert that the logical sentence sentence is true in the module named moduleName. A module name of null or the empty string refers to the current module. If no module can be found with the name moduleName, then a Stella noSuchContextException is thrown.

Return an iterator of the propositions resulting from sentence.

Parameters:
sentence -
moduleName -
environment -
Returns:
PlIterator

retractProposition

public static Proposition retractProposition(Proposition proposition,
                                             Module module,
                                             Environment environment)
Retract the truth of the proposition proposition in module. Return the retracted proposition.

Parameters:
proposition -
module -
environment -
Returns:
Proposition

sRetractProposition

public static PlIterator sRetractProposition(java.lang.String sentence,
                                             java.lang.String moduleName,
                                             Environment environment)
Retract the truth of the logical sentence sentence in the module named moduleName. A module name of null or the empty string refers to the current module. If no module can be found with the name moduleName, then a Stella noSuchContextException is thrown.

Return an iterator of the retracted propositions resulting from sentence.

Parameters:
sentence -
moduleName -
environment -
Returns:
PlIterator

conceive

public static PlIterator conceive(Stella_Object sentence,
                                  Module module,
                                  Environment environment)
Create one or more proposition objects from the sentence sentence in the module module. Return an iterator of the propositions. If any of the new propositions has the same structure as an already existing proposition, an automatic check for duplicates will return the pre-existing proposition. Multiple propositions may be returned for a single sentence because of normalization of equivalences, conjunctions, etc.

Signals a Proposition_Error if PowerLoom could not conceive sentence.

Parameters:
sentence -
module -
environment -
Returns:
PlIterator

sConceive

public static PlIterator sConceive(java.lang.String sentence,
                                   java.lang.String moduleName,
                                   Environment environment)
Create one or more proposition objects from the sentence sentence in the module named moduleName. Return an iterator of the propositions. If any of the new propositions has the same structure as an already existing proposition, an automatic check for duplicates will return the pre-existing proposition. Multiple propositions may be returned for a single sentence because of normalization of equivalences, conjunctions, etc.

A module name of null or the empty string refers to the current module. If no module can be found with the name moduleName, then a Stella No_Such_Context_Exception is thrown.

Signals a Proposition_Error if PowerLoom could not conceive sentence.

Parameters:
sentence -
moduleName -
environment -
Returns:
PlIterator

getRules

public static PlIterator getRules(LogicObject relation,
                                  Module module,
                                  Environment environment)
Return rules attached to the concept/relation relation in either antecedent or consequent position.

Parameters:
relation -
module -
environment -
Returns:
PlIterator

sGetRules

public static PlIterator sGetRules(java.lang.String relationName,
                                   java.lang.String moduleName,
                                   Environment environment)
Return rules attached to the concept/relation named relationName found in the module named moduleName.

A module name of null or the empty string refers to the current module. If no module can be found with the name moduleName, then a Stella No_Such_Context_Exception is thrown.

Parameters:
relationName -
moduleName -
environment -
Returns:
PlIterator

sPrintRules

public static void sPrintRules(java.lang.String name,
                               OutputStream stream,
                               java.lang.String moduleName,
                               Environment environment)
Print rules attached to the concept/relation named name.

A module name of null or the empty string refers to the current module. If no module can be found with the name moduleName, then a Stella noSuchContextException is thrown.

Parameters:
name -
stream -
moduleName -
environment -

runForwardRules

public static void runForwardRules(Stella_Object module,
                                   boolean forceP)
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.

Calling runForwardRules 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.

Parameters:
module -
forceP -

getArity

public static int getArity(LogicObject relation)
Return the arity of the relation relation.

Parameters:
relation -
Returns:
int

sGetArity

public static int sGetArity(java.lang.String relationName,
                            java.lang.String moduleName,
                            Environment environment)
Return the arity of the relation named relationName.

A module name of null or the empty string refers to the current module. If no module can be found with the name moduleName, then a Stella noSuchContextException is thrown.

Parameters:
relationName -
moduleName -
environment -
Returns:
int

getDomain

public static LogicObject getDomain(LogicObject relation)
Return the type (a concept) for the first argument to the binary relation relation.

Parameters:
relation -
Returns:
LogicObject

sGetDomain

public static LogicObject sGetDomain(java.lang.String relationName,
                                     java.lang.String moduleName,
                                     Environment environment)
Return the type (concept) for the first argument to the binary relation relationName.

A module name of null or the empty string refers to the current module. If no module can be found with the name moduleName, then a Stella noSuchContextException is thrown.

Parameters:
relationName -
moduleName -
environment -
Returns:
LogicObject

getRange

public static LogicObject getRange(LogicObject relation)
Return the type (a concept) for fillers of the binary relation relation.

Parameters:
relation -
Returns:
LogicObject

sGetRange

public static LogicObject sGetRange(java.lang.String relationName,
                                    java.lang.String moduleName,
                                    Environment environment)
Return the type (a concept) for fillers of the binary relation relationName.

A module name of null or the empty string refers to the current module. If no module can be found with the name moduleName, then a Stella noSuchContextException is thrown.

Parameters:
relationName -
moduleName -
environment -
Returns:
LogicObject

getNthDomain

public static LogicObject getNthDomain(LogicObject relation,
                                       int n)
Return the type (a concept) for the the nth argument of the relation relation. Counting starts at zero.

Parameters:
relation -
n -
Returns:
LogicObject

sGetNthDomain

public static LogicObject sGetNthDomain(java.lang.String relationName,
                                        int n,
                                        java.lang.String moduleName,
                                        Environment environment)
Return the type (a concept) for the nth argument of the relation named relationName. Counting starts at zero.

A module name of null or the empty string refers to the current module. If no module can be found with the name moduleName, then a Stella noSuchContextException is thrown.

Parameters:
relationName -
n -
moduleName -
environment -
Returns:
LogicObject

load

public static void load(java.lang.String filename,
                        Environment environment)
Read logic commands from the file named filename and evaluate them. The file should begin with an inModule declaration that specifies the module within which all remaining commands are to be evaluated The remaining commands are evaluated one-by-one, applying the function evaluate to each of them.

Parameters:
filename -
environment -

loadStream

public static void loadStream(InputStream stream,
                              Environment environment)
Read logic commands from the STELLA stream stream and evaluate them. The stream should begin with an inModule declaration that specifies the module within which all remaining commands are to be evaluated The remaining commands are evaluated one-by-one, applying the function evaluate to each of them.

Parameters:
stream -
environment -

loadNativeStream

public static void loadNativeStream(java.io.PushbackInputStream stream,
                                    Environment environment)
Read logic commands from the native input stream stream and evaluate them. Assumes stream is a line-buffered stream which is a safe compromise but does not generate the best efficiency for block-buffered streams such as files. The stream should begin with an inModule declaration that specifies the module within which all remaining commands are to be evaluated The remaining commands are evaluated one-by-one, applying the function evaluate to each of them.

Parameters:
stream -
environment -

saveModule

public static void saveModule(Module module,
                              java.lang.String filename,
                              java.lang.String ifexists,
                              Environment environment)
Save the contents of the module mod into a file named filename. If a file named filename already exists, then the action taken depends on the value of ifexists. Possible values are "ASK", "REPLACE", "WARN" and "ERROR":

REPLACE => Means overwrite without warning. WARN => Means overwrite with a warning. ERROR => Means don't overwrite, signal an error instead. ASK => Ask the user whether to overwrite or not. If not overwritten, an exception is thrown.

Parameters:
module -
filename -
ifexists -
environment -

sSaveModule

public static void sSaveModule(java.lang.String moduleName,
                               java.lang.String filename,
                               java.lang.String ifexists,
                               Environment environment)
Save the contents of the module moduleName into a file named filename. If a file named filename already exists, then the action taken depends on the value of ifexists. Possible values are "ASK", "REPLACE", "WARN" and "ERROR":

REPLACE => Means overwrite without warning. WARN => Means overwrite with a warning. ERROR => Means don't overwrite, signal an error instead. ASK => Ask the user whether to overwrite or not. If not overwritten, an exception is thrown.

A module name of null or the empty string refers to the current module. If no module can be found with the name moduleName, then a Stella noSuchContextException is thrown.

Parameters:
moduleName -
filename -
ifexists -
environment -

getPredicate

public static LogicObject getPredicate(Proposition prop)
Return the concept or relation predicate for the proposition prop.

Parameters:
prop -
Returns:
LogicObject

getColumnCount

public static int getColumnCount(Stella_Object obj)
Return the number of columns in obj, which must be of type proposition, cons, vector or PL-iterator. For a proposition, the number includes both the predidate and arguments. For the PL-iterator case,the number of columns is for the current value of the iterator.

For non sequence objects, the column count is zero.

Parameters:
obj -
Returns:
int

getNthValue

public static Stella_Object getNthValue(Stella_Object sequence,
                                        int n,
                                        Module module,
                                        Environment environment)
Return the value in the nth column of sequence. Counting starts at zero. Unless n is zero, sequence must be of type proposition, cons, vector or PL-iterator. A zero column number returns a proposition's relational predicate. For the PL-iterator case, the number of columns is for the current value of the iterator.

As a special case, a column number of zero will also return sequence itself if it is not one of the types enumerated above. This is done to allow the use of getNthValue on PL-iterators with only a single return variable.

Parameters:
sequence -
n -
module -
environment -
Returns:
Stella_Object

getNthString

public static java.lang.String getNthString(Stella_Object sequence,
                                            int n,
                                            Module module,
                                            Environment environment)
Return a string representation of the value in the nth column of sequence. Counting starts at zero. Unless n is zero, sequence must be of type proposition, cons, vector or PL-iterator. A zero column number returns a proposition's relational predicate. For the PL-iterator case, the the current value pointed to by the iterator is used. This will always succeed, even if the nth value is not a string object. In that case, a string reprensentation will be returned.

As a special case, a column number of zero will also return sequence itself as a string if it is not one of the types enumerated above. This is done to allow the use of getNthString on PL-iterators with only a single return variable.

Parameters:
sequence -
n -
module -
environment -
Returns:
String

getNthInteger

public static int getNthInteger(Stella_Object sequence,
                                int n,
                                Module module,
                                Environment environment)
Return an integer representation of the value in the nth column of sequence. Counting starts at zero. Unless n is zero, sequence must be of type proposition, cons, vector or PL-iterator. A zero column number returns a proposition's relational predicate. For the PL-iterator case, the the current value pointed to by the iterator is used. If this is not an integer value, then an exception will be thrown.

As a special case, a column number of zero will also return the integer value of sequence itself if it is not one of the types enumerated above. This allows the use of getNthInteger on PL-iterators with only a single return variable. If sequence cannot be turned into an integer, an exception will be thrown.

Parameters:
sequence -
n -
module -
environment -
Returns:
int

getNthFloat

public static double getNthFloat(Stella_Object sequence,
                                 int n,
                                 Module module,
                                 Environment environment)
Return the floating point value in the nth column of sequence. Counting starts at zero. sequence must be of type proposition, cons, vector or PL-iterator. A zero column number returns a proposition's relational predicate. For the PL-iterator case, the the current value pointed to by the iterator is used. If this is not a floating point value, then an exception will be thrown.

As a special case, a column number of zero will also return the floating point value of sequence itself if it is not one of the types enumerated above. This allows the use of getNthFloat on PL-iterators with only a single return variable. If sequence cannot be turned into a floating point value, an exception will be thrown.

Parameters:
sequence -
n -
module -
environment -
Returns:
double

getNthLogicObject

public static LogicObject getNthLogicObject(Stella_Object sequence,
                                            int n,
                                            Module module,
                                            Environment environment)
Return a logic object representation of the value in the nth column of sequence. Counting starts at zero. Unless n is zero, sequence must be of type proposition, cons, vector or PL-iterator. A zero column number returns a proposition's relational predicate. For the PL-iterator case, the the current value pointed to by the iterator is used. A zero column number returns the proposition's relational predicate. If the return value is not a LOGIC-OBJECT, an exception is thrown.

As a special case, a column number of zero will also return sequence itself if it is not one of the types enumerated above. This is done to allow the use of getNthValue on PL-iterators with only a single return variable. If sequence is not a LOGIC-OBJECT, an exception is thrown.

Parameters:
sequence -
n -
module -
environment -
Returns:
LogicObject

getEnumeratedCollectionMembers

public static Cons getEnumeratedCollectionMembers(Stella_Object collection,
                                                  Module module,
                                                  Environment environment)
Returns the members of an enumerated collection. This works on all types of collection, i.e., sets and lists

Parameters:
collection -
module -
environment -
Returns:
Cons

evaluate

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

Parameters:
command -
module -
environment -
Returns:
Stella_Object

sEvaluate

public static Stella_Object sEvaluate(java.lang.String command,
                                      java.lang.String moduleName,
                                      Environment environment)
Evaluate the command represented by the string command within module and return the result. Currently, only the evaluation of (possibly nested) commands and global variables is supported.

A module name of null or the empty string refers to the current module. If no module can be found with the name moduleName, then a Stella noSuchContextException is thrown.

Parameters:
command -
moduleName -
environment -
Returns:
Stella_Object

isLogicObject

public static boolean isLogicObject(Stella_Object obj)
Test whether obj is of type LOGIC-OBJECT

Parameters:
obj -
Returns:
boolean

isInteger

public static boolean isInteger(Stella_Object obj)
Test whether obj is of type INTEGER

Parameters:
obj -
Returns:
boolean

isFloat

public static boolean isFloat(Stella_Object obj)
Test whether obj is of type FLOAT (double)

Parameters:
obj -
Returns:
boolean

isNumber

public static boolean isNumber(Stella_Object obj)
Test whether obj is of type NUMBER. This can be either an integer or a floating point number. One key characteristic is that 'object-to-integer' and objectToFloat will both work on it.

Parameters:
obj -
Returns:
boolean

isString

public static boolean isString(Stella_Object obj)
Test whether obj is of type STRING

Parameters:
obj -
Returns:
boolean

isEnumeratedCollection

public static boolean isEnumeratedCollection(Stella_Object obj)
Test whether obj is an enumerated collection. This subsumes both sets and lists.

Parameters:
obj -
Returns:
boolean

isEnumeratedSet

public static boolean isEnumeratedSet(Stella_Object obj)
Test whether obj is an enumerated set.

Parameters:
obj -
Returns:
boolean

isEnumeratedList

public static boolean isEnumeratedList(Stella_Object obj)
Test whether obj is an enumerated list

Parameters:
obj -
Returns:
boolean

isTrue

public static boolean isTrue(TruthValue tv)
Tests whether tv is a true truth value. It can be true either absolutely or by default.

Parameters:
tv -
Returns:
boolean

isFalse

public static boolean isFalse(TruthValue tv)
Tests whether tv is a false truth value. It can be false either absolutely or by default.

Parameters:
tv -
Returns:
boolean

isUnknown

public static boolean isUnknown(TruthValue tv)
Tests whether tv is an unknown truth value.

Parameters:
tv -
Returns:
boolean

isInconsistent

public static boolean isInconsistent(TruthValue tv)
Tests whether tv is an inconsistent truth value.

Parameters:
tv -
Returns:
boolean

isStrict

public static boolean isStrict(TruthValue tv)
Tests whether tv is a strict (non-default) truth value.

Parameters:
tv -
Returns:
boolean

isDefault

public static boolean isDefault(TruthValue tv)
Tests whether tv is a default truth value.

Parameters:
tv -
Returns:
boolean

ask

public static TruthValue ask(Cons query,
                             Module module,
                             Environment environment)
Returns a truth value for query in module and environment. query has the same syntax as the PowerLoom ask command (which see) but with the ask operator omitted. For example, here are some legal query arguments: ((happy Fred)) ((happy Fred) :inference-level :assertion) ((happy Fred) :inference-level :assertion :timeout 1.0) As a convenience, a query argument whose first element is a symbol is interpreted as a sentence that is queried without any options. For example: (happy Fred) is a legal query argument. Note that for a setence whose relation is a list itself, e.g., __FruitFn_BananaTree__MyBanana_ this shortcut is not available, that is, in that case an extra level of list nesting is always necessary. The returned truth value represents the logical truth of the queried sentence as determined by PowerLoom. It can be be tested via the functions isTrue, isFalse and isUnknown (which see).

Parameters:
query -
module -
environment -
Returns:
TruthValue

sAsk

public static TruthValue sAsk(java.lang.String query,
                              java.lang.String moduleName,
                              Environment environment)
Returns a truth value for query in module moduleName and environment. query has the same syntax as the PowerLoom ask command (which see) but with the ask operator omitted. Different from the PLI ask function, sAsk does not expect a top-level pair of parentheses. For example, here are some legal query arguments: "(happy Fred)" "(happy Fred) :inference-level :assertion" "(happy Fred) :inference-level :assertion :timeout 1.0" Names in query will be interpreted relative to module moduleName. A null moduleName or the empty string refers to the current module. If no module can be found with the name moduleName, then a STELLA noSuchContextException is thrown. The returned truth value represents the logical truth of the queried sentence as determined by PowerLoom. It can be be tested via the functions isTrue, isFalse and isUnknown (which see).

Parameters:
query -
moduleName -
environment -
Returns:
TruthValue

retrieve

public static PlIterator retrieve(Cons query,
                                  Module module,
                                  Environment environment)
Returns an iterator of variable bindings that when substituted for the open variables in query satisfy the query proposition. The query is run in module and relative to environment. query has the same syntax as the PowerLoom retrieve command (which see) but with the retrieve operator omitted. For example, here are some legal query arguments: ((happy ?x)) (10 (happy ?x)) (all (happy ?x)) (all ?x (happy ?x)) (10 (happy ?x) :inference-level :assertion) (10 (happy ?x) :inference-level :assertion :timeout 1.0) If there is only a single output variable (as in all the examples above) each element generated by the returned iterator will be a binding for that variable - unless, the output variable was declared with a surrounding pair of parentheses. For example: (all (?x) (happy ?x)) In that case, the generated elements will be one-element lists. If there are multiple output variables, each element generated by the returned iterator will be a list of variable bindings that can be accessed using the various getNthDDD functions. The list of output variables does not need to be declared in which case they are taken to be the open variables in the query proposition in the order in which they were encountered. If order does matter or should be different from its default, it can be forced by declaring the set of output variables.

Parameters:
query -
module -
environment -
Returns:
PlIterator

sRetrieve

public static PlIterator sRetrieve(java.lang.String query,
                                   java.lang.String moduleName,
                                   Environment environment)
Returns an iterator of variable bindings that when substituted for the open variables in query satisfy the query proposition. The query is run in module and relative to environment. query has the same syntax as the PowerLoom retrieve command (which see) but with the retrieve operator omitted. Different from the PLI retrieve function, sRetrieve does not expect a top-level pair of parentheses. For example, here are some legal query arguments: "(happy ?x)" "10 (happy ?x)" "all (happy ?x)" "all ?x (happy ?x)" "10 (happy ?x) :inference-level :assertion" "10 (happy ?x) :inference-level :assertion :timeout 1.0" If there is only a single output variable (as in all the examples above) each element generated by the returned iterator will be a binding for that variable - unless, the output variable was declared with a surrounding pair of parentheses. For example: "all (?x) (happy ?x)" In that case, the generated elements will be one-element lists. If there are multiple output variables, each element generated by the returned iterator will be a list of variable bindings that can be accessed using the various getNthDDD functions. The list of output variables does not need to be declared in which case they are taken to be the open variables in the query proposition in the order in which they were encountered. If order does matter or should be different from its default, it can be forced by declaring the set of output variables.

Names in query will be interpreted relative to module moduleName. A null moduleName or the empty string refers to the current module. If no module can be found with the name moduleName, then a STELLA noSuchContextException is thrown.

Parameters:
query -
moduleName -
environment -
Returns:
PlIterator

main

public static void main(java.lang.String[] argv058)
Main PowerLoom entry point for your code in C++ and Java.

Parameters:
argv058 -