|
ABLE 2.0.0 07/02/2003 10:25:01 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.ibm.able.data.AblePredicate
This class represents a single predicate-logic predicate with a name, and zero or more arguments which could be Strings, Literals, Variables or other predicates. AblePredicates are processed by the AblePredicateEngine and are used in AblePredicateRules and AblePredicateFacts.
Field Summary | |
---|---|
protected java.util.Vector |
argList
The list of arguments which could be Strings, Literals, Variables, or Predicates |
protected int |
arity
|
static java.lang.String |
AssertAPredicate
The name of a special predicate denoting a "asserta" predicate. |
static java.lang.String |
AssertPredicate
The name of a special predicate denoting a "assert" predicate. |
static java.lang.String |
AssertZPredicate
The name of a special predicate denoting a "assertz" predicate. |
static java.lang.String |
AtomCharsPredicate
The name of a special predicate denoting a "atom_charts" predicate. |
static java.lang.String |
AtomConcatPredicate
The name of a special predicate denoting a "atom_concat" predicate. |
static java.lang.String |
AtomLengthPredicate
The name of a special predicate denoting a "atom_length" predicate. |
static java.lang.String |
AtomNumberPredicate
The name of a special predicate denoting a "atom_number" predicate. |
static java.lang.String |
CallPredicate
The name of a special predicate denoting a "call" predicate. |
static java.lang.String |
ConsultPredicate
The name of a special predicate denoting a "consult" predicate. |
static java.lang.String |
CutPredicate
The name of a special predicate denoting a "cut" predicate. |
static java.lang.String |
DontCareSymbol
The "don't care" symbol for use in predicate clauses. |
static AbleEmptyListPredicate |
EmptyListPredicate
A special predicate that is the empty "list" predicate: .(). |
static java.lang.String |
FailPredicate
The name of a special predicate denoting a "fail" predicate. |
static java.lang.String |
FunctorPredicate
The name of a special predicate denoting a "functor" predicate. |
static java.lang.String |
IsListPredicate
The name of a special predicate denoting a "isList" predicate. |
static java.lang.String |
ListPredicate
The name of a special predicate denoting a "list" predicate. |
static java.lang.String |
MemberPredicate
The name of a special predicate denoting a "member" predicate. |
protected AbleLogger |
myTracer
|
protected java.lang.String |
name
|
static java.lang.String |
NonVarPredicate
The name of a special predicate denoting a "nonvar" predicate. |
static java.lang.String |
NotPredicate
The name of a special predicate denoting a "not" predicate. |
protected java.util.Hashtable |
replacementVars
This hashtable is used when duplicating a predicate fact or rule during inferencing. |
static java.lang.String |
RetractAllPredicate
The name of a special predicate denoting a "retractall" predicate. |
static java.lang.String |
RetractPredicate
The name of a special predicate denoting a "retract" predicate. |
static java.lang.String |
SubAtomPredicate
The name of a special predicate denoting a "sub_atom" predicate. |
static java.lang.String |
UnifyPredicate
The name of a special predicate denoting a "unify" predicate. |
static java.lang.String |
UnivPredicate
The name of a special predicate denoting a "univ" predicate. |
protected java.util.Vector |
variables
variables is a list of all of the AbleVariable objects that appear in this predicate (and embedded arguments). |
static java.lang.String |
VarPredicate
The name of a special predicate denoting a "var" predicate. |
Constructor Summary | |
---|---|
AblePredicate()
|
|
AblePredicate(AblePredicate thePredicate)
Construct a copy of the predicate with all local variables duplicated with same name and value. |
|
AblePredicate(java.lang.Object head,
AblePredicate tail)
Construct a standard list predicate with a head and a predicate list as the tail |
|
AblePredicate(java.lang.String name)
Create an AblePredicate object with specified name |
|
AblePredicate(java.lang.String name,
java.util.Vector argList)
Create an AblePredicate object with name and arguments. |
|
AblePredicate(java.util.Vector argList)
Create an AblePredicate list object with name "." and arguments. |
Method Summary | |
---|---|
java.lang.String |
arlString()
Return a formal rule language string that describes this clause. |
void |
clearBindings()
Sets all variables in this predicate to null values |
void |
clearBindings(java.util.Vector unboundVars)
Sets selected variables to null |
AblePredicate |
createMatchPredicate(java.util.Hashtable replacementVars)
Create a copy of this predicate with unbound copies of any variables This copy is used in the match() method in AblePredicateEngine |
boolean |
equals(java.lang.Object otherObj)
|
protected void |
findAllVariables()
Find all contained variables and initialize the variables member |
java.lang.Object |
getArgument(int index)
Get an argument from the predicate at specified index |
java.util.Vector |
getArguments()
Get the list of arguments in this predicate |
int |
getArity()
Get the predicate arity (number of arguments) |
java.util.Vector |
getBoundVariables()
Returns all bound variables in this and any contained predicates Note: this list should not contain duplicates |
java.lang.String |
getFunctor()
Get the predicate name or functor |
java.lang.Object |
getHead()
Get the head (first argument) of a predicate list Note: Caller should use isList() before this method is called |
java.util.Vector |
getListArguments()
Return a list predicate as a Vector (i.e. |
java.lang.String |
getSignature()
Get a unique signature based on predicate name and arity |
protected static AblePredicate |
getStandardList(java.util.Vector atomList)
Take this Vector of args and turn it into the standard Prolog/Lisp list structure with a head and tail for each element in the list. |
java.lang.Object |
getTail()
Get the tail (second arg) of a predicate list Note: Caller should use isList() before this method is called |
java.lang.String |
getTemplateString(java.util.Vector theTemplateVars)
Retrieve a text format string for use by rule templates. |
java.util.Vector |
getUnboundVariables()
Get a list of all unbound variables in this predicate (and any contained predicates) Note: this list will not contain any duplicates |
java.util.Vector |
getVariables()
Return all variables contained in this predicate |
boolean |
isBound()
Returns true if all variables are bound (non-null) |
boolean |
isCut()
Test if the predicate name is "cut" with 0-arity (no args) |
boolean |
isEmptyList()
Test is this predicate is an empty list |
boolean |
isFail()
Test if the predicate name is "fail" with 0 arity (no args) |
boolean |
isGround()
Test if this predicate is ground (contains no variables) |
boolean |
isList()
Test if this predicate represents a List |
boolean |
isMember(java.lang.Object fact)
|
boolean |
isNot()
Test if this predicate represents a not(X) predicate |
static java.lang.String |
listToString(AblePredicate predList)
Take a list predicate and turn it into a [ ] format string |
AblePredicate |
makeGround()
Construct a ground instance (contains no variables) of this predicate All bound variables are removed and replaced by literals. |
java.lang.String |
toString()
Return a String representation of this predicate |
java.lang.String |
traceString(int theTraceStringFlavor)
Retrieve a string describing (the contents of) the object. |
java.lang.String |
xmlCRdString()
Return a formal XML "clause read" string that describes this data object. |
java.lang.String |
xmlString()
Return a formal XML string that describes this clause. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected java.lang.String name
protected int arity
protected java.util.Vector argList
protected java.util.Hashtable replacementVars
protected java.util.Vector variables
protected AbleLogger myTracer
public static final java.lang.String DontCareSymbol
public static final java.lang.String ListPredicate
public static final java.lang.String IsListPredicate
public static final AbleEmptyListPredicate EmptyListPredicate
public static final java.lang.String NotPredicate
public static final java.lang.String CutPredicate
public static final java.lang.String FailPredicate
public static final java.lang.String CallPredicate
public static final java.lang.String UnivPredicate
public static final java.lang.String AtomCharsPredicate
public static final java.lang.String AtomConcatPredicate
public static final java.lang.String SubAtomPredicate
public static final java.lang.String VarPredicate
public static final java.lang.String NonVarPredicate
public static final java.lang.String AssertPredicate
public static final java.lang.String AssertAPredicate
public static final java.lang.String AssertZPredicate
public static final java.lang.String RetractPredicate
public static final java.lang.String RetractAllPredicate
public static final java.lang.String MemberPredicate
public static final java.lang.String UnifyPredicate
public static final java.lang.String ConsultPredicate
public static final java.lang.String AtomNumberPredicate
public static final java.lang.String FunctorPredicate
public static final java.lang.String AtomLengthPredicate
Constructor Detail |
public AblePredicate()
public AblePredicate(java.lang.String name)
public AblePredicate(java.lang.String name, java.util.Vector argList)
name
- A String containing the predicate nameargList
- A Vector containing the predicate arguments. These could
be other predicates, antecedent or consequent clauses, Symbols (strings)
BooleanLiteral, StringLiteral or DoubleLiteral, CharacterLiteral or IntegerLiteral objects.
There must be at least two arguments provided. If more than two arguments are provided, the
atomic head and tail predicates are included automatically.public AblePredicate(java.util.Vector argList)
argList
- A Vector containing the predicate list arguments.public AblePredicate(java.lang.Object head, AblePredicate tail)
head
- An Object representing the head of the listtail
- A List predicate representing the tail of the listpublic AblePredicate(AblePredicate thePredicate)
thePredicate
- The predicate object to be copiedMethod Detail |
public boolean isMember(java.lang.Object fact) throws AbleDataException
public boolean equals(java.lang.Object otherObj)
equals
in class java.lang.Object
public java.lang.String getSignature()
public java.lang.String getFunctor()
public int getArity()
public boolean isList()
public boolean isEmptyList()
public boolean isNot()
public java.lang.Object getArgument(int index)
index
- The argument (0-based) to retrieve.public java.util.Vector getArguments()
public java.util.Vector getVariables()
public boolean isGround()
public boolean isFail()
public boolean isCut()
public java.lang.Object getHead()
public java.lang.Object getTail()
public AblePredicate makeGround()
public boolean isBound()
protected static AblePredicate getStandardList(java.util.Vector atomList)
atomList
- A vector of list elements (objects)public AblePredicate createMatchPredicate(java.util.Hashtable replacementVars)
public java.util.Vector getUnboundVariables() throws AbleDataException
protected void findAllVariables()
public java.util.Vector getBoundVariables()
public void clearBindings()
public void clearBindings(java.util.Vector unboundVars)
unboundVars
- A Vector of unbound variables that should be reset to AbleData.StringNullpublic java.util.Vector getListArguments()
public static java.lang.String listToString(AblePredicate predList)
predList
- A predicate list objectpublic java.lang.String arlString()
public java.lang.String getTemplateString(java.util.Vector theTemplateVars)
theTemplateVars
- An ordered list of template variables referenced by this rule.public java.lang.String xmlCRdString()
public java.lang.String xmlString()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String traceString(int theTraceStringFlavor)
theFlavor
- An Able.TraceStringFlavor value.
|
ABLE 2.0.0 07/02/2003 10:25:01 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |