The exercises in this training consist of recreating the examples presented.
Introduction to Meta Modelling in SystemWeaver
When you are creating a meta model in SystemWeaver, you are actually creating a solution. You are building a concrete model which is different from creating an architectural or conceptual model.
What is a Meta Model?
A meta model in SystemWeaver defines the language and processes from which to form a model. The meta model you create as an Architect is directly reflected in SystemWeaver. Items, Attributes, Parts and Nodes are the basic building blocks in SystemWeaver. These building blocks are abstract and general in purpose and are always sub-typed in the meta model into types that are meaningful for a specific modeling or documentation purpose. The building blocks are classified according to the core meta meta model of SystemWeaver.
Meta Model Entities - Simplified
Creating Meta Models - The Basics
Starting Architect and Connecting to the Test Server
To start with, set up a test server and start the MetaModelTraining.sqlite database (Setting up a Test Server). Then, start the Architect client (swArchitect.exe located in the Architect directory in your installation) and connect to the test server that you have set up.
In the Architect interface, you will be using the Metadata, Attributes and Refactorings tabs to complete meta modelling tasks.
Navigate to the Metadata tab and expand the Obj item and Base Item structure. The Metadata tab is where you can create and modify Object types, like Item Type and Part type.
Any item type that you create is actually a sub-type of the SystemWeaver Item object. All sub-types that are created will inherit from Item.
Select Item in the Obj structure and click Add Sub Type.
The Enter Type SID and Name dialog will display. The following information is required for a new item being created:
- SID: Unique identifier for the item. Used when creating reports, etc. Can include letters, numbers and special characters (maximum length: 8 characters) although it is recommended that only letters (A-Z) and/or numbers (0-9) are used.
- Name: Name of the item type as seen by the users
Note: The Name can easily be changed later on, but changing the SID, although possible, is more complicated.
When you click Save, the initial definition of the new item type will display.
So that users can more easily identify item types in SystemWeaver, you can add an icon to the item type by clicking on the icon browse button and selecting an available icon in the Change Icon dialog.
Exercise - Creating Item Types
- Create two different item types in the Architect. In our example, we have created one named "The name of the item type" and one named "Another item type".
- Set icons for both.
Creating Items in Explorer
If you haven't already, open the SystemWeaver Explorer client (swExplorer).
Create an item of each item type that you created in the Architect using the New Item button:
When users create items, the item type is always reflected in the client for them. For example, the type can always be seen in the top-right corner of the view.
Viewing Item Type Information
Any time you need to get an overview of the meta model for a selected item, you can use the Item Type view.
- The type of the item selected in the tree is highlighted in pale blue in the diagram.
- The name in the box, "The name of the item type" in this example, is the item type of the selected item. (i.e., the type name that is always visible in the top-right corner of a view.)
- The small box at top right within the type box shows the SID of the type.
- The boxes drawn above the highlighted box, linked via inheritance arrows (), are item types that the highlighted type inherits from. Item type inheritance will be covered in more detail further down in this article.
Learn more about the Item Type view.
Creating Part Types
Part types are the relations that can be created between item types.
Just like for item types, part types are created in the Architect client (swArchitect). Open the application again and navigate to the Metadata tab.
Part types are created on the item type that is owning the relationship. In the below example, the owner of the new part type is going to be "Another item type" so it is selected. To create a part, click Add Simple Part Type.
The Enter Part Type dialog will display. The following information must be entered:
- SID: Unique identifier for the part. Used when creating reports, etc. Can include letters, numbers and special characters (maximum length: 8 characters) although it is recommended that only letters (A-Z) and/or numbers (0-9) are used. (A)
- Name: Name of the part type as seen by the users (B)
- Multiplicity: Denotes whether a single or multiple parts of this new type can be allowed for the owning item. "List" means multiple (the relationship can be used to relate to several different items) and "Single" means one (maximum one relation may be created of this type). (C)
DefObj: Defines which item type the new part type, i.e., the new relationship, points to. (D)
Once the part type information is saved, the part type will display for the selected item type in the Part Types list. Because it is not inherited (inheritance is explained further down in this training), it displays with a white background:
To set the properties for the newly created part type, select it in the Part tree to the left. Just like for item types, you can set the icon for the part type which will display for the item that is used with the part. If you do not assign an icon to a part type, the icon of the DefType item type (the item that the part is pointing to) will be applied instead.
Exercise - Creating Parts
- Create a part type in the Architect and name it "Relationship" as shown in the example.
- In the Explorer, create a new part of this type:
- Right-click the item of the type that has/owns the newly created part type.
Select New. The newly created part type should be available as a alternative.
Select it and name the new part "Name of the item created as part".
Click OK. You have now created a part of the part type you created in the Architect.
Viewing Parts and Saving Tree View Settings
By default, parts are not displayed in the tree in Explorer. To view a part type, right-click on the owner item, select View, and select the part type.
As an Architect, you can save the modified view setting so that all users viewing the structure can see the now-viewable part type. Right-click on the part and click Save active settings to new view:
The parts to be displayed are saved on the item type that is at the top of the tree. Each time a user opens this item type, the tree will show the part types saved on the opened item type.
When setting up a SystemWeaver installation, it is important to create all necessary view settings for the users.
- Identify what item types users will open as top item
- Set reasonable view settings for all of these types
Item Type Inheritance
Item inheritance allows for different item types to have the same properties. For example, part types and attributes may be inherited from an item type to several different item types.
Inheritance is set using the Architect client (swArchitect). Open the application again and navigate to the Metadata tab.
Inheritance in SystemWeaver is achieved via sub-typing. You create a sub-type to the item type that has a part type by clicking on Add Sub Type.
Enter the SID and Name for the new item type (in the below example, "Inherited item type") and click Save. The created item type then inherits the part type along with all of the parent's other properties, part types, attributes, icon, etc. If desired, additional part types and attributes can be added. A unique icon can be set for the new sub-type item as well.
Create an item of the type that uses inheritance. In the below example, an item called "Item with inheritance" of type "Inherited item type" is being created.
You can now create inherited parts for the created item. The Item Type view shows how the item inherits from its parent:
Creating Abstract Types
In some cases, parent types that other types inherit from should not be used by the users. To avoid users creating specific items of these types, they can be made abstract. The purpose of an abstract type is really to manage the properties of its (non-abstract) sub-types.
- Open the SystemWeaver Architect again.
- Select the item type that the sub-type inherits from (in our example, this would be "Another item type").
- Make it abstract by checkmarking Is Abstract.
Now, users cannot create items of the "Another item type" type. However, items of type "Inherited item type" will still inherit properties from the "Another item type" type:
An Attribute is a typed value that can be associated with/added to an item or part. The value cannot be reused or shared by other items or parts unless done indirectly by including the item (that has an attribute) as a part. There are many different types of attributes and the editor presented to users for value selection varies depending on type. To work with attributes, open the Architect application and go to the Attributes tab.
To create an attribute, right-click in the pane and select Create:
The Create Attribute Type dialog provides the following fields for defining the attribute:
SID: The attribute's unique identifier. Can include letters, numbers and special characters (maximum length: 8 characters) although it is recommended that only letters (A-Z) and/or numbers (0-9) are used. (required)
Name: Name of the attribute as seen by the users. (required)
Data type: The number of occurrences allowed. The Data type is required and the options are:
||The attribute can have one value.
||The attribute can have several values.
||The attribute can have several values from a validated list called a "Range".
Attribute type: The type of attribute. A drop-down list of available types is provided. A selection is required and the options are:
||Valid Data Types
||Supports the values "True" and "False".
||Supports any type that can be defined according to the Path expressions in SystemWeaver.
||Reserved for attribute types with custom support in the swExplorer client.
||Supports date values, presented the format yyyy-mm-dd.
||Provides users with a validated list of values to select from.
||Supports named file and URL references.
||Supports decimal values.
||Supports automatic generation of integer values according to a Sequence ID. Such values are unique within the specified Sequence ID. Also, once set, Identity attribute values cannot be changed.
||Supports natural values.
|RVF (RichView Format text)
||Supports fully formatted text, including pictures. This is the format generally used in Descriptions in SystemWeaver. Whenever needed this format is automatically translated into the RTF format used in MS Office applications.
||Supports non-formatted strings, up to 100 characters long.
||Supports non-formatted strings, including new lines.
||Supports the value domain of all users defined in the SystemWeaver server.
||Supports XML formatted text.
Info: A text box used for administrative information, e.g., the purpose of the attribute, who created it and when. (optional)
Default value: Set a default setting. (optional)
Allow empty value: Indicates if empty attribute values should be acceptable or not. Check the box to allow an empty value. (optional)
Editor width: Sets the default width for displaying the attribute values. 200 is a good starting point. (optional)
Editor min height: Sets the min height for displaying the attribute values. Mostly applicable to Text type attributes where there may be multiple rows of text. (optional)
Editor max height: Sets the max height for displaying the attribute values. Mostly applicable to Text type attributes where there may be multiple rows of text. (optional)
Restricted: Check this box to hide the attribute from users in the standard views. Such information would typically be visible in some other form. (optional)
Fixed font: Used in special cases to indicate that a fixed size font like Arial should be used for presenting the value. An example can be attributes used for code snippets. (optional)
Additional Settings for Enumeration Type
When Enumeration type is selected, the following additional tools are also provided for defining the validated list of values:
Color: Click in the color cell for the value and select the color that will display in the client.
Name: Click in the name cell and enter the value. Note: If you change a value later on, any existing attributes will maintain their old values and these will be indicated as invalid in the client.
Description: Click in the browse button for the description cell to enter an optional description of the value.
Clear all colors: Clears all color selections in the list of values.
Remove all: Removes all values in the list.
Remove: Removes the selected value from the list.
Add: Adds a value to the validated list. (You can also right-click in the list area and select Add.)
- In the Architect, create at least a few attributes from the following list of attribute types:
- External reference
After creating new attributes, it's recommended that you log in to the Explorer client to view how the attributes will display for users.
- Log in to the Explorer client and create an item.
- Right-click in the Attributes section of Overview and select Add attributes.
- Select all available attributes and click OK.
All attributes have now been added to the item and you can see that different attribute types display as different field types, e.g., drop-down list, browse button for selection, free text, etc. for users:
Adding Default Attributes to Items
As an Architect, you can set default attributes for a particular item type in the meta model using the Architect application. Then, when a user creates an item of that item type, the default attributes will be available to them (unless you set an attribute as Restricted) so that they can set the values.
Open the Architect and go to the Metadata tab. Then select one of the item types that you created earlier and click Add Default Attribute.
In the Select Attribute Types dialog add a couple of the attributes that you created earlier.
Back in the Explorer client, create an item of the above type and you will see the default attributes that you have set in the Overview view:
Adding Default Attributes to Parts
Part attributes are attributes stored on the relations between items. Semantically, an attribute on the part shown below means that item2 has the attribute on the part when used as a part of item1:
Setting default attributes on a part is done in a similar way to adding default attributes on an item. You can select among the same attribute types described in this article, however, you also need to set the DefType of the part that the attribute is valid for (i.e., the defining object type that the part points to). Parts can point to abstract types of which only a subset should have attributes.
To set default attributes on parts, go back to the SystemWeaver Architect and click on the Metadata tab.
Select the part type for which you want to set a default attribute (in our example, "Relationship") and click Add Default Attribute:
In the Create Default Part Attribute dialog you will define the scenario where the new default attribute will be presented to users.
For If Def Type is, select the defining object type for which the new default attribute will apply by clicking the browse button. The Select Type dialog will display the available types to chose from based on the meta model. (In our example, it is item type "Inherited item type").
For then part should have Attribute Type, select the attribute to be set as a default and click OK. The default attribute is now set.
Using the Attributes View
To view the default attribute in the SystemWeaver client, open Explorer and create an item of the type that owns the part. For our example, we select "Inherited item type" which owns the "Relationship" part.
Right-click on the item and Add a new part of "Relationship" type. In the below example, we named the new part "Child". Select the Attributes view to display all default attributes. The default part attribute is displayed under Part Attributes.
Changing the Meta Model
This section describes the following topics related to changing a meta model:
- Removing Item Types
- Removing Part Types
- Changing Inheritance
- Changing the Owner of a Part Type
- Changing SIDs
- Viewing the Overview Report
All actions are completed in the Architect application.
Removing Item Types
Item types can be removed in the Architect by right-clicking on the type in the Item tree on the Metadata tab and selecting Delete.
Only item types that have no instances can be removed. If data have been created for the specific type, the type cannot be removed without removing the data. When you want to delete an Item Type, you must first:
- Delete any part type that has the item type as its DefType, or change the DefType to some other item type.
- Delete any sub-item type.
- Delete any existing items of the type, or change the item type of those either manually or by using refactoring).
More information on removing item types can be found in the Help.
Removing Part Types
Just as with item parts, part types can be removed in the Architect by right-clicking on the owning item type and selecting Delete.
Only part types that have no instances can be removed. If data have been created for the specific type, the type cannot be removed without removing the data
Tip: An alternative to deletion is to make the item or part type deprecated. This option could serve as a temporary solution while waiting for an opportunity to delete as described above.
To change what type an item type inherits from, right-click on the Parent field and select Set Parent. This operation might create items that have invalid parts in the client. If this is the case, do a data refactoring of the data.
Changing the Owner of a Part Type
On the Refactorings tab, there are a number of ways to change the meta model. One of the most common scenarios is to change the owner of a part type. A common case is when a new, possibly abstract type is created, and the ownership of a part type needs to be moved up in the inheritance structure, from a sub-type to a parent type. This is done using the Change Part Type Owner tool. Select the part type in the Change Owner of part type field using. The current parent item type will auto-populate in the from box. Select the new parent item type in the to box. When you are ready, click Execute to immediately kick off the refactoring. You must restart the server to see the change in Explorer.
No items are changed by this method, since it is a pure meta model change. To revert a change, you can move the ownership back to the original item type.
There may be scenarios where there is a clash between multiple uses of the same SID, e.g., by different SystemWeaver servers, between a SID used by a user organization and a predefined SID used by a domain solution. To change SIDs of item or part types, go to the Refractorings tab and select the Change Type SID tool.
Using the button, select the type that should get a new SID in the Change SID of box. The current SID will auto-populate in the from box. Enter the new SID in the to box.
The refactoring is performed immediately when clicking the Execute button.
To change SIDs of attributes, use the Change Attribute type SID tool which is also located on the Refactorings tab.
Note: The refactoring is not guaranteed to be complete in the sense that some additional changes may be required after the refactoring, e.g., changes in Config Items or reports. Such required additional changes can be identified by searching for the SID string in the specific attributes of the Config Items, using the search options available in the Explorer.
Viewing the Overview Report
The Reports feature provides Architects with input that can be useful during decision-making prior to any refactoring or changes are made to the meta model. To access the Reports feature, go to the Refactorings tab and click on Reports. Click Overview to obtain a Database Status Report in a RichView editor. The report gives an overview of what item, part and attribute types have been used and how often.
To find out more about what information this report provides, see the Help.
- Test a few of the meta model changes described above.
Learn more about the available Metadata and Refactoring features in the swArchitect Reference manual in the Help.