Class KnowledgeBase

java.lang.Object
FAtiMA.Core.memory.semanticMemory.KnowledgeBase
All Implemented Interfaces:
Serializable

public class KnowledgeBase extends Object implements Serializable
Implements a KnowledgeBase that stores properties and predicates about the world. Provides a very fast method of searching for the information stored inside it. At the moment this KnowledgeBase also provides a limited kind of forward inference that can be applyed to generate new properties and predicates. This logical inference is performed by specific inference operators that must be explicitly added to the KB. This KB works as an efficient information repository. You cannot create a KB, since there is one and only one KB for the agent. If you want to access it use KnowledgeBase.GetInstance() method.
Author:
Joao Dias
See Also:
  • Constructor Details

    • KnowledgeBase

      public KnowledgeBase()
      Creates a new Empty KnowledgeBase
  • Method Details

    • AddInferenceOperator

      public void AddInferenceOperator(Step op)
      Adds an InferenceOperator to the KnowledgeBase
      Parameters:
      op - - the inference operator to Add
    • Ask

      public Object Ask(Name name)
    • Clear

      public void Clear()
      Empties the KnowledgeBase
    • Count

      public int Count()
      Gets the number of elements (predicates or properties) stored in the KnowledgeBase
      Returns:
      the number of elements stored in the KB
    • GetFactList

      public ArrayList<KnowledgeSlot> GetFactList()
    • putFact

      public void putFact(KnowledgeSlot ks)
    • GetInferenceOperators

      public ArrayList<Step> GetInferenceOperators()
      Gets the inference operators
      Returns:
      the inference operators
    • Retract

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

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

      public ArrayList<SubstitutionSet> GetPossibleBindings(Name name)
    • GetObjectDetails

      public KnowledgeSlot GetObjectDetails(String objectName)
    • GetObjectProperty

      public KnowledgeSlot GetObjectProperty(String objectName, String property)
    • getMainSlot

      public KnowledgeSlot getMainSlot()
    • toString

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

      public String toXML()