You can import one or more XML Schema files into a UML model, where XSD structures are mapped to UML packages, classes, data types, and associations. Large sets of interrelated schemas may be imported (e.g. several hundred XSD files) and xsd:import or xsd:include statements will be processed and imported into UML packages. The UML profile for XML Schema is applied to the new UML model for representing additional metadata, e.g. the schema target namespace URI.
- If you are starting hyperModel with a new empty Eclipse workspace, then you must create a new project before starting the XSD import wizard. This project, or a folder within it, will hold the imported UML model. You may also add the XSD source files into a folder in this project. To create a new project, choose: File > New > Project, then choose General > Project. To create a new folder wihin a project, right-click on the Project and choose: New > Folder.
- Start the wizard using: File > Import XSD…
- Select the XSD file(s) to import. If your schemas are included in an Eclipse workspace project, then select that folder before starting the wizard and all contained schemas will be automatically added to the import list. See screenshot below. If you choose the option to Add Folder…, then all XSD files included in that folder and its child folders will be added to the list.
- Select the Root package that specifies which file folder is mapped to the root UML model package. Large sets of XSD files are often organized in a file folder hierarchy, and it is usually desirable to reflect that same folder hierarchy in the UML model packages. To do this, you must tell the wizard which file folder should be the root of the UML package hierarchy (usually the most specific file folder that contains all schemas and folders to be imported).
- You may optionally import the schemas into an existing UML model. When you are new to using this wizard, leave the Model selection empty and allow the wizard to create a new model.
- On the second page, select a project folder where the new model will be created and enter the new model file name, e.g. FpML-4-2.uml
- On the third page, leave the default values for Model Object and XML Encoding, unless you know that an alternative XML Encoding is required for your schema character set.
- On the fourth page, choose import options that may affect the resulting UML model element naming. See the second screenshot below.
- Global elements: leave this unselected unless you know that your schemas use all global elements for content. Currently, this does not affect the UML model import structure, but simply sets a profile stereotype property.
- complexType suffix: If all of your schema complexType names use a common suffix (e.g. “Type”) then enter it here and that suffix will be removed from complexType names when mapped to UML class names. That suffix is retained in a model stereotype and will be re-appended to class names when generating XML Schemas from this model.
|XML Schema import options that guide mapping to UML:|
hyperModel provides several different ways to visualize UML models. To get started, use the hyperModel perspective in Eclipse for quick access to all of these features, although these views are available in any Eclipse perspective.
Menu: Window > Open Perspective > hyperModel
- Project Explorer
- Dynamic Class Diagrams (dynagrams)
- Class Diagram Editor
- UML Table Editor
- Message Hierarchy View
To open a UML model, double-click on a .uml file in the Project Explorer view, or right-click and select Open With > UML Table editor. This will open the UML Table Editor as the default editor and will also expand a tree navigator of the model content within the Project Explorer.
The Properties view displays editable detail for selections in most UML editors and views:
To open a dynamic class diagram created from any model classes:
- select one or more classes in the Project Explorer, then right-click and choose Open With > Class Dynagram
In this example screenshot, two classes were selected from the FpML model: Bond and Cash. A UML class diagram will be created on-the-fly using the selected classes as the root nodes and expanding the related classes via associations for the (configurable) number of steps away from these root classes.
You can drill-down into a new class diagram created from one class within this diagram. Just double-click on one of the class names in this diagram (you must click on the class name, not elsewhere in the class box). Right-click on the class name for a context menu of other actions and alternative views, as shown in this screenshot.
Use the window toolbar for other dynagram commands that zoom in/out or change the depth/breadth of diagram expansion.
Note that the identical dynagram functionality is available if you install hyperModel plugins into IBM’s Rational Software Architect®. Just use RSA’s Project Explorer view to open the dynagram for selected packages or classes.
We are working on integrating Eclipse.org Papyrus class diagram editor with hyperModel. Watch this site’s blog (home page) for status and announcements!
The UML Table Editor provides an excellent tool for viewing and editing class properties, or for adding new model content. When creating models that are planned for generation to XSD, you can quickly reorder the properties using drag/drop to design the sequence of XSD complexType element content. The table editor is also an intuitive overview of message content.
To open this editor:
- Select one or more packages or classes in the Project Explorer
- Right-click, and choose Open With > UML Table
- You can also open this editor for the selected class in the class dynagram by using its context menu.
Note that the identical table editor is available if you install hyperModel plugins into IBM’s Rational Software Architect®. Just use RSA’s Project Explorer view, and choose Open With > UML Table for the selected package(s) or class(es).
When working on UML models that are planned for generation to XSD, many modelers find it helpful to visualize the ultimate structure of XML messages using a hierarchical tree of XML elements and attributes. The hyperModel Message Hierarchly View allows you to quickly see the message structure while working directly on the UML information model.
To open this view
- select one class in the Project Explorer, right-click, and choose Open With > Message Hierarchy
- You can also open this view from the selected class in the class dynagram by using its context menu.