ProtoAtom

From OpenCog
Jump to: navigation, search

The ProtoAtom is the base type for both Atoms and TruthValues, and values in general, including the FloatValue, StringValue and LinkValue. Values provide a mechanism for associating arbitrary, generic values with some given atom.

ProtoAtoms are like atoms, except that they lack a UUID, a TV, an AV, and cannot be stored in the atomspace. This makes them smaller, lighter and more efficient. They were invented to provide a common base class for TruthValues and AttentionValues, thus generalizing these, and to provide a common type hierarchy, so that the existing type specification system could be used to specify both atoms and values.

The current implementation status is tracked in github bug #513. The implementation is mostly completed, however, general utilities, examples, use-cases and documentation is still missing. The range of programming styles that use values has not yet been explored. The current C++ implementation is in opencog/atoms/base.

Type hierarchy

The current type-inheritance hierarchy is as follows, copied from opencog/atoms/base/atom_types.script:

// Special type designating that no atom type has been assigned.
NOTYPE

VALUE
FLOAT_VALUE <- VALUE    // vector of floats, actually.
STRING_VALUE <- VALUE
LINK_VALUE <- VALUE     // vector of values ("link" holding values)
VALUATION <- VALUE

// All of the different flavors of truth values
TRUTH_VALUE <- FLOAT_VALUE
SIMPLE_TRUTH_VALUE <- TRUTH_VALUE
COUNT_TRUTH_VALUE <- TRUTH_VALUE
INDEFINITE_TRUTH_VALUE <- TRUTH_VALUE
FUZZY_TRUTH_VALUE <- TRUTH_VALUE
PROBABILISTIC_TRUTH_VALUE <- TRUTH_VALUE
EVIDENCE_COUNT_TRUTH_VALUE <- TRUTH_VALUE

// Base of hierarchy - NOTE: ATOM will not have a corresponding Python
// construction function to avoid identifier conflict with the Atom object.
ATOM <- VALUE
NODE <- ATOM
LINK <- ATOM

CONCEPT_NODE <- NODE
NUMBER_NODE <- NODE

// Basic Links
ORDERED_LINK <- LINK
UNORDERED_LINK <- LINK

... and so on.

The type hierarchy has the algebraic properties of the mathematical concepts of lattice or order. Points in the lattice can be specified with the TypeNode, while upper and lower bounds are specified with the TypeInhNode and the TypeCoInhNode.