OpenCog

Node

From OpenCog

Nodes are Atoms with names. The name and the type of a Node together determine a unique key. It means there exist only one Node with a given (name,type) pair. If a second Node with the same key is inserted, it is merged with the previously inserted Node. The name and type of the node cannot be changed after the node has been inserted into the AtomSpace: OpenCog atoms are immutable.

Scheme interface

Nodes can be created, manipulated and destroyed at the scheme shell command prompt. See scheme for details, and cookbook for examples.

C++ programming interface

   class Node : public Atom {
       private:
         string name; // null if unnamed
       public:
         Node(Type, string &);
         char* getName();
         char* toString();
         char* toShortString();
         virtual bool equals(Node *);
         void setName(char*);
   };

getName() , toString() and toShortString() return respectively the name, a string representation (with type, name, importance and activation) and a compact string representation (with only type and name) of the Node.

Considering the following example: L1 A B L2 A C L3 D B L4 L1 A

setName() should never be called in an already inserted Node. Otherwise, the indexing structures inside the AtomTable may be corrupted.