DDD JSON¶
DDD JSON supports a bundle or separate component files. Component objects use explicit names and arrays rather than XML attribute bags.
Bundle and component roots¶
A bundle can be unwrapped or wrapped by a ddd key:
{
"schema_version": "1.0",
"ontology": {
"name": "RoomBookingOntology",
"sorts": [{"name": "room_type"}],
"predicates": [{"name": "room_date", "sort": "datetime"}],
"individuals": [],
"actions": ["book_room"]
},
"domain": {
"name": "RoomBookingDomain",
"plans": [{
"goal": {"perform": {"action": "book_room"}},
"content": [
{"findout": {"question": {"wh": {"predicate": "room_date"}}}},
{"invoke_service_action": {"name": "BookRoom"}}
],
"downdate_conditions": [{
"in_beliefs_or_commitments": {
"service_action_terminated": {"name": "BookRoom"}
}
}]
}]
},
"service_interface": {
"actions": [{
"name": "BookRoom",
"target": {"http": {"endpoint": "https://service.example/book-room"}},
"parameters": [{"predicate": "room_date"}],
"failure_reasons": ["unavailable"]
}],
"queries": [],
"validators": []
}
}
Each component may be stored separately with a root key: ontology, domain, or service_interface. Tala's ddd.config.json selects a bundle via ddd_bundle, or component files via ddd_files; ddd_bundle takes precedence when both settings are present.
Domain JSON concepts¶
The domain object contains ordered plans. A plan has a goal and ordered content array, and may have postplan where allowed. The JSON schema and compiler accept postplans on both perform and resolve goals, despite older descriptive guidance that suggests resolve goals only. Runtime execution still depends on the goal-completion path (see Plans and postplans). Goals use {"perform": {"action": "..."}} or {"resolve": {"question": ...}}. Questions use tagged objects such as wh, yn, kpq, or alt. A condition and each plan item use a single-key object, for example {"not": {...}} or {"findout": {...}}.
downdate_conditions is the JSON spelling for explicit plan downdating. The downdate_plan field remains in the JSON schema for compatibility but does not create implicit DME downdating.
Forgetting an action status¶
This syntax was added in Tala 31.3.0. The DME deployment must use Tala 31.3.0 or later to compile DDDs that use it; a newer authoring baseline alone does not guarantee runtime support.
The forget and forget_shared plan items can target a specific action-status fact. Declare the action in the ontology. For example, to forget a completed book_room action:
Use forget to remove the fact from private beliefs and shared commitments, or forget_shared to remove it from shared commitments only:
The compiler has a limitation for non-WH question types on domain queries: the JSON-to-XML conversion writes type, while XML compilation reads question_type. WH queries use the default and work as expected; do not rely on other query question types without verifying the compiled result.
Validation and loading¶
The Draft 2020-12 DDD JSON schemas are under tala/ddd/schemas/json/. Tests check the schemas against real fixtures and test bundle wrappers. DDDJSONCompiler converts DDD JSON to XML and passes it through the XML compiler; schema validity alone is not a substitute for compiler/loader tests.
The compiler also retains an XML-shaped structural JSON form using keys such as @, attrs, children, and items. Prefer the named component format for new DDDs; use structural JSON only when maintaining data that already depends on that compatibility form.
# From the Tala repository root:
source ~/python_3_11_environment/bin/activate
pytest tala/ddd/test/test_ddd_json_schemas.py
pytest tala/ddd/test/test_ddd_json_compiler.py
Keep DDD JSON distinct from JSON:API serialization of compiled DDD model objects. JSON:API has data/included resources and is used for runtime model interchange, not as DDD definition syntax.