Am Mittwoch, 6. Mai 2020 18:42:33 UTC+1 schrieb linas: > > I think you are mis-using the StateLink. The intent of the StateLink is to > force an atomic one-and-only-one "membership", ever. Thus the example > (State (Concept "traffic light") (Concept "red")) means that "traffic > light" can only have one color at a time, whereas lots of things can be > red. It's not symmetric -- only the first atom is the thing that has the > state. (Its also atomic, and can be accessed in multiple threads in a > consistent, thread-safe manner) >
I'm aware. Let's say you have two traffic lights, each can only have one state/color at a time, but there are multiple traffic lights which can have the same color. (State (Concept "first traffic light") (Concept "red")) (State (Concept "second traffic light") (Concept "green")) You can count number of items in a link with ArityLink > > scheme@(guile-user)> (use-modules (opencog) (opencog exec)) > scheme@(guile-user)> (cog-execute! (Arity (Set (Concept "A") (Concept > "B")))) > (NumberNode "2") > > (cog-evaluate! (GreaterThan (Arity (Set (Concept "A") (Concept "B"))) > (Number 1))) > (stv 1.000000 1.000000) > Good to know, but that wasn't the goal. I want to check whether a specific traffic light is red. I can get all the traffic lights that are red with a getlink, but they'll be wrapped in a setlink, so I can't compare the set of many against my one traffic light node...unless I can check for something being an element of a setlink. Best, Alex -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/opencog/ed7a3675-7669-4cb1-95ca-d1382fd29a02%40googlegroups.com.
