The StrengthOfLink and ConfidenceOfLink are a executable Links that returns a numeric value when executed: they returns a single floating-point number, the strength/confidence of the TruthValue of the atom that they wrap. They are useful for representing numeric computations with TruthValues, and then actually performing that computation, when executed.
If the wrapped atom is evaluatable, then it is evaluated first, so as to obtain a truth value.
It is straight-forward to obtain the TruthValue of a constant Atom:
(use-modules (opencog) (opencog exec)) (Concept "foo" (SimpleTruthValue 0.6 0.3)) (cog-execute! (StrengthOf (Concept "foo"))) (cog-execute! (ConfidenceOf (Concept "foo")))
Numeric computations are possible with the returned values:
Arguments are evaluated before the TruthValue is accessed:
Tutorials and additional examples can be found in the /examples directory.