Class KnowledgeSlot
java.lang.Object
FAtiMA.Core.memory.semanticMemory.KnowledgeSlot
- All Implemented Interfaces:
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 Summary
ConstructorsConstructorDescriptionKnowledgeSlot(String name) Creates an empty KnowledgeSpot, identified by the received name -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clears all the information stored in the KnowledgeSlot (including all its children)booleancontainsKey(String key) Determines if this KnowledgeSlot has a child with a specific keyintCounts the number of valid elements (ones that have a value stored in them) stored within this KnowledgeSlot (may include children, grandchildren, grandgrandchildren, etc).Gets the child KnowledgeSlot identified by the given keyGets an Iterator that iterates over the set of existing child KeysgetKeys()getName()Gets the KnowledgeSlot identifiergetValue()Gets the object stored in the KnowledgeSlotvoidput(String key, KnowledgeSlot kSlot) Adds a KS child to the KnowledgeSlotvoidRemoves a child from the KnowledgeSlotvoidSets the object stored in the KnowledgeSlottoString()Converts the KnowledgeSlot to a StringtoXML()
-
Constructor Details
-
KnowledgeSlot
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
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
Gets the child KnowledgeSlot identified by the given key- Parameters:
key- - the key of the child to get- Returns:
- the child KnowledgeSlot
-
getKeys
-
getKeyIterator
Gets an Iterator that iterates over the set of existing child Keys- Returns:
- the key Iterator
-
getName
Gets the KnowledgeSlot identifier- Returns:
- the KnowledgeSlot ID
-
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
Adds a KS child to the KnowledgeSlot- Parameters:
key- - the Key of the KnowledgeSlot to ADDkSlot- - the KnowledgeSlot to ADD
-
remove
Removes a child from the KnowledgeSlot- Parameters:
key- - the key of the child to remove
-
setValue
Sets the object stored in the KnowledgeSlot- Parameters:
object- - the new object to store in the KnowledgeSlot
-
toString
Converts the KnowledgeSlot to a String -
toXML
-