org.botlibre.api.knowledge
Interface Memory

All Known Implementing Classes:
BasicMemory, DatabaseMemory, SerializedMemory, XMLMemory

public interface Memory

Defines a set of networks that make up a knowledge base. Defines long term, short term and active networks. Handle persistence of networks and merging of network spaces from short term to long term.


Method Summary
 void abort()
          Reset the short term and active memories.
 Vertex addActiveMemory(Vertex vertex)
          Add the sensory data to the active memory.
 void addListener(MemoryEventListener listener)
          Add the memory listener.
 void awake()
           
 int cacheSize()
           
 void clearProperties(java.lang.String propertySet)
           
 void createMemory(java.lang.String database)
          Create a memory database.
 void createMemory(java.lang.String database, boolean isSchema)
          Create a memory database.
 void createMemoryFromTemplate(java.lang.String database, boolean isSchema, java.lang.String template, boolean templateIsSchema)
          Create a memory database.
 void createMemoryFromTemplate(java.lang.String database, java.lang.String template)
          Create a memory database.
 void deleteMemory()
          Delete all content from the database.
 void destroyMemory(java.lang.String database)
          Destroy the database.
 void destroyMemory(java.lang.String database, boolean isSchema)
          Destroy the database.
 void fastRestore(java.lang.String database, boolean isSchema)
          Restores the memory from a persisted state.
 void freeMemory()
           
 java.util.List<Vertex> getActiveMemory()
          Active memory represents the last sensory state.
 Bot getBot()
           
 Network getLongTermMemory()
          Represents the persisted memory (or cache there of).
 java.lang.String getMemoryName()
          Return the current connected database name.
 java.lang.String getProperty(java.lang.String property)
          Return the property setting.
 Network getShortTermMemory()
          Represents a non-committed transactional memory.
 void importMemory(java.lang.String location)
          Allow import of another memory location.
 void initialize(java.util.Map<java.lang.String,java.lang.Object> properties)
          Initialize any configurable settings from the properties.
 void loadProperties(java.lang.String propertySet)
           
 Network newMemory()
          Return an isolated transactional memory.
 void pool()
          Reset state when instance is pooled.
 void removeListener(MemoryEventListener listener)
           
 java.lang.String removeProperty(java.lang.String property)
          Remove the property setting.
 void restore()
          Restores the memory from a persisted state.
 void restore(java.lang.String database, boolean isSchema)
          Restores the memory from a persisted state.
 void save()
          Merge the short term memory into the long term and clears the short term.
 void setBot(Bot Bot)
           
 java.lang.String setProperty(java.lang.String property, java.lang.String value)
          Set the property setting.
 void shutdown()
          Shutdown the memory.
 void switchMemory(java.lang.String location)
          Allow switching to another memory location.
 void switchMemory(java.lang.String location, boolean isSchema)
          Allow switching to another memory location.
 

Method Detail

getActiveMemory

java.util.List<Vertex> getActiveMemory()
Active memory represents the last sensory state.


addActiveMemory

Vertex addActiveMemory(Vertex vertex)
Add the sensory data to the active memory. Register the vertex in the short-term memory and return the registered version.


getShortTermMemory

Network getShortTermMemory()
Represents a non-committed transactional memory. Helps to define a learn scope and local context.


newMemory

Network newMemory()
Return an isolated transactional memory. Can be used by senses or sub-conscious thought for concurrent processing.


getLongTermMemory

Network getLongTermMemory()
Represents the persisted memory (or cache there of).


save

void save()
          throws MemoryStorageException
Merge the short term memory into the long term and clears the short term. This is similar to a transactional commit. The changes should also be persisted, as the long term should always just be a cache of the storage.

Throws:
MemoryStorageException

restore

void restore()
             throws MemoryStorageException
Restores the memory from a persisted state.

Throws:
MemoryStorageException

restore

void restore(java.lang.String database,
             boolean isSchema)
             throws MemoryStorageException
Restores the memory from a persisted state.

Throws:
MemoryStorageException

fastRestore

void fastRestore(java.lang.String database,
                 boolean isSchema)
                 throws MemoryStorageException
Restores the memory from a persisted state.

Throws:
MemoryStorageException

getMemoryName

java.lang.String getMemoryName()
Return the current connected database name.


createMemory

void createMemory(java.lang.String database)
Create a memory database.


createMemory

void createMemory(java.lang.String database,
                  boolean isSchema)
Create a memory database.


createMemoryFromTemplate

void createMemoryFromTemplate(java.lang.String database,
                              java.lang.String template)
Create a memory database.


createMemoryFromTemplate

void createMemoryFromTemplate(java.lang.String database,
                              boolean isSchema,
                              java.lang.String template,
                              boolean templateIsSchema)
Create a memory database.


destroyMemory

void destroyMemory(java.lang.String database)
Destroy the database.


destroyMemory

void destroyMemory(java.lang.String database,
                   boolean isSchema)
Destroy the database.


deleteMemory

void deleteMemory()
Delete all content from the database.


importMemory

void importMemory(java.lang.String location)
Allow import of another memory location.


shutdown

void shutdown()
Shutdown the memory.


pool

void pool()
Reset state when instance is pooled.


switchMemory

void switchMemory(java.lang.String location)
Allow switching to another memory location.


switchMemory

void switchMemory(java.lang.String location,
                  boolean isSchema)
Allow switching to another memory location.


abort

void abort()
Reset the short term and active memories. Revert to the long term state.


getBot

Bot getBot()

setBot

void setBot(Bot Bot)

initialize

void initialize(java.util.Map<java.lang.String,java.lang.Object> properties)
Initialize any configurable settings from the properties.


awake

void awake()

loadProperties

void loadProperties(java.lang.String propertySet)

clearProperties

void clearProperties(java.lang.String propertySet)

getProperty

java.lang.String getProperty(java.lang.String property)
Return the property setting.


setProperty

java.lang.String setProperty(java.lang.String property,
                             java.lang.String value)
Set the property setting.


removeProperty

java.lang.String removeProperty(java.lang.String property)
Remove the property setting.


addListener

void addListener(MemoryEventListener listener)
Add the memory listener. It will be notified of any new active memory.


removeListener

void removeListener(MemoryEventListener listener)

cacheSize

int cacheSize()

freeMemory

void freeMemory()