Class KnowledgeBase
- java.lang.Object
-
- FAtiMA.Core.memory.semanticMemory.KnowledgeBase
-
- All Implemented Interfaces:
java.io.Serializable
public class KnowledgeBase extends java.lang.Object implements java.io.SerializableImplements 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:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description KnowledgeBase()Creates a new Empty KnowledgeBase
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidAddInferenceOperator(Step op)Adds an InferenceOperator to the KnowledgeBasejava.lang.ObjectAsk(Name name)voidClear()Empties the KnowledgeBaseintCount()Gets the number of elements (predicates or properties) stored in the KnowledgeBasejava.util.ArrayList<KnowledgeSlot>GetFactList()java.util.ArrayList<Step>GetInferenceOperators()Gets the inference operatorsKnowledgeSlotgetMainSlot()KnowledgeSlotGetObjectDetails(java.lang.String objectName)KnowledgeSlotGetObjectProperty(java.lang.String objectName, java.lang.String property)java.util.ArrayList<SubstitutionSet>GetPossibleBindings(Name name)voidputFact(KnowledgeSlot ks)voidRetract(Name predicate)Removes a predicate from the KnowledgeBasevoidTell(Name property, java.lang.Object value)Adds a new property or sets its value (if already exists) in the KnowledgeBasejava.lang.StringtoString()Converts the Information stored in the KB to one Stringjava.lang.StringtoXML()
-
-
-
Method Detail
-
AddInferenceOperator
public void AddInferenceOperator(Step op)
Adds an InferenceOperator to the KnowledgeBase- Parameters:
op- - the inference operator to Add
-
Ask
public java.lang.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 java.util.ArrayList<KnowledgeSlot> GetFactList()
-
putFact
public void putFact(KnowledgeSlot ks)
-
GetInferenceOperators
public java.util.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, java.lang.Object value)
Adds a new property or sets its value (if already exists) in the KnowledgeBase- Parameters:
property- - the property to be added/changedvalue- - 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)
-
getMainSlot
public KnowledgeSlot getMainSlot()
-
toString
public java.lang.String toString()
Converts the Information stored in the KB to one String- Overrides:
toStringin classjava.lang.Object- Returns:
- the converted String
-
toXML
public java.lang.String toXML()
-
-