Prev | Next |
Walk Through Examples
If you are new to using the Schema Composer for NIEM, please take the time to read through these examples. Each example contains important information that will help to ensure that your models use valid NIEM subsets, which will ultimately produce valid XML schema files.
Example 1: Adding Classes and Selecting Attributes
This 'walk-through' example demonstrates how to use Enterprise Architect's Schema Composer to perform basic operations of adding classes and selecting attributes to be included in a NIEM subset package.
Step |
Description |
---|---|
1 |
Open an Enterprise Architect project that contains the NIEM 4.0 Reference Model and also the NIEM MPD Types. If you don't have such a project, then open a new project and load the Reference Model and MPD Types, using the Model Wizard. |
2 |
Using the Model Wizard, add a fresh copy of the NIEM 4 IEPD Starter Model to your project. You should rename the object instance 'NIEM-MPD' to something more meaningful. When generating the MPD, the name of this object instance is used to name the root folder in which the MDP is created. If you wish, rename the package 'NIEM 4 Starter Model' to something more appropriate as well. |
3 |
The starter model contains a Schema Composer artifact named 'Schema Composer profile - NIEM subset'. Locate this artifact in the Project Browser, then double-click on it. This will open the Schema Composer and load the profile 'Schema Composer profile - NIEM subset'. The lower part of the Schema Composer contains three columns. From left to right, they are labelled 'Classes', 'Attributes' and 'Schema'. |
4 |
Using the Project Browser, locate the package 'niem-core' in the NIEM 4.0 Reference Model. Within that package, locate the class AircraftType. Drag and drop AircraftType onto the left-hand column of the Schema Composer (labelled 'Classes'). You will notice that classes ConveyanceType and ItemType are added automatically to the list of Classes. ItemType and ConveyanceType are supertypes from which AircraftType is derived. |
5 |
Select AircraftType in the 'Classes' column. You will notice that the center column, 'Attributes', displays the full list of attributes belonging to this class. The attributes of the parent classes are also listed. To include an attribute in the subset schema, you simply place a checkmark beside it. (You should choose only attributes of the class that is currently selected in the 'Classes' list. If you require attributes of a parent class, select that class, then select its attributes.) Place a checkmark beside AircraftTailIdentification. The type of AircraftTailIdentification is IdentificationType. Notice that IdentificationType has been added to the list of classes. Enterprise Architect automatically adds to the 'Classes' list, those classifiers that are referenced as types of the attributes you select. |
6 |
Select the class IdentificationType in the left-hand column of the Schema Composer. In the center column, place a check mark beside the attribute IdentificationID. The type of IdentificationID is string. The type 'string' is a Primitive type - it is not added to the list of Classes. |
7 |
Now, select the class ConveyanceType in the left-hand column of the Schema Composer. Place a check mark beside the attribute ConveyanceMotorizedIndicator. The type 'boolean' is a Primitive type - it is not added to the list of Classes. |
8 |
Select the Class ItemType in the left-hand column of the Schema Composer. Place check marks beside the attributes ItemMakeName, ItemModelName and ItemModelYearDate. The types ProperNameTextType and TextType are automatically added to the list of Classes. TextType is the base class for ProperNameTextType. |
9 |
Click on the to save the selected classes and attributes to the profile, then click on the . In the window that opens, select 'NIEM Model Subset', then click on the Generate button. You will be prompted to select a package within which the subset model will be created. Typically, you should choose the package that is the parent of the Exchange schema package. In the starter model, the exchange package is named 'MPD-Exchange' and its parent package is named 'NIEM 4 Starter Model', although you may have renamed these in step 2 above. Select the package 'NIEM 4 Starter Model', then click on the . Note: When creating more complex models, your subset might include classes from several different <<InformationModel>> packages. Enterprise Architect's Schema Composer will automatically create the required target packages and copy the classes you are subsetting into the target packages whose Tagged Value 'targetNamespace' matches that of the source package from which the original class was drawn. The subset <<InformationModel>> packages will be created as children of the package you choose as the generation target. |
10 |
Once the generation is complete, expand the target <<InformationModel>> packages. You will see the classes you selected with their reduced sets of attributes. |
Example 2: Using Association Types
This 'walk-through' example demonstrates how to use Enterprise Architect's Schema Composer to add association types and the types they reference, to your NIEM subset package.
Step |
Description |
---|---|
1 |
Open an Enterprise Architect project that contains the NIEM 4.0 Reference Model and also the NIEM MPD Types. If you don't have such a project, then open a new project and load the Reference Model and MPD Types using the Model Wizard. |
2 |
Using the Model Wizard, add a fresh copy of the NIEM 4 IEPD Starter Model to your project. You should rename the object instance 'NIEM-MPD' to something more meaningful. When generating the MPD, the name of this object instance is used to name the root folder in which the MDP is created. If you wish, rename the package 'NIEM 4 Starter Model' to something more appropriate as well. |
3 |
The starter model contains a Schema Composer artifact named 'Schema Composer profile - NIEM subset'. Locate this artifact in the Project Browser, then double-click on it. This will open the Schema Composer and load the profile 'Schema Composer profile - NIEM subset'. The lower part of the Schema Composer contains three columns. From left to right, they are labelled 'Classes', 'Attributes' and 'Schema'. |
4 |
Using the Project Browser, locate the Package 'niem-core' in the NIEM 4.0 Reference Model. Within that Package, locate the Class 'PersonLocationAssociationType'. Drag and drop 'PersonLocationAssociationType' onto the left-hand column of the Schema Composer (labelled 'Classes'). You will notice that the center column 'Attributes' displays PersonLocationAssociationType.Attributes and also PersonLocationAssociationType.Associations. Place check marks beside both of the associations, Location and Person. The types LocationType and PersonType are automatically added to the Schema Composer's 'Classes' list. |
5 |
The Class PersonLocationAssociationType is derived from the supertype 'nc:AssocationType', but in this case the supertype is not automatically added to the Classes list. If you want to include any attributes of the supertype 'nc:AssociationType' in your generated subset, you must add 'nc:AssociationType' to the Schema Composer's Class list manually, then select the required attributes. If you don't want to specifically include attributes of 'nc:AssociationType', then there is no need to add it to the Classes list. When the schema file is eventually generated from the subset Package, Enterprise Architect will generate an element and type definition for 'nc:AssociationType' if and when it is required, even if it is not explicitly modeled. |
6 |
Click on the , then click on the . In the window that opens, select 'NIEM Model Subset', then click on the Generate button. You will be prompted to select a package within which the subset model will be created. Typically, you should choose the package that is the parent of the Exchange schema package. In the starter model, the exchange package is named 'MPD-Exchange' and its parent package is named 'NIEM 4 Starter Model', although you may have renamed these in step 2 above. Select the package 'NIEM 4 Starter Model', then click on the . |
7 |
Locate the <<InformationModel>> package named 'niem-core' within the subset model. Create a NIEM PIM diagram within this package then drag and drop the three classes in this package onto the diagram. You will notice that the properties 'Person' and 'Location' are modeled as AssociationEnds on the associations between PersonLocationAssociationType and the types PersonType and LocationType. |
Example 3: Using Substitution Groups and Property Holders
This 'walk-through' example demonstrates how to use Enterprise Architect's Schema Composer to correctly add substitution groups and property holders to your NIEM subset Package.
Step |
Description |
---|---|
1 |
Open an Enterprise Architect project that contains the NIEM 4.0 Reference Model and also the NIEM MPD Types. If you don't have such a project, then open a new project and load the Reference Model and MPD Types using the Model Wizard. |
2 |
Using the Model Wizard, add a fresh copy of the NIEM 4 IEPD Starter Model to your project. You should rename the object instance 'NIEM-MPD' to something more meaningful. When generating the MPD, the name of this object instance is used to name the root folder in which the MDP is created. If you wish, rename the package 'NIEM 4 Starter Model' to something more appropriate as well. |
3 |
The starter model contains a Schema Composer artifact named 'Schema Composer profile - NIEM subset'. Locate this artifact in the Project Browser, then double-click on it. This will open the Schema Composer and load the profile 'Schema Composer profile - NIEM subset'. The lower part of the Schema Composer contains three columns. From left to right, they are labelled 'Classes', 'Attributes' and 'Schema'. |
4 |
Using the Project Browser, locate the package 'niem-core' in the NIEM 4.0 Reference Model. Within that package, locate the class 'AircraftType'. Drag and drop 'AircraftType' onto the left-hand column of the Schema Composer (labeled 'Classes'). You will notice that the classes ConveyanceType and ItemType are added automatically to the list of Classes. ItemType and ConveyanceType are supertypes from which AircraftType is derived. |
5 |
Select the Class 'AircraftType' in the left-hand column of the Schema Composer. In the center column, place a check mark beside the attribute AircraftWingColorAbstract (notice that this attribute has no type specified). The class AircraftWingColorAbstractPropertyHolder is automatically added to the list of classes. |
6 |
Select the Class 'AircraftWingColorAbstractPropertyHolder' in the left-hand column. Notice that this class also has an attribute named 'AircraftWingColorAbstract' that has no type specified. This attribute is pre-selected for you - it should remain selected. Simply place a check mark beside AircraftWingColorText. |
7 |
In this case, the attribute AircraftWingColorAbstract is the head of the substitution group and provides the connection between the client class AircraftType and the supplier class AircraftWingColorAbstractPropertyHolder. AircraftWingColorText is the actual attribute (of type TextType) that will be added to AircraftType. |
8 |
Some PropertyHolder types will have several attributes - the substitution group head, plus a number of others. The attribute that is the head of the substitution group must always be selected in both the client and the supplier classes. Enterprise Architect pre-selects this attribute for you in the supplier class (the PropertyHolder). You then only need to select the attribute(s) from the supplier that you wish to substitute in place of the head of the substitution group. |