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

The TypeCoInhNode is a node specifying type inheritance. It is a special kind of TypeNode that accepts type matches for the indicated type, or any base type.

This is best explained by example. Consider the following structure:

    VariableNode "$foo"
    TypeCoInhNode "SetLink"

If the above is used with the pattern matcher, then any atom that was an SetLink, or any base type, such as UnorderedLink, Link, Atom or Value would be considered to be matches.

Observe that the TypeCoInhNode behaves as if it were a kind-of PredicateNode, in that it will evaluate to true, if the variable is of the indicated type, else it will evaluate to false.

The inverted inheritance relation is supplied by the TypeInhNode. Note that the TypeCoInhNode can be thought of as a "least upper bound" for the type hierarchy.

Type ranges

A range of types can be specified by using the TypeSetLink, to form a conjunction. Thus, for example, to force the variable "$foo" to be a SetLink, an UnorderedLink, or any type in between, one could write

    VariableNode "$foo"
        TypeInhNode "UnorderedLink"
        TypeCoInhNode "SetLink"

The above requires that "$foo" have at least the type UnorderedLink, but nothing derived from SetLink. Recall that SetLink is a special case of UnorderedLink.