All classes of the platform are defined in the cogitant namespace (
namespace), it is therefore required to prefix them in order to use them (e.g. cogitant::Graph), or use the directive:
Classes for client/server communication are in the cogitantcs namespace and classes enabling graphical display are in the cogitantdisplay namespace.
The classes are named as in Java, i.e. they begin with a capital letter and the first letter of each "subword" of the class name is capitalized. There is obviously no accented characters, and the character "_" is only used to separate the class name from its method of implementation. Thus, the class of objects labeled in a graph is named cogitant::LabeledGraphObject (not Labeled_Graph_Object), while the most basic implementation of class cogitant::Set (which is abstract) is named cogitant::Set_Simple.
The methods are also named as in Java, i.e. they start with a lower case, and the first letter of each "subword" of the method name is capitalized. For example, the method of the class cogitant::Environment enabling the creation of a new graph is named cogitant::Environment::newGraph().
Header files are stored in the
cogitant directory of a directory present in search paths (
/usr/local/include by default under Unix). In this way, to include a file of the platform, it is required to use the directive
include in the following way (for example):
Header files corresponding to the classes oriented information research are in the subdirectory
#include "cogitant/ir/thesaurus.h"), those of client-server classes are in the subdirectory
cs, and those of display classes in the subdirectory
display. Finally, a specific file header
"cogitant/cogitant.h" comprises most of the files in the library and can be used alone in most cases.
Most accessors to members of different classes are available in two versions of the same name. A version returns a reference to an object that can be modified, while a second version returns a reference to a constant object, the second variant being the only one that can called on a constant instance (method declared
const). For example the class cogitant::Rule has two methods cogitant::Rule::hypothesis() returning the hypothesis conceptual graph of the rule. One of these two methods is
const and returns a pointer on a constant graph (which can not be changed), while the other returns a pointer on a graph that can be modified. Obviously only the first can be called on a rule that can not be changed (this is checked at compile time).
A certain number of classes contains sets of objects (a cogitant::Support contains a set of cogitant::ConceptType, a cogitant::Graph contains a set of cogitant::GraphObject, ...). In these cases, the container class is provided with several ways to access the included elements, each of these elements being identified by a unique identifier (of type cogitant::iSet). A first couple of methods provides access to the sets (for example cogitant::Support::conceptTypes() or cogitant::Graph::nodes()) while a second pair of methods of the same name provides a direct access to an element of the set by its identifier (for example cogitant::Support::conceptTypes(cogitant::iSet) or cogitant::Graph::nodes(cogitant::iSet)).