OpenCog Framework
Branch: master, revision 6f0b7fc776b08468cf1b74aa9db028f387b4f0c0
|
This library (opencog/server) is the active core of the project. It is used by cogserver program to do most of its functions. To build it use:
Note that same directory contains the sources for another related library - builtinreqs - described in a section below.
This page is a high level overview of the library; to dig into the details read the comprehensive overview.
Dependencies:
The basic requirements for a server are grouped in BaseServer class. It only provides getAtomSpace() and createInstance(). There are also two global functions: server() to get the one and only instance and atomspace() that returns the AtomSpace associated with the server.
CogServer class, derived from BaseServer, implements the official server used by the opencog framework. It is responsible for managing 4 base structures (cycles, modules, agents and requests) and a NetworkServer for external access to the server.
The types of agents and requests known to the server are managed using Registry templated with Agent and Request. Registry helps to register, unregister and list classes, create, destroy and other management tasks.
An Agent (or mind agent in wiki) is a base abstract class that should be extended by all opencog agents. To write a custom agent, all one has to do is to derive from the Agent class and implement the desired behavior inside the run() method. See Creating a new Mind Agent in C and Creating a Mind Agent that does something in C
Extening the repertoire of known commands is done using either modules containing commands or with shells.
A module is first declared using DECLARE_MODULE, then implemented, maybe using TRIVIAL_MODULE or subclassing a class from Module. A Request is them added to module class using DECLARE_CMD_REQUEST that expects, among others, the routine that will be fired when that command is entered.
A NetworkServer has a list of listeners; the base class for SocketListener is SocketPort.
ConsoleSocket handles primary interface of the cogserver: the plain text command line. ConsoleSocket has a pointer to a GenericShell instance and is based on:
The server also logs the Activity of agents using SystemActivityTable. This forms the base for Attentional Data Mining.
This library contains build-in requests. To build it use:
Dependencies:
The module to implement the requests is BuiltinRequestsModule and it uses following factories: ListRequest, SleepRequest ShutdownRequest, LoadModuleRequest, UnloadModuleRequest and ListModulesRequest. These provide a basic system where the user is able to close the connection, list available commands, start, stop, advance and list agents. A comprehensive list is available in the wiki.
Two libraries are provided that implement GenericShell interface:
To build it use:
Dependencies:
The command to enter this shell (provided by SchemeShellModule) is
Executing Scheme code without actually entering the shell is also possible:
To build it use:
Dependencies:
The command to enter this shell (provided by PythonShellModule) is
Executing Python code without actually entering the shell is also possible:
Previous | Next |