Reference vs. Extension Schema

The NIEM Naming and Design Rules version 5.0 defines two classes of conformant XML Schema documents: reference schema documents (REF) and extension schema documents (EXT). The following outlines the differences in NDR rules between REF and EXT schema documents.

Background

Beginning with NDR 3.0, NIEM XML schemas must declare themselves as either a reference schema document or an extension schema document through the use of the schema-level conformance targets attribute.

  • Reference schema document (REF): A schema document that is intended to provide the authoritative definitions of broadly reusable schema components. NIEM release schemas are REFs because they are intended for wide reuse.

  • Extension schema document (EXT): A schema document that is intended to provide definitions of schema components that are intended for reuse within a more narrow scope than those defined by a reference schema document. IEPD extension schemas are commonly EXTs so they can meet specific exchange requirements as needed, such as precise cardinality.

Conformance targets

REF and EXT schema documents have different conformance target identifiers. All REF and EXT schema documents must have a conformance target identifier, which tells readers of the schema what class of schema document it is. The conformance target identifiers are different for REF and EXT. These two rules identify the conformance target for each type of schema document.

Extension and restriction

REF schema documents must use xs:extension to derive complex types. EXT schema documents are allowed to use xs:restriction for complex types. These rules require xs:extension for REF schemas. EXT schema documents are allowed to use xs:extension and xs:restriction.

These rules ensure that REF and EXT have xs:sequence as the top-level model compositors; they are different rules because REF requires xs:extension, while EXT also allows xs:restriction

Block and final

REF schema documents are not allowed to use block and final, which restrict extension and reuse of elements and complex types. EXT schemas are allowed to use these. These restrictions are placed on elements, complex types and on the schema, where defaults are set.

Nillable

REF elements must be nillable.

Choice

EXT schemas are allowed to use xs:choice. REF schemas are not allowed to use xs:choice. (Neither type of schema can use xs:all).

Since REF schemas are not allowed to use xs:choice, these rules are applied only to EXT schemas.

These rules limit cardinality on xs:choice, applicable only to EXT schema documents.

Wildcards

REF schema documents cannot use wildcards.

Augmentation points

REF schema documents must include augmentations on complex types.

External adapters

REF schemas are not allowed to use attributes from external (not NIEM-conformant) schemas. EXT schemas are allowed to reference external attributes.

Prior to NDR 5.0, the following rule applied only to REF. It has since been adjusted to apply to EXT as well, and is no longer a difference between the two targets.