Ontology XML reference¶
Baseline: Tala 31.0.1. An ontology gives domain plans and semantic interpretations their typed vocabulary: sorts, predicates, individuals, and actions.
Structure¶
ontology is the document root and requires a name. It can contain any number of these declarations:
<ontology name="RoomBookingOntology">
<sort name="room_type"/>
<predicate name="room_date" sort="datetime"/>
<predicate name="selected_room" sort="room_type" multiple_instances="false"/>
<individual name="single" sort="room_type"/>
<action name="book_room"/>
</ontology>
| Declaration | Required attributes | Optional attributes |
|---|---|---|
sort | name | dynamic |
predicate | name, sort | feature_of, multiple_instances |
individual | name, sort | — |
action | name | — |
Tala 31.0.1 has these built-in sort names: boolean, integer, datetime, real, string, image, domain, webview, and person_name. Declare application-specific sorts in the ontology before using them in predicates or individuals. XML Boolean attributes use lowercase true/false.
Sorts and individuals¶
A sort is the ontology's value type. Custom sorts can be marked dynamic="true" when the running domain must introduce individuals not declared as static entries. Individuals pair a name with a sort; their values are subsequently checked and normalized according to that sort.
<sort name="room_type"/>
<sort name="album_name" dynamic="true"/>
<individual name="single" sort="room_type"/>
integer, real, boolean, datetime, and person_name have corresponding Tala value normalization. image, webview, and domain are also built-in sorts; inspect their semantic model when defining values for those types.
Predicates and actions¶
A predicate names a property and the sort of its value. feature_of associates a predicate with a parent predicate, as used by question-feature behavior. multiple_instances="true" allows multiple values for the predicate in domains that need a set of alternatives.
<predicate name="selected_room" sort="room_type" multiple_instances="true"/>
<predicate name="room_capacity" sort="integer" feature_of="selected_room"/>
<action name="book_room"/>
Predicate names are used in proposition expressions and DDD question/condition elements. Action names are used by perform goals and service invocations. A service-interface operation name (for example BookRoom) is a separate name; declare the semantic action (book_room) and service operation independently.
References and validation¶
Domain goals and propositions refer to ontology action and predicate names. Tala compiles the ontology first and uses it while compiling the domain, so unknown names or incompatible values can fail DDD loading even when XML is well-formed.
- Structure:
tala/ddd/schemas/ontology.xsd - DDD JSON schema:
tala/ddd/schemas/json/ontology.schema.json - Compiler/model:
tala/ddd/ddd_xml_compiler.py,tala/model/ontology.py,tala/model/sort.py, andtala/model/predicate.py