Class SemanticMemory
java.lang.Object
FAtiMA.Core.memory.semanticMemory.SemanticMemory
- All Implemented Interfaces:
Serializable
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbooleanAskPredicate(Name predicate) Asks the Memory the Truth value of the received predicateAskProperty(Name property) Asks the Memory the value of a given propertyvoidInserts a Predicate in the WorkingMemoryvoidintCount()GetObjectDetails(String objectName) GetObjectProperty(String objectName, String property) GetPossibleBindings(Name name) This method provides a way to search for properties/predicates in the WorkingMemory that match with a specified name with unbound variables.booleanGets a value that indicates whether new Knowledge has been added to the WorkingMemory since the last inference processvoidInitializeProperty(Name property, Object value) booleanThis method should be called every simulation cycle, and will try to apply InferenceOperators.voidvoidvoidRemoves a predicate from the Semantic Memoryvoid
-
Constructor Details
-
SemanticMemory
public SemanticMemory()
-
-
Method Details
-
AddInferenceOperator
-
AskPredicate
Asks the Memory the Truth value of the received predicate- Parameters:
predicate- - The predicate to search in the Memory- Returns:
- Under the Closed World Assumption, the predicate is considered true if it is stored in the Memory and false otherwise.
-
AskProperty
Asks the Memory the value of a given property- Parameters:
property- - the property to search in the Memory- Returns:
- the value stored inside the property, if the property exists. If the property does not exist, it returns null
-
Assert
Inserts a Predicate in the WorkingMemory- Parameters:
predicate- - the predicate to be inserted
-
ClearChangeList
public void ClearChangeList() -
Count
public int Count() -
GetChangeList
-
GetFactList
-
GetKnowledgeBaseFacts
-
getNewFacts
-
GetObjectDetails
-
GetObjectProperty
-
GetPossibleBindings
This method provides a way to search for properties/predicates in the WorkingMemory that match with a specified name with unbound variables. In order to understand this method, let’s examine the following example. Suppose that the memory only contains properties about two characters: Luke and John. Furthermore, it only stores two properties: their name and strength. So the KB will only store the following objects: - Luke(Name) : Luke - Luke(Strength) : 8 - John(Name) : John - John(Strength) : 4 The next table shows the result of calling the method with several distinct names. The function works by finding substitutions for the unbound variables, which make the received name equal to the name of an object stored in memory. Name Substitutions returned Luke([x]) {{[x]/Name},{[x]/Strength}} [x](Strength) {{[x]/John},{[x]/Luke}} [x]([y]) {{[x]/John,[y]/Name},{[x]/John,[y]/Strength},{[x]/Luke,[y]/Name},{[x]/Luke,[y]/Strength}} John(Name) {{}} John(Height) null Paul([x]) null In the first example, there are two possible substitutions that make “Luke([x])” equal to the objects stored above. The third example has two unbound variables, so the returned set contains all possible combinations of variable attributions. If this method receives a ground name, as seen on examples 4 and 5, it checks if the received name exists in memory. If so, a set with the empty substitution is returned, i.e. the empty substitution makes the received name equal to some object in memory. Otherwise, the function returns null, i.e. there is no substitution that applied to the name will make it equal to an object in memory. This same result is returned in the last example, since there is no object named Paul, and therefore no substitution of [x] will match the received name with an existing object.- Parameters:
name- - a name (that correspond to a predicate or property)- Returns:
- a list of SubstitutionSets that make the received name to match predicates or properties that do exist in the WorkingMemory
-
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
-
InitializeProperty
-
PerformInference
This method should be called every simulation cycle, and will try to apply InferenceOperators. Note, that if new knowledge results from this process, it will be added immediately to the WM. However, the inference will not continue (by trying to use the new knowledge to activate more operators) until the method PerformInference is called in next cycle.- Returns:
- true if the Inference resulted in new Knowledge being added, false if no new knowledge was inferred
-
Retract
Removes a predicate from the Semantic Memory- Parameters:
predicate- - the predicate to be removed
-
Tell
-
putKnowledgeBase
-
putWorkingMemory
-