From OpenCog
Jump to: navigation, search

The SetTVLink is an evaluatable Link that can be used to update the TruthValue on a given Atom, given some source that provides a TruthValue. Such sources include other Atoms, in which case the TV is copied, or it may be a PredicateFormula or DynamicFormula, which compute a new TV, or a GroundedPredicateNode, which can call back into scheme or python to obtain a truth value.

This is generalized by the SetValueLink, which performs the same actions, but for generic Values.


Transfer the TruthValue from "foo" to "bar" ... copy it.

      (Concept "bar")
      (TruthValueOf (Concept "foo"))))

Compute a TruthValue, using formulas.

      (Concept "bar")
         (TruthValueOf (Concept "foo"))
         (TruthValueOf (Concept "foo")))))

Use a GroundedPredicate to provide a truth value (one may also use a PredicateFormula, a DefinedPredicate or a DynamicFormula, as well).

(define (reddish-tv X Y)
      (- 1 (* (cog-mean X) (cog-mean Y)))
      (* (cog-confidence X) (cog-confidence Y))))

      (Concept "martian rock")
      (GroundedPredicate "scm: reddish-tv")
      (List (Concept "A") (Concept "B")))

A detailed exploration can be found in the /examples/atomspace/flows.scm file.