|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object edu.isi.powerloom.PLI
public class PLI
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 |
---|
public static boolean $POWERLOOM_INITIALIZEDp$
public static Surrogate SGT_PLI_ENVIRONMENT
public static Symbol SYM_STELLA_LEVEL
public static Environment ASSERTION_ENV
public static Environment TAXONOMIC_ENV
public static Environment INFERENCE_ENV
public static Surrogate SGT_PLI_PL_ITERATOR
public static Symbol SYM_PLI_pR
public static Symbol SYM_PLI_pI
public static Symbol SYM_PLI_pV
public static Symbol SYM_PLI_F_GET_INFERRED_BINARY_PROPOSITION_VALUES_QUERY_000
public static Symbol SYM_PLI_PROPER_SUBRELATION
public static Keyword KWD_CASE_SENSITIVEp
public static Keyword KWD_SUBSET_OF
public static Symbol SYM_PLI_STARTUP_PLI
Constructor Detail |
---|
public PLI()
Method Detail |
---|
public static void initialize()
public static void resetPowerloom()
public static void clearCaches()
public static Keyword getKeyword(java.lang.String name)
name
if it exists. Case sensitive.
name
-
public static Symbol getSymbol(java.lang.String name, Module module, Environment environment)
name
visible in module
if it
exists. name
is ALWAYS treated case sensitively.
name
- module
- environment
-
public static Symbol getOperator(java.lang.String name)
name
.
If no such operator exists then a noSuchObject
exception is thrown.
name
-
public static Stella_Object getObject(java.lang.String name, Module module, Environment environment)
name
that is local to
or visible from the module module
.
name
- module
- environment
-
public static Stella_Object sGetObject(java.lang.String name, java.lang.String moduleName, Environment environment)
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.
name
- moduleName
- environment
-
public static LogicObject getConcept(java.lang.String name, Module module, Environment environment)
name
that is local to
or visible from the module module
.
name
- module
- environment
-
public static LogicObject sGetConcept(java.lang.String name, java.lang.String moduleName, Environment environment)
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.
name
- moduleName
- environment
-
public static LogicObject getRelation(java.lang.String name, Module module, Environment environment)
name
that is local to
or visible from the module module
.
name
- module
- environment
-
public static LogicObject sGetRelation(java.lang.String name, java.lang.String moduleName, Environment environment)
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.
name
- moduleName
- environment
-
public static java.lang.String getNameInModule(Stella_Object obj, Module module, Environment environment)
obj
can be found from
module
. If there is no name for the object return null
.
obj
- module
- environment
-
public static java.lang.String getName(Stella_Object obj)
obj
, if it has one. Otherwise return null
.
obj
-
public static java.lang.String getShortName(Stella_Object obj)
obj
, if it has one. Otherwise return null
.
obj
-
public static java.lang.String objectToString(Stella_Object self)
self
as a string.
self
-
public static int objectToInteger(Stella_Object self)
self
to an integer, or throw a Stella Exception if the coersion is not feasible.
Floating point values will be coerced by rounding.
self
-
public static double objectToFloat(Stella_Object self)
self
to a float, or throw a Stella Exception if the coersion is not feasible.
self
-
public static java.lang.String objectToParsableString(Stella_Object self)
self
. Like objectToString
, but puts
escaped double quotes around strings.
self
-
public static Stella_Object stringToObject(java.lang.String string, LogicObject type, Module module, Environment environment)
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.
string
- type
- module
- environment
-
public static Proposition getProposition(Stella_Object relationAndArguments, Module module, Environment environment)
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.
relationAndArguments
- module
- environment
-
public static Proposition sGetProposition(java.lang.String relationAndArguments, java.lang.String moduleName, Environment environment)
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.
relationAndArguments
- moduleName
- environment
-
public static PlIterator getPropositions(Stella_Object relationAndArguments, Module module, Environment environment)
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.
relationAndArguments
- module
- environment
-
public static PlIterator sGetPropositions(java.lang.String relationAndArguments, java.lang.String moduleName, Environment environment)
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.
relationAndArguments
- moduleName
- environment
-
public static Proposition getBinaryProposition(LogicObject relation, Stella_Object arg1, Stella_Object arg2, Module module, Environment environment)
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.
relation
- arg1
- arg2
- module
- environment
-
public static PlIterator getBinaryPropositions(LogicObject relation, Stella_Object arg1, Stella_Object arg2, Module module, Environment environment)
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.
relation
- arg1
- arg2
- module
- environment
-
public static PlIterator getInferredBinaryPropositionValues(LogicObject relation, Stella_Object arg, Module module, Environment environment)
v
such that (relation
arg
v
)
has been asserted or can be inferred.
relation
- arg
- module
- environment
-
public static PlIterator sGetInferredBinaryPropositionValues(java.lang.String relationName, java.lang.String argName, java.lang.String moduleName, Environment environment)
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.
relationName
- argName
- moduleName
- environment
-
public static PlIterator getPropositionsOf(LogicObject renamed_Object, Module module, Environment environment)
renamed_Object
among their arguments,
and that are TRUE in the scope of the module module
.
renamed_Object
- module
- environment
-
public static PlIterator sGetPropositionsOf(java.lang.String objectName, java.lang.String moduleName, Environment environment)
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.
objectName
- moduleName
- environment
-
public static PlIterator getPropositionsInModule(Module module, Environment environment)
module
.
module
- environment
-
public static boolean isTrueUnaryProposition(LogicObject relation, Stella_Object arg, Module module, Environment environment)
relation
arg
) has
been asserted (or inferred by forward chaining).
relation
- arg
- module
- environment
-
public static boolean isTrueBinaryProposition(LogicObject relation, Stella_Object arg, Stella_Object value, Module module, Environment environment)
relation
arg
value
) has
been asserted (or inferred by forward chaining).
relation
- arg
- value
- module
- environment
-
public static boolean isTrueProposition1(Stella_Object relationAndArguments, Module module, Environment environment)
relation
args
) has
been asserted (or inferred by forward chaining).
relationAndArguments
- module
- environment
-
public static boolean isTrueProposition(Proposition proposition, Module module, Environment environment)
proposition
is TRUE in the module module
.
proposition
- module
- environment
-
public static boolean sIsTrueProposition(java.lang.String relationAndArguments, java.lang.String moduleName, Environment environment)
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.
relationAndArguments
- moduleName
- environment
-
public static boolean isSubrelation(LogicObject sub, LogicObject renamed_Super, Module module, Environment environment)
sub
is a subconcept/subrelation of renamed_Super
.
sub
- renamed_Super
- module
- environment
-
public static PlIterator getProperSubrelations(LogicObject relation, Module module, Environment environment)
relation
.
Non-reflexive.
relation
- module
- environment
-
public static PlIterator getDirectSubrelations(LogicObject relation, Module module, Environment environment)
relation
.
Non-reflexive.
relation
- module
- environment
-
public static PlIterator getProperSuperrelations(LogicObject relation, Module module, Environment environment)
relation
.
Non-reflexive.
relation
- module
- environment
-
public static PlIterator getDirectSuperrelations(LogicObject relation, Module module, Environment environment)
relation
.
Non-reflexive.
relation
- module
- environment
-
public static boolean isA(Stella_Object renamed_Object, LogicObject concept, Module module, Environment environment)
renamed_Object
is a member of the concept concept
.
renamed_Object
- concept
- module
- environment
-
public static PlIterator getConceptInstances(LogicObject concept, Module module, Environment environment)
concept
.
Include instances of subconcepts of concept
. Depending on concept
,
the return values could be (wrapped) literals.
concept
- module
- environment
-
public static PlIterator sGetConceptInstances(java.lang.String conceptName, java.lang.String moduleName, Environment environment)
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.
conceptName
- moduleName
- environment
-
public static PlIterator getDirectConceptInstances(LogicObject concept, Module module, Environment environment)
concept
.
Exclude instances of subconcepts of concept
. Depending on concept
,
the return values could be (wrapped) literals.
concept
- module
- environment
-
public static PlIterator sGetDirectConceptInstances(java.lang.String conceptName, java.lang.String moduleName, Environment environment)
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.
conceptName
- moduleName
- environment
-
public static PlIterator getConceptInstancesMatchingValue(LogicObject concept, LogicObject relation, Stella_Object value, Module module, Environment environment)
concept
that
have an attribute matching value
for the binary relation relation
, i.e.,
_relationLresultGValue_
holds.
concept
- relation
- value
- module
- environment
-
public static Stella_Object getConceptInstanceMatchingValue(LogicObject concept, LogicObject relation, Stella_Object value, Module module, Environment environment)
concept
that
has an attribute matching value
for the binary relation relation
, i.e.,
_relationLresultGValue_
holds.
concept
- relation
- value
- module
- environment
-
public static PlIterator getTypes(LogicObject renamed_Object, Module module, Environment environment)
renamed_Object
belongs to.
renamed_Object
- module
- environment
-
public static PlIterator getDirectTypes(LogicObject renamed_Object, Module module, Environment environment)
renamed_Object
belongs to.
renamed_Object
- module
- environment
-
public static PlIterator getRelationExtension(LogicObject relation, Module module, Environment environment)
relation
.
Include propositions that satisfy subrelations of relation
.
relation
- module
- environment
-
public static PlIterator sGetRelationExtension(java.lang.String relationName, Module module, Environment environment)
relationName
. Include propositions that satisfy subrelations of the relation.
relationName
- module
- environment
-
public static Module getModule(java.lang.String name, Environment environment)
name
.
name
- environment
-
public static Module getHomeModule(LogicObject renamed_Object)
renamed_Object
was created.
renamed_Object
-
public static PlIterator getModules(boolean kbModulesOnlyP)
kbModulesOnlyP
is true
, then Stella modules that are used only for program code are
not included in the list.
kbModulesOnlyP
-
public static Module createModule(java.lang.String name, Module parent, boolean caseSensitiveP)
name
as a child of parent
. The flag
caseSensitiveP
controls whether names read in this module will be
case sensitive or not.
name
- parent
- caseSensitiveP
-
public static Module sCreateModule(java.lang.String name, java.lang.String parentName, boolean caseSensitiveP, Environment environment)
name
as a child of parentName
. The flag
caseSensitiveP
controls whether names read in this module will be
case sensitive or not.
name
- parentName
- caseSensitiveP
- environment
-
public static Module changeModule(Module module)
module
and return it.
If module
is null
, then no switch is performed and the current
module is returned.
module
-
public static Module sChangeModule(java.lang.String name, Environment environment)
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.
name
- environment
-
public static Module clearModule(Module module)
module
as well as
the contents of all of its children, recursively.
module
-
public static Module sClearModule(java.lang.String name, Environment environment)
name
, as
well as the contents of all of its children, recursively. If no module
named name
exists, a Stella noSuchContextException
is thrown.
name
- environment
-
public static PlIterator getChildModules(Module module)
module
.
module
-
public static PlIterator sGetChildModules(java.lang.String name, Environment environment)
name
.
If no module named name
exists, a Stella noSuchContextException
is thrown.
name
- environment
-
public static PlIterator getParentModules(Module module)
module
.
module
-
public static PlIterator sGetParentModules(java.lang.String name, Environment environment)
name
.
If no module named name
exists, a Stella noSuchContextException
is thrown.
name
- environment
-
public static java.lang.String generateUniqueName(java.lang.String prefix, Module module, Environment environment)
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!)
prefix
- module
- environment
-
public static Keyword createKeyword(java.lang.String name)
name
, creating it if
necessary. name
is treated case-sensitively. This should
generally not be necessary to do.
name
-
public static Symbol createSymbol(java.lang.String name, Module module, Environment environment)
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.
name
- module
- environment
-
public static LogicObject createObject(java.lang.String name, LogicObject concept, Module module, Environment environment)
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.
name
- concept
- module
- environment
-
public static LogicObject sCreateObject(java.lang.String name, java.lang.String conceptName, java.lang.String moduleName, Environment environment)
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.
name
- conceptName
- moduleName
- environment
-
public static LogicObject createConcept(java.lang.String name, LogicObject parent, Module module, Environment environment)
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.
name
- parent
- module
- environment
-
public static LogicObject sCreateConcept(java.lang.String name, java.lang.String parentName, java.lang.String moduleName, Environment environment)
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.
name
- parentName
- moduleName
- environment
-
public static LogicObject createRelation(java.lang.String name, int arity, Module module, Environment environment)
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.
name
- arity
- module
- environment
-
public static LogicObject sCreateRelation(java.lang.String name, int arity, java.lang.String moduleName, Environment environment)
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.
name
- arity
- moduleName
- environment
-
public static LogicObject createFunction(java.lang.String name, int arity, Module module, Environment environment)
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.
name
- arity
- module
- environment
-
public static LogicObject sCreateFunction(java.lang.String name, int arity, java.lang.String moduleName, Environment environment)
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.
name
- arity
- moduleName
- environment
-
public static void registerSpecialistFunction(java.lang.String name, java.lang.reflect.Method functionReference, Module module, Environment environment)
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
name
- functionReference
- module
- environment
- public static void sRegisterSpecialistFunction(java.lang.String name, java.lang.String nativeName, java.lang.String moduleName, Environment environment)
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.
name
- nativeName
- moduleName
- environment
- public static LogicObject createEnumeratedList(Cons members, Module module, Environment environment)
members
in
module
using environment
. Useful for passing lists as arguments
to parameterized queries.
members
- module
- environment
-
public static LogicObject createEnumeratedSet(Cons members, Module module, Environment environment)
members
in module
using environment
.
members
- module
- environment
-
public static void destroyObject(LogicObject renamed_Object)
renamed_Object
, retracting all facts attached to it.
renamed_Object
- public static void sDestroyObject(java.lang.String objectName, java.lang.String moduleName, Environment environment)
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.
objectName
- moduleName
- environment
- public static Proposition assertUnaryProposition(LogicObject relation, Stella_Object arg, Module module, Environment environment)
relation
arg
) is TRUE in module
. Return the asserted proposition.
relation
- arg
- module
- environment
-
public static Proposition assertBinaryProposition(LogicObject relation, Stella_Object arg, Stella_Object value, Module module, Environment environment)
relation
arg
value
) is TRUE
in module
. Return the asserted proposition.
relation
- arg
- value
- module
- environment
-
public static Proposition assertNaryProposition(Stella_Object relationAndArguments, Module module, Environment environment)
RelationAndArguments
satisfies
the relation relation
.
relationAndArguments
- module
- environment
-
public static Proposition retractUnaryProposition(LogicObject relation, Stella_Object arg, Module module, Environment environment)
relation
arg
) is TRUE in module
. Return the asserted proposition.
relation
- arg
- module
- environment
-
public static Proposition retractBinaryProposition(LogicObject relation, Stella_Object arg, Stella_Object value, Module module, Environment environment)
relation
arg
value
) is TRUE
in module
. Return the asserted proposition.
relation
- arg
- value
- module
- environment
-
public static Proposition retractNaryProposition(Stella_Object relationAndArguments, Module module, Environment environment)
arguments
satisfies
the relation relation
.
relationAndArguments
- module
- environment
-
public static Proposition assertProposition(Proposition proposition, Module module, Environment environment)
proposition
is true in module
.
Return the asserted proposition.
proposition
- module
- environment
-
public static PlIterator sAssertProposition(java.lang.String sentence, java.lang.String moduleName, Environment environment)
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.
sentence
- moduleName
- environment
-
public static Proposition retractProposition(Proposition proposition, Module module, Environment environment)
proposition
in module
.
Return the retracted proposition.
proposition
- module
- environment
-
public static PlIterator sRetractProposition(java.lang.String sentence, java.lang.String moduleName, Environment environment)
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.
sentence
- moduleName
- environment
-
public static PlIterator conceive(Stella_Object sentence, Module module, Environment environment)
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
.
sentence
- module
- environment
-
public static PlIterator sConceive(java.lang.String sentence, java.lang.String moduleName, Environment environment)
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
.
sentence
- moduleName
- environment
-
public static PlIterator getRules(LogicObject relation, Module module, Environment environment)
relation
in either antecedent or consequent position.
relation
- module
- environment
-
public static PlIterator sGetRules(java.lang.String relationName, java.lang.String moduleName, Environment environment)
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.
relationName
- moduleName
- environment
-
public static void sPrintRules(java.lang.String name, OutputStream stream, java.lang.String moduleName, Environment environment)
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.
name
- stream
- moduleName
- environment
- public static void runForwardRules(Stella_Object module, boolean forceP)
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.
module
- forceP
- public static int getArity(LogicObject relation)
relation
.
relation
-
public static int sGetArity(java.lang.String relationName, java.lang.String moduleName, Environment environment)
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.
relationName
- moduleName
- environment
-
public static LogicObject getDomain(LogicObject relation)
relation
.
relation
-
public static LogicObject sGetDomain(java.lang.String relationName, java.lang.String moduleName, Environment environment)
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.
relationName
- moduleName
- environment
-
public static LogicObject getRange(LogicObject relation)
relation
.
relation
-
public static LogicObject sGetRange(java.lang.String relationName, java.lang.String moduleName, Environment environment)
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.
relationName
- moduleName
- environment
-
public static LogicObject getNthDomain(LogicObject relation, int n)
relation
. Counting starts at zero.
relation
- n
-
public static LogicObject sGetNthDomain(java.lang.String relationName, int n, java.lang.String moduleName, Environment environment)
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.
relationName
- n
- moduleName
- environment
-
public static void load(java.lang.String filename, Environment environment)
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.
filename
- environment
- public static void loadStream(InputStream stream, Environment environment)
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.
stream
- environment
- public static void loadNativeStream(java.io.PushbackInputStream stream, Environment environment)
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.
stream
- environment
- public static void saveModule(Module module, java.lang.String filename, java.lang.String ifexists, Environment environment)
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.
module
- filename
- ifexists
- environment
- public static void sSaveModule(java.lang.String moduleName, java.lang.String filename, java.lang.String ifexists, Environment environment)
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.
moduleName
- filename
- ifexists
- environment
- public static LogicObject getPredicate(Proposition prop)
prop
.
prop
-
public static int getColumnCount(Stella_Object obj)
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.
obj
-
public static Stella_Object getNthValue(Stella_Object sequence, int n, Module module, Environment environment)
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.
sequence
- n
- module
- environment
-
public static java.lang.String getNthString(Stella_Object sequence, int n, Module module, Environment environment)
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.
sequence
- n
- module
- environment
-
public static int getNthInteger(Stella_Object sequence, int n, Module module, Environment environment)
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.
sequence
- n
- module
- environment
-
public static double getNthFloat(Stella_Object sequence, int n, Module module, Environment environment)
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.
sequence
- n
- module
- environment
-
public static LogicObject getNthLogicObject(Stella_Object sequence, int n, Module module, Environment environment)
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.
sequence
- n
- module
- environment
-
public static Cons getEnumeratedCollectionMembers(Stella_Object collection, Module module, Environment environment)
collection
- module
- environment
-
public static Stella_Object evaluate(Stella_Object command, Module module, Environment environment)
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
.
command
- module
- environment
-
public static Stella_Object sEvaluate(java.lang.String command, java.lang.String moduleName, Environment environment)
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.
command
- moduleName
- environment
-
public static boolean isLogicObject(Stella_Object obj)
obj
is of type LOGIC-OBJECT
obj
-
public static boolean isInteger(Stella_Object obj)
obj
is of type INTEGER
obj
-
public static boolean isFloat(Stella_Object obj)
obj
is of type FLOAT (double)
obj
-
public static boolean isNumber(Stella_Object obj)
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.
obj
-
public static boolean isString(Stella_Object obj)
obj
is of type STRING
obj
-
public static boolean isEnumeratedCollection(Stella_Object obj)
obj
is an enumerated collection. This
subsumes both sets and lists.
obj
-
public static boolean isEnumeratedSet(Stella_Object obj)
obj
is an enumerated set.
obj
-
public static boolean isEnumeratedList(Stella_Object obj)
obj
is an enumerated list
obj
-
public static boolean isTrue(TruthValue tv)
tv
is a true truth value. It can be true
either absolutely or by default.
tv
-
public static boolean isFalse(TruthValue tv)
tv
is a false truth value. It can be false
either absolutely or by default.
tv
-
public static boolean isUnknown(TruthValue tv)
tv
is an unknown truth value.
tv
-
public static boolean isInconsistent(TruthValue tv)
tv
is an inconsistent truth value.
tv
-
public static boolean isStrict(TruthValue tv)
tv
is a strict (non-default) truth value.
tv
-
public static boolean isDefault(TruthValue tv)
tv
is a default truth value.
tv
-
public static TruthValue ask(Cons query, Module module, Environment environment)
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).
query
- module
- environment
-
public static TruthValue sAsk(java.lang.String query, java.lang.String moduleName, Environment environment)
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).
query
- moduleName
- environment
-
public static PlIterator retrieve(Cons query, Module module, Environment environment)
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.
query
- module
- environment
-
public static PlIterator sRetrieve(java.lang.String query, java.lang.String moduleName, Environment environment)
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.
query
- moduleName
- environment
-
public static void main(java.lang.String[] argv058)
argv058
-
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |