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.
Transfer the TruthValue from "foo" to "bar" ... copy it.
(cog-execute! (SetTV (Concept "bar") (TruthValueOf (Concept "foo"))))
Compute a TruthValue, using formulas.
(cog-execute! (SetTV (Concept "bar") (Times (TruthValueOf (Concept "foo")) (TruthValueOf (Concept "foo")))))
(define (reddish-tv X Y) (SimpleTruthValue (- 1 (* (cog-mean X) (cog-mean Y))) (* (cog-confidence X) (cog-confidence Y)))) (cog-execute! (SetTV (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.