###### 2.1.4.4.3 Conref and generalization for constraint modules

When documents use different constraints, conref and generalization processors may examine the @domains to verify compatibility between the document instances.

###### Conref compatibility with constraints

To determine compatibility between two document instances, a conref processor can check the @domains attribute to confirm that

- The referencing document has a superset of the vocabulary modules in the referenced document.
- For each vocabulary module in the referenced document, the referencing document qualifies the common module with a subset of the constraints in the referenced document.

Some examples:

Referencing | Referenced | Resolution
(topic) | (topic shortdescReq-c) | Allowed - content model of referenced topic is more constrained
(topic shortdescReq-c) | (topic) | Prevented - content model of referenced topic is less constrained
(topic hi-d) | (topic hi-d basicHighlight-c) | Allowed - domain extension list of referenced document type shell is more constrained
(topic hi-d basicHighlight-c) | (topic hi-d) | Prevented - domain extension list of referenced document type shell is less constrained.
(topic hi-d) | (topic noBasePhrase-c) (topic hi-d) | Allowed - referencing document type shell doesn't replace base element with domain extensions.
(topic noBasePhrase-c) (topic hi-d) | (topic hi-d) | Prevented - referencing document type shell does replace base element with domain extensions.
(topic task) (topic hi-d basicHighlight-c) | (topic simpleSection-c task simpleTaskSection-c) | Allowed - referencing shell has a subset of the constraints of the referenced shell on the common vocabulary modules.
(topic shortdescReq-c task shortdescTaskReq-c) (topic hi-d basicHighlight-c) | (topic simpleSection-c task simpleTaskSection-c) | Prevented - referencing shell has constraints on common vocabulary modules that aren't in the referenced shell.

###### Generalization and constraints

Similarly, to determine compatibility between a document instance and a target document type, a generalization processor can use the @domains and @class attributes for the document instance and the @domains attribute for the target document type to determine how to rename elements in the document instance. For each element instance, the generalization processor:

- Iterates over the @class attribute on the element instance from specific to general, inspecting the vocabulary modules.
- Looks for the first vocabulary module that is both present in the target document type and that has a subset of the constraints in the document instance.

  If a module is found in the target document type, that module becomes the minimum threshhold for the generalization of contained element instances.

  If a module is not found, the document instance cannot be generalized to the target document type and, instead, can only be generalized to a less constrained document type.

Note that a document instance can always be converted from a constrained document type to an unconstrained document type merely by switching the binding of the document instance to the less restricted schema (which would also have a different @domains attribute declaration). No renaming of elements is needed to remove constraints.

Previous Topic: 2.1.4.4.2 Constraint module XSD coding requirements

Next Topic: 2.1.4.4.4 Examples of constraint declaration modules

Parent Topic: 2.1.4.4 Constraints

Sibling Topics:

2.1.4.4.1 Constraint module DTD coding requirements

2.1.4.4.2 Constraint module XSD coding requirements

2.1.4.4.4 Examples of constraint declaration modules