Conditions¶
Conditions are expressions evaluated against the TDM Information State. In Tala 31.0.1 they appear in if plan items and inside a goal's downdate_condition.
Definitions¶
<has_value predicate="p"/>
<has_shared_value predicate="p"/>
<has_private_value predicate="p"/>
<in_shared_commitments predicate="p" value="x"/>
<in_private_beliefs predicate="p" value="x"/>
<in_beliefs_or_commitments predicate="p" value="x"/>
<has_more_items predicate="p"/>
<has_more_items iterator="i"/>
<and>
<has_value predicate="p"/>
<not><in_private_beliefs predicate="p" value="x"/></not>
</and>
Conditions can be nested inside other conditions. They do not have standalone effects: they select an if branch or determine whether a goal may be downdated.
Condition forms¶
| Form | True when |
|---|---|
has_value | The predicate occurs in shared commitments or private beliefs. |
has_shared_value | The predicate occurs in shared commitments. |
has_private_value | The predicate occurs in private beliefs. |
in_shared_commitments | The specified proposition is in shared commitments. |
in_private_beliefs | The specified proposition is in private beliefs. |
in_beliefs_or_commitments | The specified proposition is in either store. |
has_more_items | A domain query enumeration or named iterator has more items. |
and, or, not | Boolean combinations of nested condition expressions. |
The XML attributes are:
| Attribute | Applies to | Meaning |
|---|---|---|
predicate | has_*_value; attribute form of in_*; predicate-form has_more_items | Ontology predicate whose fact/value is checked. |
value | Attribute form of in_* | Individual value. Omit it only for a nullary predicate. |
iterator | Iterator-form has_more_items | Iterator whose remaining values are checked. |
has_value, has_shared_value, and has_private_value require a predicate attribute. For in_*, predicate is used with the optional value attribute or a child proposition instead.
has_*_value tests whether a predicate has any stored value; it does not test for one particular value. For in_*, the proposition may be supplied by predicate/value attributes or as a child proposition. Child forms supported by the Tala 31.0.1 compiler include predicate propositions, perform, resolve, service_action_started, service_action_terminated, action_status, question_status, resolved, and know_answer.
Parents and children¶
- Parent expressions:
ifanddowndate_condition. andandorcontain one or more condition expressions;notcontains exactly one.in_*conditions contain at most one proposition child.
Attribute and child forms¶
Attribute form for a predicate/value proposition:
For a nullary predicate, omit value. For non-nullary predicates, provide a value of the ontology-declared sort.
Scope-specific value checks:
<has_value predicate="flight_status"/>
<has_shared_value predicate="flight_status"/>
<has_private_value predicate="flight_status"/>
<in_private_beliefs predicate="flight_status" value="late"/>
<in_beliefs_or_commitments predicate="flight_status" value="late"/>
has_value checks both shared commitments and private beliefs. The other has_*_value variants test their named store.
Child form for a service-action termination proposition:
<in_beliefs_or_commitments>
<service_action_terminated name="BookRoom"/>
</in_beliefs_or_commitments>
Child form for a perform goal proposition:
The service_action_terminated example checks only that the service call terminated, not whether it succeeded; see Invoke service action.
Boolean composition¶
and and or take one or more nested conditions. not takes exactly one.
<and>
<has_value predicate="destination"/>
<not>
<in_private_beliefs predicate="destination" value="paris"/>
</not>
</and>
DDD JSON¶
The JSON representation uses a single-key object per condition:
{
"and": [
{"has_value": {"predicate": "destination"}},
{"not": {"in_private_beliefs": {"predicate": "destination", "value": "paris"}}}
]
}
The JSON schema and compiler also support or, in_* child propositions, has_more_items, and the other condition forms listed above.
has_more_items names either the predicate queried by a domain enumeration or the iterator:
<has_more_items predicate="possible_destination"/>
<has_more_items iterator="destination_iterator"/>
Tala reference and tests¶
- XML condition grammar and child proposition forms:
tala/ddd/schemas/domain.xsd - XML compilation:
tala/ddd/ddd_xml_compiler.py - Truth evaluation:
tala/model/condition.py - Tala tests:
tala/ddd/test/test_ddd_xml_compiler.pyandtala/model/test/test_condition.py
See also Downdate conditions.