From OpenCog
(Redirected from VariableTypeNode)
Jump to: navigation, search

A TypeNode is a kind of Node that acts as a type constructor for the primitive data types, the atom types. It is typically used to declare the type of a VariableNode. It can also be combined with other type constructors to declare more complex types.

Thus, for example, the declaration

    VariableNode $F
    TypeNode "ConceptNode"

declares that the variable $F must be of the type ConceptNode. Such declarations are typically used to constrain the arguments to a LambdaLink, a GetLink, a PutLink or a BindLink.

An example of a more complex type is to use it with the SignatureLink type constructor to declare a signature [1].

Thus, for example

       TypeNode "ConceptNode"
       TypeNode "ConceptNode"

declares the (anonymous) signature of a ListLink having exactly two ConceptNodes in its outgoing set. This anonymous type can be given a name by using the DefinedTypeNode.

The TypeNode can be thought of as a special case of a PredicateNode: it is something that evaluates to true, when the indicated object has the specified type, and evaluates to false, when it does not.

Type inheritance

The TypeInhNode provides a way of specifying a type, or any of it's derived types. Similarly, the TypeCoInhNode provide a way of specifying a type or any of it's base types. These can be thought of as being lower and upper bounds on the type hierarchy.

Ranges of types can be specified using the TypeSetLink.

See also