From OpenCog

The TruthValueOfLink is a ValueOfLink that returns the TruthValue associated to some atom. It must have the format:


On execution, it returns the TruthValue attached to SomeAtom. If SomeAtom is a evaluatable link type, it is evaluated first, so as to obtain a current TruthValue.

Individual components of the TruthValue can be accessed with the StrengthOfLink and the ConfidenceOfLink.

The TruthValueOfLink is primarily used in PredicateFormulaLinks, which allow truth-value formulas to be specified in Atomese.


Set a truth value, then fetch it:

(use-modules (opencog) (opencog exec))

(Concept "A" (stv 0.8 0.3))
(cog-execute! (TruthValueOf (Concept "A")))

Arithmetic computations are possible with the returned values:

(cog-execute! (Minus (Number 1) (TruthValueOf (Concept "A"))))

Component access is possible with the StrengthOf and ConfidenceOf links:

(cog-execute! (StrengthOf (Concept "A")))
(cog-execute! (ConfidenceOf (Concept "A")))

See also