jdrew.oo.td
Class BackwardReasoner.GoalList

java.lang.Object
  extended by jdrew.oo.td.BackwardReasoner.GoalList
Enclosing class:
BackwardReasoner

public class BackwardReasoner.GoalList
extends java.lang.Object

GoalList - contains a list of Goals and is attached to a specific Goal which is called its parent. If and when a Goal in the list becomes solved, or partially solved, the effect is to bind variables in the atomic formula. These bindings are immediately applied to the sibling Goals in this SubGoalList. They may also be propogated to the parent Goal, by calling subGoalListSolved() on the parent when the parent is attached to this SubGoalList. By default, this call must be done by the programmmer, but the default behaviour can be set to PROPAGATE_FULLY_SOLVED, which changes it so that subGoalSolved is called on the parent when the SubGoalList is fully solved. The default behaviour can also be set to PROPAGATE_EAGERLY which will propagate eagerly: subGoalSolved is called automatically whenever a GoalList becomes more fully solved by the solution of one more of its member Goals.

Because a Goal may be attached to a failed SubGoalList, but other SubGoalLists are still available for it, it is important to be able undo the effects of this failed SubGoalList on the Goal, and consequently effects that have may been propagated throughout the BackwardReasoner. Thus each Goal and each GoalList has a backup facility that makes it possible to retrieve a previous version, replacing the old values the variable bindings. In the case of the GoalList, the backup facility also retrieves a records of what member Goals have been solved. The backup facility is used through the createBackup() and restoreBackup() routines. Thus backups are done manually, not automatically, and are based on a stack; N calls to createBackup() followed by M calls to restoreBackup(), when N<=M, will restore to the point when N-M call to createBackup() was made. If M>N, an exception is thrown. (We may consider automatic backups through the tree but the problem is that backups need to be synchronized so that the tree is brought back to a consistent overall state. This is also the reason why propagation from GoalLists to Goals is not automatic by default. One can keep the effects of changes to the Clause tree local in a GoalList until that GoalList is fully solved, and only then propagate it. This removes the need to undo the results of propagating partially solved GoalLists through the tree.)

Title: OO jDREW

Description: A deductive reasoning engine for Object-Oriented Knowledge Representation in OO RuleML

Copyright: Copyright (c) 2003

Company: National Research Council of Canada


Field Summary
 int atomCount
           
 Term[] atoms
           
 boolean hasVariableNames
           
 BackwardReasoner.Goal[] memberGoals
           
 BackwardReasoner.Goal parent
           
 java.util.Hashtable varBindings
           
 int varCount
           
 java.lang.String[] variableNames
           
 
Method Summary
 void createBackup()
           
 BackwardReasoner.Goal firstOpenGoal()
           
 Term getAtom(int idx)
           
 java.lang.String[] getVariableNames()
           
 BackwardReasoner.Goal head()
           
 void propagateBindingsToParent()
           
 void purgeBackup()
           
 void restoreBackup()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

varBindings

public java.util.Hashtable varBindings

varCount

public int varCount

variableNames

public java.lang.String[] variableNames

hasVariableNames

public boolean hasVariableNames

atomCount

public int atomCount

atoms

public Term[] atoms

parent

public BackwardReasoner.Goal parent

memberGoals

public BackwardReasoner.Goal[] memberGoals
Method Detail

propagateBindingsToParent

public void propagateBindingsToParent()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
Returns:
String

firstOpenGoal

public BackwardReasoner.Goal firstOpenGoal()
Returns:
Goal

head

public BackwardReasoner.Goal head()
Returns:
Goal

getAtom

public Term getAtom(int idx)
Parameters:
idx - int
Returns:
Term

createBackup

public void createBackup()

restoreBackup

public void restoreBackup()

purgeBackup

public void purgeBackup()

getVariableNames

public java.lang.String[] getVariableNames()
Returns:
String[]