Creating NIEM 2.0 constraint schemas
System requirements: Windows XP/Vista, MSXML
Ver Date Description Contributor
1.0 11/12/2005 GJXDM 3.x Scott Came, Justice Integration Systems
2.0 7/15/2008 NIEM 2.0 Jim Cabral, MTG Management Consultants LLC
1. Generate a NIEM 2.0 subset using the Schema Subset Generation tool at http://niem.gov.
2. Download the NIEM 2.0 subset (Subset.zip) and extract the files into a subdirectory named Subset which will contain a separate directory and schema for each namespace in the NIEM 2.0 subset.
3. Create a subdirectory for the constraint schemas (you might name it constraint)in the directory that contains the Subset subdirectory and copy the following files to the constraint schema subdirectory:
config.cmd
maketransforms.cmd
makeconstraints.cmd
make-constraint-schema-transform.xsl
msxml.js
4. Run maketransforms.cmd to generate the same directory structure as the NIEM 2.0 subset. There will be an XSL transformation named constraint-schema-transform.xsl for all namespaces other than the NIEM appinfo, structure, external and proxy namespaces. (This will not overwrite any existing transformations.)
5. For each namespace in the NIEM 2.0 subset, customize the constraint-schema-transform.xsl script as follows:
a. Customize the minimum and maximum occurrences for each element in a type. There will be a XSL template for each element that is a member of a complexType as follows:
<xsl:template match="xsd:element[@ref='nc:CaseFiling' and ../../../../@name='CaseType']">
<xsd:element ref="nc:CaseFiling">
<xsl:attribute name="minOccurs">0</xsl:attribute>
<xsl:attribute name="maxOccurs">unbounded</xsl:attribute>
</xsd:element>
</xsl:template>
By default, each element will be set to a minimum occurrence (minOccurs) of "0" and a maximum occurrence (maxOccurs) of "unbounded". For required elements, change the minOccurs to "1". Likewise, change the maxOccurs - most elements should probably be set to a maxOccurs of "1".
b. Customize the allowable values for each code list: (The NIEM Schema Subset Generation tool allows the selection of allowable values for a code list as part of the generation of a subset. However, in certain implementations, it may be preferable to include all possible values in the subset and limit the allowable values in one or more constraint schemas based on that subset.) There will be a XSL template for each possible value of a code list as follows:
<xsl:template match="xsd:enumeration[@value='0' and ../../@name='FPCCodeSimpleType']">
<xsl:copy-of select="." />
</xsl:template>
If a value is not an allowable value for the code list, delete the template for that value (all 3 lines).
6. Run makeconstraints.cmd to copy the NIEM appinfo, structure, external and proxy schemas and generate the constraint schemas for the remaining namespaces. (This will overwrite any previous versions of these constraint schemas).
Jim Cabral
MTG Management Consultants LLC
jcabral@mtgmc.com