Class KnowledgeSlot

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

public class KnowledgeSlot extends Object implements Serializable
Class used to store knowledge in the KnowledgeBase. A KnowledgeSlot can store an object, but also any number of children KnowledgeSlots. This hierarchical composition of KnowledgeSlots builds up the KnowledgeBase and allows fast indexing and search of properties.
Author:
Joao Dias
See Also:
  • Constructor Details

    • KnowledgeSlot

      public KnowledgeSlot(String name)
      Creates an empty KnowledgeSpot, identified by the received name
      Parameters:
      name - - the name that identifies the KnowledgeSlot
  • Method Details

    • clear

      public void clear()
      Clears all the information stored in the KnowledgeSlot (including all its children)
    • containsKey

      public boolean containsKey(String key)
      Determines if this KnowledgeSlot has a child with a specific key
      Parameters:
      key - - the key of the child to search
      Returns:
      true if the KnowledgeSlot contains a child with the received key
    • get

      public KnowledgeSlot get(String key)
      Gets the child KnowledgeSlot identified by the given key
      Parameters:
      key - - the key of the child to get
      Returns:
      the child KnowledgeSlot
    • getKeys

      public Set<String> getKeys()
    • getKeyIterator

      public Iterator<String> getKeyIterator()
      Gets an Iterator that iterates over the set of existing child Keys
      Returns:
      the key Iterator
    • getName

      public String getName()
      Gets the KnowledgeSlot identifier
      Returns:
      the KnowledgeSlot ID
    • getValue

      public Object getValue()
      Gets the object stored in the KnowledgeSlot
      Returns:
      the object stored in the KS
    • CountElements

      public int CountElements()
      Counts the number of valid elements (ones that have a value stored in them) stored within this KnowledgeSlot (may include children, grandchildren, grandgrandchildren, etc).
      Returns:
      the number of elements stored inside the KnowledgeSlot
    • put

      public void put(String key, KnowledgeSlot kSlot)
      Adds a KS child to the KnowledgeSlot
      Parameters:
      key - - the Key of the KnowledgeSlot to ADD
      kSlot - - the KnowledgeSlot to ADD
    • remove

      public void remove(String key)
      Removes a child from the KnowledgeSlot
      Parameters:
      key - - the key of the child to remove
    • setValue

      public void setValue(Object object)
      Sets the object stored in the KnowledgeSlot
      Parameters:
      object - - the new object to store in the KnowledgeSlot
    • toString

      public String toString()
      Converts the KnowledgeSlot to a String
      Overrides:
      toString in class Object
      Returns:
      the converted String
    • toXML

      public String toXML()