Hi,
The answer is simple: Since you are looking for inheritance links of a
particular structure, it will return everything it finds, having that
particular structure, and the $denizen variable fits the structure, and so
its reported.
If you do NOT want to see that, and see only the cncept nodes, then replace
the bare (VariableNode "$animal") declaration with
this:
(TypedVariable
(VariableNode "$animal")
(VariableType "ConceptNode"))
This will return ONLY the concept nodes. There is a wiki page on both
VariableType and TypedVariable that gives more details
--linas
On Sun, Jul 17, 2016 at 10:26 AM, Gaurav Gautam <[email protected]>
wrote:
> Hello,
>
> I was adding some things to the third lesson in Hands_On_With_OpenCog when
> I came across this.
> I have attached the guile script to this post so you can look at the whole
> thing.
>
> I used cog-bind to perform a graph-rewrite to do the following:
> 1. Look for all atoms that are types of Animals
> 2. Create a new InheritanceLink to mark all such nodes as Pets
>
> ;The BindLink
> (define rewrite
> (BindLink
> ;Declare the variables [optional]
> (VariableNode "$denizen")
> ;Declare the pattern used to ground the variables
> (InheritanceLink
> (VariableNode "$denizen")
> (ConceptNode "Animal")
> )
> ;If a match is found for the pattern then we want
> ;to add the following hypergraph ot the Atomspace
> (InheritanceLink
> (VariableNode "$denizen")
> (ConceptNode "Pet")
> )
> )
> )
>
> The output of bind-link is as expected:
> (SetLink
> (InheritanceLink
> (ConceptNode "fish")
> (ConceptNode "Pet")
> )
> (InheritanceLink
> (ConceptNode "dog")
> (ConceptNode "Pet")
> )
> (InheritanceLink
> (ConceptNode "cat")
> (ConceptNode "Pet")
> )
> )
>
> But when I run a cog-satisfying-set query to look for all pets in the
> Atomspace I find that a new Pet has been defined
> with the name "$denizen".
> The pattern I use for cog-satisfying-set is:
> (define petnode
> (SatisfactionLink
> ;Declare varibales [optional]
> (VariableNode "$animal")
> ;The pattern that the variable must satisfy
> (InheritanceLink
> (VariableNode "$animal")
> (ConceptNode "Pet")
> )
> )
> )
>
> The output is:
> (SetLink
> (ConceptNode "fish")
> (ConceptNode "dog")
> (ConceptNode "cat")
> (VariableNode "$denizen") <--- This is the thing I don't understand
> )
>
> Is this the expected behavior for bind-link? I thought that the "$denizen"
> VariableNode is never entering the Atomspace. Is this untrue?
>
> Yours sincerely
> Gaurav Gautam
>
> --
> 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/620e1bc1-841e-4ae3-ad07-bc01294b06dd%40googlegroups.com
> <https://groups.google.com/d/msgid/opencog/620e1bc1-841e-4ae3-ad07-bc01294b06dd%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
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/CAHrUA37ZPusQ9qL%3DUa-Nci-cJbZ3yzg2kXxTvQ7%2BQ%2BoS747J5w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.