Publisher and Web Interface > Publisher > Developing document definitions > Overview of developing document definitions (Publisher) > Worked example: extracting items through extended model item types - Stereotypes (Publisher)
  
Worked example: extracting items through extended model item types - Stereotypes (Publisher)
This is one of five worked examples that relate to developing document structures:
Worked example: extracting items through model item types
Worked example: extracting items through child roles and child types
Worked example: extracting items through extended model item types (stereotypes)
Worked example: extracting diagrams and their items
Worked example: extracting specific items
If you are working with an ergonomic profile, you will often want to extract items and diagrams that have been created by the profile, that is, stereotyped items and diagrams. Likewise, if you have created stereotypes in a model, you may want to extract items or diagrams from that stereotype.
This worked example demonstrates the use of a stereotype to extract items from a model, and the development of that stereotype to extract items that are associated through a reference tag definition. This example uses the Word output format.
In this worked example, we create a document definition that extracts the following information from a model that includes stereotypes and diagrams:
All the My Stereotype1 Items, including the Full Scoped Name property of each stereotype item.
For each Stereotype item: all the Stereotype Diagrams it is responsible for, that is, My Stereotype Item that are linked to each My Stereotype Diagram through the projectResponsibility alias.
This example uses the following model:
The My Stereotype1 item1 is linked to My Stereotype Diagram1 through the projectResponsibility alias. The My Stereotype Diagram 1 is not linked to any actual projects.
Defining the extraction of Actual Organization
In this example, we start by opening the publication model in Modeler, and creating a new empty Document Definition.
We ensure that Publisher is showing all the panes required to define a Document Definition by clicking the Full Editor Layout toolbar button.
We want our generated document to have a heading for each Stereotype in the model and we want each heading to be followed by its full scoped name; so we need to add a Stereotype to our document structure. Adding a Stereotype to our document will extract all stereotype items from the model, that is, it behaves like a model item type.
We select the Body icon in the document structure, click My Stereotype1, and then select the Stereotype.
After adding MyStereotype1 it can be seen in the document structure.
We generate the document and the following text appears in the Word document.
We want to make the following changes:
We want to change the first heading to 'MY STEREOTYPE1S'.
We want only the Full Scoped Name property to be generated.
We change the first heading to 'MY STEREOTYPE1S' by selecting the 'MyStereotypes1 item in the document structure, and then in the Properties pane changing the Title Text property to 'MyStereotype1s'.
In the Properties pane, we can see that the Name, FullScopedName, Description and DynamicUmlClassName properties are extracted.
We remove the Name, Description and DynamicUmlClassName properties by selecting each property and clicking the Delete Item button in turn to leave only the FullScopedName property.
We save the changes and then generate the document again. The first heading now states, MY STEREOTYPE1S and only the Full Scoped Name property is included for each Stereotype Item.
Defining the extraction of associated Actual Projects
After the heading and full scoped name text that is generated for each stereotype, we want to generate a heading for each stereotype that is performed by the stereotype. For each stereotype, we want to generate its Full Scoped Name property prefixed by the property name.
To do this we extend the definition of the stereotype item that we created in the document structure.
We want to extract stereotypes that are linked to the extracted stereotypes through the projectResponsibility role, which the UPDM profile has created through a reference tag definition.
In the document structure we select the stereotype item, click the Add Modeler Child Role Section button, select the Tag Definitions check box, and then select the projectResponsibility role.
We do not want the heading in the generated document to be named 'responsibleFor', so we change the Title Text property to 'Linked MyStereotypeDiagrams'.
We do not want to extract the standard properties (Name, FullScopedName, Description and DynamicUmlClassName) for each stereotype that is extracted through the projectResponsibility role, so we change the extracted properties to extract only the FullScopedName property.
We save the changes and then generate the document. The Word document includes the following text. All the My Stereotype1s in the model are generated; for each stereotype, the stereotype diagram it is responsible for are also generated.
In this worked example, we have demonstrated how to extract items that are stereotyped by a specific diagram.