Class WorkingMemory

  • All Implemented Interfaces:
    java.io.Serializable

    public class WorkingMemory
    extends java.lang.Object
    implements java.io.Serializable
    Implements a knowledge structure that stores properties and predicates about the world for current processes (new data or data retrieved from the knowledge base. Provides a very fast method of searching for the information stored inside it. This structure also provides a limited kind of Logical Inference that can be applied to generate new properties and predicates. This logical inference is performed by specific inference operators that must be explicitly added to the WM. When the WM buffer is full, data will be transfer to the KnowledgeBase (LTM) based on first in first out mechanism.
    Author:
    Meiyii Lim
    See Also:
    Serialized Form
    • Constructor Detail

      • WorkingMemory

        public WorkingMemory()
        Creates a new Empty WorkingMemory
    • Method Detail

      • Ask

        public java.lang.Object Ask​(Name name)
      • Clear

        public void Clear()
        Empties the WorkingMemory
      • ClearChangeList

        public void ClearChangeList()
      • Count

        public int Count()
      • GetChangeList

        public java.util.ArrayList<KnowledgeSlot> GetChangeList()
      • GetFactList

        public java.util.ArrayList<KnowledgeSlot> GetFactList()
      • GetNewFacts

        public java.util.ArrayList<KnowledgeSlot> GetNewFacts()
      • HasNewKnowledge

        public boolean HasNewKnowledge()
        Gets a value that indicates whether new Knowledge has been added to the WorkingMemory since the last inference process
        Returns:
        true if there is new Knowledge in the WM, false otherwise
      • RearrangeWorkingMemory

        public void RearrangeWorkingMemory​(Name predicate,
                                           java.lang.Object value)
        Rearrange the working memory entries so that the most current accessed entry comes last
      • ResetNewKnowledge

        public void ResetNewKnowledge()
      • Retract

        public void Retract​(Name predicate)
        Removes a predicate from the WorkingMemory
        Parameters:
        predicate - - the predicate to be removed
      • Tell

        public void Tell​(KnowledgeBase kb,
                         Name property,
                         java.lang.Object value)
        Adds a new property or sets its value (if already exists) in the WorkingMemory
        Parameters:
        property - - the property to be added/changed
        value - - the value to be stored in the property
      • GetPossibleBindings

        public java.util.ArrayList<SubstitutionSet> GetPossibleBindings​(Name name)
      • GetObjectDetails

        public KnowledgeSlot GetObjectDetails​(java.lang.String objectName)
      • GetObjectProperty

        public KnowledgeSlot GetObjectProperty​(java.lang.String objectName,
                                               java.lang.String property)
      • toString

        public java.lang.String toString()
        Converts the Information stored in the WM to one String
        Overrides:
        toString in class java.lang.Object
        Returns:
        the converted String
      • toXML

        public java.lang.String toXML()