Can I use TypedVariableLinks to specify InheritanceLinks of particular kinds in Bindlink's variable list?

14 views
Skip to first unread message

Gaurav Gautam

unread,
Jul 6, 2016, 4:12:27 AM7/6/16
to opencog
Hello,

As far as I understand, the optional variables list in BindLink can be filled with TypedVariableLinks
whereupon only nodes of that type are used to ground that variable.

I want to know what I should do if I want to ground a pattern with particular types of InheritanceLinks instead of
particular types of nodes. Do I have to write the code to do such things or does it exist already? Is this even possible?
I realize this is vague so I am providing an example program that I want to make work.

I have a scheme program below that has a BindLink, which has two variables $man and
$color. I want to make cog-bind! look for InheritanceLinks in atomspace and ground $color with those
links that have the base ConceptNode "Color"(namely C1). And similarly I want it to ground the $man with the
appropriate InheritanceLink(namely P1).

(define C1
        (InheritanceLink
                 (ConceptNode "Red")
                 (ConceptNode "Color")
        )
)

(define C2
       (ConceptNode "Blue")
)

(define P1
       (InheritanceLink
                 (ConceptNode "British")
                 (ConceptNode "Man")
       )
)

(define question
       (BindLink
             
              ;Variable list
              (What do I put here to only match only P1 with "$man" and C1 with "$color"?)
             
              ;Pattern
              (EvaluationLink (stv 1 1)
                       (PredicateNode "LivesIn")
                       (ListLink
                                (VariableNode "$man")
                                (VariableNode "$color")
                       )
               )
              
               ;Return Value
               (EvaluationLink (stv 1 1)
                       (PredicateNode "CanLiveIn")
                       (ListLink
                                (VariableNode "$man")
                                (VariableNode "$color")
                       )
               )
       )
)

(cog-bind! question)


Yours sincerely
Gaurav Gautam

Linas Vepstas

unread,
Jul 6, 2016, 3:52:19 PM7/6/16
to opencog
Add to the pattern

  (InheritanceLink 
                 (VariableNode "$color")
                 (ConceptNode "Color")
        )

and
InheritanceLink
                 (ConceptNode "British")
                 (VariableNode "$man")
       )


--
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 opencog+u...@googlegroups.com.
To post to this group, send email to ope...@googlegroups.com.
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/08cbd232-9817-4753-b7ad-217b4de61e5b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages