Subset Schema Documents

Subset schema documents are NIEM artifacts that allow specification of a subset of the schema components defined with a given namespace. They are used in place of larger or more verbose Reference Schema Documents (REFs).

  • Use same conformance target as Reference Schema Documents.
  • Provide a self-consistent subset of definitions from a namespace.
  • Provide a smaller basis to define NIEM-conformant packages.
  • Can serve as the basis for Extension Schema Documents.

Subset Schema Documents are identically Reference Schema Documents (REFs) that provide a limited set of components from a namespace. They satify all the same rules and requirements of REFs but are typically found only within the specification of a NIEM-conformant package (i.e. IEPD or IEP). Subset Schema Documents are almost always automatically generated by SSGT. In fact, NIEM recommends against creating Subset Schema Documents manually.

Why Subset Schema Documents

Subset Schema Documents are used to specify a limited set of the components defined within a given namespace. These documents are Reference Schema Documents (REFs) that replace the full REF defining a namespace. As such, Subset Schema Documents are generally used in NIEM-conformant packages that require a limited set of components from broader domains.

Subset Schema Example

  <?xml version="1.0" encoding="US-ASCII"?>
  <xs:schema targetNamespace="http://release.niem.gov/niem/niem-core/4.0/" version="1" xsi:schemaLocation="http://release.niem.gov/niem/appinfo/4.0/ ../../appinfo/4.0/appinfo.xsd http://release.niem.gov/niem/conformanceTargets/3.0/ ../../conformanceTargets/3.0/conformanceTargets.xsd" ct:conformanceTargets="http://reference.niem.gov/niem/specification/naming-and-design-rules/3.0/#ReferenceSchemaDocument" xmlns:niem-xs="http://release.niem.gov/niem/proxy/xsd/3.0/" xmlns:structures="http://release.niem.gov/niem/structures/3.0/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:appinfo="http://release.niem.gov/niem/appinfo/3.0/" xmlns:ct="http://release.niem.gov/niem/conformanceTargets/3.0/" xmlns:nc="http://release.niem.gov/niem/niem-core/3.0/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <xs:import schemaLocation="../../proxy/xsd/3.0/xs.xsd" namespace="http://release.niem.gov/niem/proxy/xsd/3.0/"/>
    <xs:import schemaLocation="../../structures/3.0/structures.xsd" namespace="http://release.niem.gov/niem/structures/3.0/"/>
    <xs:element name="DateRepresentation" abstract="true"/>
    <xs:element name="DateTime" type="niem-xs:dateTime" substitutionGroup="nc:DateRepresentation"/>
  </xs:schema>

Detailed Reference

In terms of the structure or usage of Subset Schema Documents, they are indistinguishable from Reference Schema Documents (REFs). Because NIEM adopts an optional and over-inclusive data representation strategy, most elements defined in a REF have 0 to unbounded cardinality, and thus elements with cardinality minOccurs="0" are optional and may be omitted from a derived Subset Schema Document.

It is also valid to constrain an element’s cardinality within a Subset Schema Document as long as doing so does not break the subset’s relationship with the parent REF. For example, a REF element defined with cardinality minOccurs="1" and maxOccurs="unbounded" is then constrained to (0,1) or (1,1) in a derived Subset Schema Document. The change in cardinality shown here breaks the subset’s relationship with the REF because the new interval (0,1) is not contained within the original interval (0, unbounded).

The following lists a non-normative, informative, set of operations to consider when constructing Subset Schema Documents. It is possible to apply them in combinations that will break the subset relationship, or even result in invalid schemas. Apply these operations carefully and thoughtfully.

  • Remove a comment.
  • Remove an xs:annotation.
  • Increase the value of an xs:element/@minOccurs as long as it remains less than or equal to its corresponding xs:element/@maxOccurs defined in the parent REF.
  • Decrease the value of an xs:element/@maxOccurs as long as it remains greater than or equal to its corresponding xs:element/@minOccurs defined in the parent REF.
  • Remove an xs:element if its minimum cardnality is 0 (xs:element/@minOccurs="0").
  • Remove an xs:complexType or xs:simpleType if not supporting an xs:element or xs:attribute declaration, or another xs:complexType or xs:simpleType definition.
  • Remove an xs:attribute with @use="optional" from an xs:complexType.
  • Change an xs:attribute/@use="optional" to xs:attribute/@use="prohibited".
  • Change an xs:attribute/@use="optional" to xs:attribute/@use="required".
  • Remove an xs:element declaration if the element is not needed.
  • Remove an xs:enumeration from an xs:simpleType as long as it is not the only remaining xs:enumeration.
  • Remove an element with representation term AugmentationPoint if element substitution is not needed.
  • Add or apply a constraining facet to an xs:simpleType.
  • Remove an xs:import if the imported schema document is not used within the subset.
  • Change a concrete xs:element declaration to xs:element/@abstract="true".
  • Change an xs:element/@nillable="true" to xs:element/@nillable="false".
  • Substitute an xs:element/@substitutionGroup member for its associated substitution group head.
  • Substitute a composition of xs:element/@substitutionGroup members for their associated substitution head.
  • Replace a wildcard with a composition, i.e. an ordered sequence of elements.

NIEM recommends developers use SSGT to automatically generate Subset Schema Documents. There are several pitfalls and opportunities for error in creating derived Subset Schema Documents from REFs manually.