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.
>