Domain and topic integration (an architectural enhancement).
The problem: Currently, DITA has a notion of module inheritance. The elements defined within a module can only specialize elements defined in a single base module (or its base module, recursively). As a result, elements assigned to positions within content models can only be shared across modules by providing all of the shared elements in a base module.
Designers can encounter scenarios where a base type cannot be used to share vocabulary that has an assigned position within content models. As a result, designers must create many elements with different names for the same semantic, content, and processing, resulting in greater complexity, difficulty in reusing content fragments, and duplicate design, processing, and documentation.
The solution: Change the current notion of module inheritance into the more general notion of module dependency managed by the architecture, including dependencies on multiple modules.
That is, in this approach, elements defined within one module would continue to have inheritance relationships on elements defined in other modules. The modules themselves, however, would only have dependencies on other modules.
Note that other systems with hierarchical inheritance (notably Java) have had success with this same dependency-based approach for modular packaging.
Major – architectural.
Here are some examples of how this architectural enhancement would allow designers to create better document types:
Some content is common across javaClass and javaMethod. For instance, there is a need to identify the name of a Java class used as a base class within javaClass and as a method parameter, return value, or exception within javaOperation.
Because javaClass and javaOperation specialize from different topic types, however, they cannot share vocabulary for Java with assigned positions in content models. Thus, currently, two distinct javaClassClass and javaOperationClass elements would be needed for the same content.
With the enhancement, the javaClass topic type could depend on both the apiClassifier topic type and a javaName vocabulary domain. In turn, the javaMethod topic type could depend on the apiOperation topic type and also on the javaName vocabulary domain.
With the enhancement, the GUI task specialization could depend on both the task topic type and the existing UI vocabulary domain.
The module dependency approach doesn't alter the fundamental rules of specialization. The cardinal rule is that a specialized element can be substituted only for its base element and not for an unrelated element or an ancestor above its base element. For instance, a <glossarylist> specialized from <dl> would be able to contain <termhead> and <termentry> specializations only if those elements are direct specializations from the <dlhead> and <dlentry> elements. In addition, a <glossarylist> would only be possible to introduce into <dl> contexts.
What changes with this proposal is that the <glossarylist>, <termhead>, and <termentry> specializations can be provided by different modules. By virtue of containing <termhead> and <termentry>, <glossarylist> has a dependency on the modules that supply those elements. An invalid <glossarylist> (for instance, one in which <termhead> has to be generalized but not <glossarylist>) is impossible because any document type that would require generalization of <termhead> would also require generalization of <glossarylist>, and the base element for <termhead> can appear within the base element for <glossarylist>.
This enhancement changes the architecture as follows:
These positions can be restricted to topic specializations using the standard specialization mechanisms.
For instance, in a DTD implementation, the content model for the <topic> element would list the %topic; attribute after the <related-links> element so domain substitution could introduce specializations of the <topic> element.
A module has a direct dependency on every module that provides base elements from which it specializes. For example, if the elements provided in the javaClass module specialize from elements in the apClassifier and javaName modules, the javaClass module depends on the apClassifier and javaName modules.
The following example shows the dependencies attribute for the <javaClass> specialization of <topic>. The dependencies attribute indicates that the javaClass module depends on the apiClassifier and javaName modules, that the apiClassifier module depends on the reference and pr-d modules, and so on. Only the topic module has no dependencies.
<javaClass ...
dependencies="javaClass( apiClassifier javaName )
apiClassifier( reference pr-d )
javaName( pr-d )
reference( topic )
pr-d( topic )
topic( )">
Note that dependencies cannot be circular. For instance, it would be an error if the reference module depended on the javaClass module.
A validation utility could check the dependencies attribute against the class attributes to make sure that the dependencies attribute reflects every base relationship between modules.
The following table lists the basic possible configurations of dependencies. (Refer to the Use Case section for more explanation of the parenthetical examples.)
| Case | Depending module | Depended-on modules |
|---|---|---|
| 1 (valid in DITA 1) | topic |
1 topic |
| 2 (valid in DITA 1) | domain |
1 domain |
| 3 | topic |
1 topic and 1 domain |
| 4 | domain |
1 topic |
| 5 | domain |
2 domains |
Module dependencies would have the following impacts on DITA processing.
To determine whether the element is valid for the target document type, the generalization operation scans the class attribute from most to least specialized element until it finds a module that is supported by the target document type. The generalizer uses the element as the element name.
To find out which modules are valid in the target document type, the generalizer might look at the dependencies attribute for an existing instance of the target document type, look at an XML representation (such as XML Schema or Neko DTDx) of the validation grammar, or take a list of module names as input.
As noted above, any document type that forces generalization of an element also forces generalization of the container element (if necessary), so the generalized element is guaranteed to be valid in the position. That is, because this proposal doesn't change the rules of specialized substitution, generalization remains reliable.
This change is backward compatible for instances and processing:
DTD impact: Apply the design pattern for domains to topics.
Schema impact: Apply the design pattern for domains to topics.
By making it possible to use a single element in all contexts that have the same kind of content, this proposal has the following benefits:
Also, eliminating the distinction between topic and domain modules simplifies DITA overall because there are only modules.
Two days to refactor the existing DTDs. Note that this work overlaps with that needed to enable constraints (see issue 34).