Hi Tareq,

Currently, the only way to do this is is to write two different patterns,
one that searches for three words, and one that searches for two.

Another possibility is to use a GlobNode instead of a VariableNode, this
will accept sequences of neighboring words, as one.  However, this might
not be what you want: the output of a glob is a list.

You do ask an interesting question: it would be nice to have this kind of
matching.  Currently, VariableNode must match exactly one item, and
GlobNode must match one or more.   A "MaybeNode" that matches zero or one,
and a "StarNode" that matches zero or more could be useful.  .. But these
don't exist, yet.  Might not be hard to add ...

--linas



On Fri, Oct 28, 2016 at 2:47 AM, Tareq Alkhaldi <tareq.alkha...@gmail.com>
wrote:

> Hi all,
>
> Is there a way to use the PM to match a partial list as the following?
>
> Atomspace has this:
>
> (EvaluationLink
>     (PredicateNode "pulled@463a5d30-1733-48bc-b188-cb1fcd1d3ee0")
>     (ListLink
>         (ConceptNode "James@c597a7ec-60ab-429d-b003-4782200c7a91")
>         (ConceptNode "pudding@f797c773-b58a-4136-8bad-74b4ad399c63")
>         (ConceptNode "all@3f71ac77-ef99-4499-883d-2ae3332fdb6a")  ;;;;;
> This may or may not exist
>     )
> )
>
> Pattern I want to match is:
>
> (BindLink
>   (VariableList
>      (VariableNode "$X")
>      (VariableNode "$Y")
>   )
>
>   (EvaluationLink
>      (VariableNode "$X")
>      (ListLink
>         (ConceptNode "James@6c0671a2-1b11-4dd9-a787-d27d7779a0c8")
>         (VariableNode "$Y")
>      )
>   )
>   (VariableNode "$Y")
> )
>
> How can I match that without having to add another variable after "$Y" in
> the list, knowing that the (ConceptNode "all@...") may not always be
> there.
>
> Can this be done?
>
> Thanks
>
> --
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to opencog@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/764c3a00-c443-46ed-9d05-7aa11ddb4cb8%40googlegroups.com
> <https://groups.google.com/d/msgid/opencog/764c3a00-c443-46ed-9d05-7aa11ddb4cb8%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 opencog+unsubscr...@googlegroups.com.
To post to this group, send email to opencog@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/CAHrUA36ZoEyDERjT2YpQLQ%3DQcUtKMCwTLZ1LmN9YZH%3D9_FzZ6w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to