Skip to content

Downdate conditions

A downdate_condition is a child of a goal. When its condition is satisfied, TDM may retire (downdate) the goal. Downdating means removing the goal from active processing; it does not necessarily mean that the goal succeeded. Multiple conditions on one goal are alternatives: any one true condition is sufficient.

Syntax

<goal type="perform" action="book_room">
  <plan>
    <invoke_service_action name="BookRoom"/>
  </plan>
  <downdate_condition>
    <in_beliefs_or_commitments>
      <service_action_terminated name="BookRoom"/>
    </in_beliefs_or_commitments>
  </downdate_condition>
</goal>

The child of downdate_condition is a normal condition expression. It can be a predicate/value condition, an in_* proposition condition, a value test, or a Boolean composition. Each condition is evaluated against the active TIS.

Service actions: termination is not success

TDM records service_action_terminated whenever an invoked service action returns, including when its result is unsuccessful. With postconfirm, the termination proposition is stored in private beliefs; without it, it is stored in shared commitments. in_beliefs_or_commitments checks both locations. Therefore, this condition means “the service call ended,” not “the operation succeeded.”

The old invoke_service_action/@downdate_plan attribute does not create an implicit downdate condition. It is retained by the XML/JSON models for compatibility; author an explicit condition for current behavior.

Downdate and cleanup behavior

TDM also downdates a perform/resolve goal when the corresponding action or question status is committed. Cleanup depends on the path: a resolve goal retired through an aborted-status/explicit-condition path may simply be removed without running its postplan or clearing condition facts. For paths that perform condition cleanup, in_* conditions identify propositions to clear from the corresponding TIS store; Boolean and/or conditions clean their satisfied branches. has_value checks predicate presence without identifying a specific proposition to remove, and not does not remove facts.

Although has_more_items is valid condition syntax and can be evaluated in an if, TDM revision f555673fec31 does not handle it during downdate cleanup and direct use as a goal downdate condition can raise an exception. Do not use it directly for downdating without verifying the target TDM revision.

The XML schema retains <postcond> as a compatibility form. New DDDs should use <downdate_condition>.

Tala sources and examples

  • Schema/compiler: tala/ddd/schemas/domain.xsd, tala/ddd/ddd_xml_compiler.py
  • Goal-to-condition mapping: tala/model/domain.py
  • Tala tests: tala/ddd/test/test_ddd_xml_compiler.py and tala/model/test/test_domain.py

See also Conditions.