Soar::WM::Element - Work with Soar working memory elements
use Soar::WM qw(wm_root); my $root = wm_root(<<ENDWM); (S1 ^foo bar ^foo buzz ^baz boo ^link S2 ^link S3) (S2 ^faz far ^boo baz ^fuzz buzz) (S3 ^junk foo) ENDWM print $root->id; # 'S1' my $val = $root->first_val('link'); print $val->id; # 'S2' print $val->first_val('faz'); # 'far'
This module allows one to traverse working memory by accessing attributes and values of a single element at a time.
Soar::WM::Element - Perl extension for representing Soar working memory elements.
Creates a new instance of Soar::WM::Element. There are two required arguments: 1. An instance of Soar::WM which is to contain this element 2. The WME ID of this element. If the given ID does not exist in the given working memory, this method will croak.
Returns the WME ID of the this element ('S1', 'W3', etc.)
Returns an array pointer containing the attributes present in this element.
Takes one required argument, an attribute name, and returns an array pointer containing all of the values of the given attribute for this element. Any values that are names of other working memory elements will be blessed as new Soar::WM::Elements.
The same as vals, but returns the value of every attribute as an array pointer. The optional parameter 'links_only => 1' will cause the method to only return children which are links to other Soar::WM::Elements.
Takes one required argument, an attribute name, and returns the first value of the given attribute for this element. If the values is the names of another working memory element, it will be blessed as a new Soar::WM::Element.
Returns the number of values in all of this element's attributes which are names of other existing working memory elements.
The homepage for the Soar cognitive architecture is here: http://sitemaker.umich.edu/soar/home.
Nathan Glenn <firstname.lastname@example.org>
This software is copyright (c) 2012 by Nathan Glenn.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.