Hi Johannes, (cog-number (Number 3))
Amen B. On Friday, December 28, 2018 at 2:57:27 AM UTC+8, Johannes Castner wrote: > > Hi Nil, > > Is there a way to get the value from a NumberNode? In other words, can I > get the 4 out of (NumberNode 4)? I need to do some other, quite general > intermediate calculations and then produce another NumberNode; how do I > best do that? > > Johannes > >> >> There are different ways to do that, and they depend on what you >> intend to do with the knowledge. One way would be to use value >> >> https://wiki.opencog.org/w/Value >> >> for instance to attach a score of 3 to John, you'd say >> >> ``` >> (define john (Concept "John")) >> (define score (Concept "score")) >> (cog-set-value! john score (Number 3)) >> ``` >> >> then you may ask John's score with >> ``` >> (cog-value john score) >> ``` >> which will return 3. >> >> Later on you may update John's score with >> ``` >> (cog-set-value! john score (Number 4)) >> ``` >> >> And >> ``` >> (cog-value john score) >> ``` >> which will return 4. >> >> The problem with that (and with mutability in general) is that you >> lose information. So for instance you won't be able to use reasoning >> or specialized forms thereof like pattern mining to analyze the >> evolution of your data. For that you need to keep track of these >> updates. One way could be to use AtTimeLink, so for instance you way >> write that at 10pm John had a score of 3 >> >> AtTimeLink >> Evaluation >> Predicate "score-of" >> List >> (Concept "John") >> (Number 3) >> TimeNode "10pm" >> >> but at 11pm he had a score of 4 >> >> AtTimeLink >> Evaluation >> Predicate "score-of" >> List >> (Concept "John") >> (Number 4) >> TimeNode "10pm" >> >> Etc... There are many ways to represent knowledge. >> > -- You received this message because you are subscribed to the Google Groups "opencog" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/opencog. To view this discussion on the web visit https://groups.google.com/d/msgid/opencog/bffcb42c-3d92-44c5-9c63-89be73d38cd1%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
