Example NIEM Schema
This page provides an overview of defining a new NIEM compliant schema, from start to finish.
Import NIEM framework Packages
Modeling with NIEM in Enterprise Architect starts with the standard types defined by the NIEM Technical Architecture Committee and the Object Management Group NIEM-UML specification, as described here. These are available from our Reusable Asset Server and the Model Patterns wizard.
To import these into your model:
- Open the Model Wizard to the 'Model Patterns' page
- Find the Perspective 'NIEM 3 and 4'
- Select the Packages required for your model
- Click on 'Create Patterns' to import the selected patterns into your model.
- All NIEM 3 or 4 models require the NIEM MPD Types Package as well as one of the NIEM Reference Model Packages
- All NIEM 2.1 models require the NIEM 2.1 Reference Model Package but not an MPD Types Package, as the NIEM 2.1 MPD elements are available from the NIEM 2.1 MPD Diagram Toolbox
The power of NIEM comes primarily from the extensive library of types that you can use to build your own schemas. Enterprise Architect provides complete NIEM frameworks for NIEM 4, as well as all versions of NIEM 3. These frameworks are all available from the 'Model Patterns' page of the 'Model Wizard'.
This tutorial is using the NIEM 4.0 framework, so select that pattern for import.
Model Package Description Types from NIEM-UML
A user defined NIEM schema is built around a Model Package Description (MPD) that defines, for consumers of the schema, how to use the various XSD files that are included and what message types are being defined.
When modeling in UML, an MPD is created using instances of a number of Classes defined in the UML Profile. Enterprise Architect provides these Classes in a Package that is available from the 'Model Patterns' page of the 'Model Wizard'.
All NIEM 3 and NIEM 4 models will require these MPD types, so select the NIEM MPD Types pattern for import.
Create Model Package Description
Previously, the framework Packages that are required for NIEM modeling were described. The Model Wizard also provides a Package that acts as a convenient starting point for defining your MPD. When this is imported to your model you will find a diagram containing instances of the MPD types, with the run-state set to show the core properties that you are most likely to need to set.
This section describes the process of taking the sample MPD from the Pattern, and creating a 'Hello World' style message, where a request is made for a personalized message based on a facial image. The response will be the identity of the pictured person and a personalized message for them.
Model Package Description Metadata
The top level object in the Pattern is an instance of the ModelPackageDescription class. The name of the MPD is the name of the Object itself. All other properties are in the Run-State of the object.
This figure shows how the MPD might look after providing real information.
NIEM-UML recommends the last section of mpdBaseURI matches the name of the MPD, and specifies that the mpdVersionID will be appended to the mpdBaseURI to produce the generated mpdURI. This example follows that convention.
The Pattern defaults the value of mpdClassCode to 'iepd'. This means that the MPD is intended to represent an Information Exchange Package Document (IEPD). This is the most common type of MPD, and it is what we want to create, so it has been left with the default value.
Defined Document Types
An IEPD is expected to define one or more document types. Each one will be an instance of IEPConformanceTargetType named 'IEPConformance Target'. The provided model Pattern already includes one of these, but we need a second one as shown here:
Note the instances of QualifiedNamesType, with the qualifiedName relationship to a PropertyHolder. This specifies that the top level of the document being described will be an element from one of the contained attributes. The section Create Extension Packages in the topic Creating a NIEM Data Model describes how this is defined. For now, an empty type will be enough.
The relationships connecting the Model Package Description to the Information Models specify which schema files are to be generated with this MPD. In this example we will use types from two different NIEM namespaces. To do this, we first create an InformationModel Package for each, where the Namespace Tagged Values match the original, and the purpose is set to subset. We will also need an extension Package where we can define our own types and how the NIEM types will be used.
This figure shows how this will look:
The relationships used also specify how the Package is used and the relative path to the schema defined by that Package.
All IEPD Packages are expected by NIEM to contain - at a minimum - a change log and a readme, but there are several other types of Artifact that are also supported. In Enterprise Architect, each is defined using a stereotyped relationship to an Artifact. As with the Package use, the relationship specifies where the file will be located.
In this image a ReadMe, ChangeLog and a sample document are described for each of the document types. This will add information about those files to the target catalog file. The files will not be created by Enterprise Architect, and their content is beyond the scope of this tutorial.
Subset NIEM Namespaces
The Model Package Description is now complete, but we have three empty Information Model Packages. The first two should be filled by selecting types and properties from namespaces within the NIEM framework Packages.
The Starter Model pattern includes a Schema Composer Artifact to use for specifying a subset. Double-click on it to open the Schema Composer and begin the subsetting process.
Our request message specifies that it will send a facial image to be used for facial recognition. To do that, we need to subset the appropriate types from the Biometrics Package. Start by locating the type FaceImageType in the Domains\Biom Package within the NIEM 4.0 Reference Model. Drag this type into the Schema Composer. The super types from which this type inherits are automatically added to the Schema Composer.
Our response message requires PersonType from the 'niem-core' Package. Drag this type onto the Schema Composer as well.
This image shows the selection of a subset of the types and properties across a number of namespaces within the NIEM 4.0 Reference Model:
Once the required types are selected, you can generate the subset. When prompted, select the parent Package into which the subset namespace Packages will be generated. After generation, the Classes in the subset Packages should resemble this:
We can now create a NIEM PIM diagram and place all our subset Classes on that diagram, to produce something that resembles this:
Create extension types
When describing the MPD earlier, we referred to a PropertyHolder that contained the possible document roots for our two messages. Now that we have defined our subset Packages we can define these document roots. Because we are only creating two simple document types, all that is needed is a PropertyHolder and ObjectType for each message. The ObjectTypes link to the types we've selected from the NIEM framework, to describe the contents of each message as shown:
Right-click on the instance of the ModelPackageDescription.
Select 'Specialize | NIEM | Generate NIEM Schema'.
The dialog shows the standard NIEM artifacts and the list of linked namespaces that can be generated as schemas. Set the target directory and click on theto create the modeled MPD.