Hi guys,
I'm somewhat confused regarding the results of this experiment. Am I doing
something wrong or are there bugs responsible for the results?
It seems to me like (NotLink (PresentLink ..)) doesn't produce the correct
results,
(NotLink (AndLink (PresentLink ...))) produces the same results. (AndLink
(NotLink (PresentLink)) doesn't produce any results and neither does
(AbsentLink ...).
I hope you can help me understand this.
Best regards and stay safe in these corona times,
Alex
The output:
hungry people
expected: (SetLink (ConceptNode "me"))
(SetLink (ConceptNode "me"))
not hungry people (NotLink (PresentLink ...) )
expected: (SetLink (ConceptNode "you") (ConceptNode "hungry"))
(SetLink (ConceptNode "you") (ConceptNode "hungry") (ConceptNode "me"))
not hungry people (AndLink (NotLink (PresentLink ...)))
expected: (SetLink (ConceptNode "you") (ConceptNode "hungry"))
(SetLink)
not hungry people (NotLink (AndLink (PresentLink ...)))
expected: (SetLink (ConceptNode "you") (ConceptNode "hungry"))
(SetLink (ConceptNode "you") (ConceptNode "hungry") (ConceptNode "me"))
not hungry people (AbsentLink ...)
expected: (SetLink (ConceptNode "you") (ConceptNode "hungry"))
(SetLink)
The code (also attached):
atomspace = AtomSpace()
initialize_opencog(atomspace)
me = ConceptNode("me")
you = ConceptNode("you")
hungry = ConceptNode("hungry")
StateLink(me, hungry)
query = GetLink(
TypedVariableLink(VariableNode("someone"),
TypeNode("ConceptNode")),
PresentLink(StateLink(VariableNode("someone"), hungry)))
who_is_hungry = execute_atom(atomspace, query)
print("\nhungry people")
print('expected: (SetLink (ConceptNode "me"))')
print(who_is_hungry)
query1 = GetLink(
TypedVariableLink(VariableNode("someone"),
TypeNode("ConceptNode")),
NotLink(PresentLink(StateLink(VariableNode("someone"),
hungry))))
who_isnt_hungry1 = execute_atom(atomspace, query1)
print("\nnot hungry people (NotLink (PresentLink ...) )")
print('expected: (SetLink (ConceptNode "you") (ConceptNode "hungry"))')
print(who_isnt_hungry1)
query2 = GetLink(
TypedVariableLink(VariableNode("someone"),
TypeNode("ConceptNode")),
AndLink(NotLink(PresentLink(StateLink(VariableNode("someone"), hungry)))))
who_isnt_hungry2 = execute_atom(atomspace, query2)
print("\nnot hungry people (AndLink (NotLink (PresentLink ...)))")
print('expected: (SetLink (ConceptNode "you") (ConceptNode "hungry"))')
print(who_isnt_hungry2)
query3 = GetLink(
TypedVariableLink(VariableNode("someone"),
TypeNode("ConceptNode")),
NotLink(AndLink(PresentLink(StateLink(VariableNode("someone"), hungry)))))
who_isnt_hungry3 = execute_atom(atomspace, query3)
print("\nnot hungry people (NotLink (AndLink (PresentLink ...)))")
print('expected: (SetLink (ConceptNode "you") (ConceptNode "hungry"))')
print(who_isnt_hungry3)
query4 = GetLink(
TypedVariableLink(VariableNode("someone"),
TypeNode("ConceptNode")),
AbsentLink(StateLink(VariableNode("someone"), hungry)))
who_isnt_hungry4 = execute_atom(atomspace, query4)
print("\nnot hungry people (AbsentLink ...)")
print('expected: (SetLink (ConceptNode "you") (ConceptNode "hungry"))')
print(who_isnt_hungry4)
--
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/8120ee46-6bf0-4b11-a72b-24e072acd218%40googlegroups.com.
#!/usr/bin/env python
from opencog.type_constructors import *
from opencog.bindlink import execute_atom, evaluate_atom
from opencog.utilities import initialize_opencog
from opencog.atomspace import AtomSpace, types
from bdi.world_state import WorldState
from bdi.knowledge_base import KnowledgeBase
from bdi.intention_recognition import IntentionRecognition
if __name__ == "__main__":
atomspace = AtomSpace()
initialize_opencog(atomspace)
me = ConceptNode("me")
you = ConceptNode("you")
hungry = ConceptNode("hungry")
StateLink(me, hungry)
query = GetLink(
TypedVariableLink(VariableNode("someone"), TypeNode("ConceptNode")),
PresentLink(StateLink(VariableNode("someone"), hungry)))
who_is_hungry = execute_atom(atomspace, query)
print("\nhungry people")
print('expected: (SetLink (ConceptNode "me"))')
print(who_is_hungry)
query1 = GetLink(
TypedVariableLink(VariableNode("someone"), TypeNode("ConceptNode")),
NotLink(PresentLink(StateLink(VariableNode("someone"), hungry))))
who_isnt_hungry1 = execute_atom(atomspace, query1)
print("\nnot hungry people (NotLink (PresentLink ...) )")
print('expected: (SetLink (ConceptNode "you") (ConceptNode "hungry"))')
print(who_isnt_hungry1)
query2 = GetLink(
TypedVariableLink(VariableNode("someone"), TypeNode("ConceptNode")),
AndLink(NotLink(PresentLink(StateLink(VariableNode("someone"), hungry)))))
who_isnt_hungry2 = execute_atom(atomspace, query2)
print("\nnot hungry people (AndLink (NotLink (PresentLink ...)))")
print('expected: (SetLink (ConceptNode "you") (ConceptNode "hungry"))')
print(who_isnt_hungry2)
query3 = GetLink(
TypedVariableLink(VariableNode("someone"), TypeNode("ConceptNode")),
NotLink(AndLink(PresentLink(StateLink(VariableNode("someone"), hungry)))))
who_isnt_hungry3 = execute_atom(atomspace, query3)
print("\nnot hungry people (NotLink (AndLink (PresentLink ...)))")
print('expected: (SetLink (ConceptNode "you") (ConceptNode "hungry"))')
print(who_isnt_hungry3)
query4 = GetLink(
TypedVariableLink(VariableNode("someone"), TypeNode("ConceptNode")),
AbsentLink(StateLink(VariableNode("someone"), hungry)))
who_isnt_hungry4 = execute_atom(atomspace, query4)
print("\nnot hungry people (AbsentLink ...)")
print('expected: (SetLink (ConceptNode "you") (ConceptNode "hungry"))')
print(who_isnt_hungry4)