Skip to content
This repository has been archived by the owner on Oct 5, 2023. It is now read-only.

Latest commit

 

History

History
71 lines (50 loc) · 2.3 KB

cmd_add_wme.wiki

File metadata and controls

71 lines (50 loc) · 2.3 KB

  1. summary add-wme command documentation

Table of Contents

add-wme

Manually add an element to working memory.

Synopsis

Default Aliases

|| `aw` || `add-wme` ||

Options

|| `id` || Must be an existing identifier. || || `^` || Leading `^` on attribute is optional. || || `attribute` || Attribute can be any Soar symbol. Use `*` to have Soar create a new identifier. || || `value` || Value can be any soar symbol. Use `*` to have Soar create a new identifier. || || `+` || If the optional preference is specified, its value must be `+` (acceptable). ||

Description

Manually add an element to working memory. add-wme is often used by an input function to update Soar's information about the state of the external world.

add-wme adds a new wme with the given id, attribute, value and optional preference. The given id must be an existing identifier. The attribute and value fields can be any Soar symbol. If `*` is given in the attribute or value field, Soar creates a new identifier (symbol) for that field. If the preference is given, it can only have the value `+` to indicate that an acceptable preference should be created for this wme.

Note that because the id must already exist in working memory, the WME that you are adding will be attached (directly or indirectly) to the top-level state. As with other WME's, any WME added via a call to add-wme will automatically be removed from working memory once it is no longer attached to the top-level state.

Examples

This example adds the attribute/value pair `^message-status received` to the identifier (symbol) S1:

This example adds an attribute/value pair with an acceptable preference to the identifier (symbol) Z2. The attribute is `message` and the value is a unique identifier generated by Soar. Note that since the `^` is optional, it has been left off in this case.

Warnings

Be careful how you use this command. It may have weird side effects (possibly even including system crashes). For example, the chunker can't backtrace through wmes created via add-wme nor will such wmes ever be removed thru Soar's garbage collection. Manually removing context/impasse wmes may have unexpected side effects.

See Also

[cmd_remove_wme]