ProtoAtom

From OpenCog
Jump to: navigation, search

The ProtoAtom is the base type for both Atoms and Values, including TruthValues, FloatValues, StringValues and LinkValues. Values provide a mechanism for associating arbitrary, generic values with some given atom. They can be though of as a per-atom key-value store, or, equivalently, as the mathematical concept of a valuation.

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 intent is that Atoms are used to store static, global, relatively unchanging data. Atoms are globally unique. By contrast, Values are meant to store rapidly changing, fleeting data. Thus, for example, the probability of the truth of some proposition will change over time, as new evidence is accumulated, and as deductions and inference is performed.

ProtoAtoms (that is, both atoms and values) can be stored in a persistent store (currently supported only in the Postgres SQL backend).

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.