Link Wme

3 views
Skip to first unread message

John Finnson

unread,
Jul 13, 2010, 12:46:41 PM7/13/10
to jsoar...@googlegroups.com
Hi, quick beginner question:

What exactly does InputBuilder.link do? And how do I use it? What is a link wme?

I found that the javadoc was insufficient and could not find documentation on link wmes through Soar sources.

Thanks in advance.

--
Sincerely,
John Finnson

Dave Ray

unread,
Jul 13, 2010, 1:06:05 PM7/13/10
to jsoar...@googlegroups.com
Hi John,

With the input builder, the add() and push() methods both create a wme
with a new value. In the case of push() a new identifer is created.
So, for example:

builder.push("location")

creates a wme like this:

(I2 ^location L1)

where L1 is a newly generated identifier. You could achieve the same
thing (without pushing down a level) with:

builder.add("location", Symbols.NEW_ID)

The link() method allows you to create a wme whose value is an
existing identifier rather than a newly generated one. To do so, you
have to first mark an identifier with markId(). So, if you wanted to
create a graph structure like this:

(I2 ^location L1)
(I2 ^current L1)

i.e. two WMEs both pointing to L1, you'd do something like this:

builder.push("location").markId("L") // create L1 and mark it
// add stuff to location here
.pop()
.link("current", "L") // create current wme

Note that the formatting is just to make the structure a little more readable.

Does this help? This is included in the Javadoc for the InputBuilder
class, but the example is larger so it may not be as clear that it's
there.

Dave

> --
> You received this message because you are subscribed to the Google Groups
> "jsoar-user" group.
> To post to this group, send email to jsoar...@googlegroups.com.
> To unsubscribe from this group, send email to
> jsoar-user+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/jsoar-user?hl=en.
>

Reply all
Reply to author
Forward
0 new messages