Retrieve Referenced Model Element in Doc. Composer

Visual Paradigm support created reference between any model elements or diagrams. This help in elaborate your models without being limited to a specific notations or resources. For example, you can use an Entity table to elaborate the data structure on database of an Actor. Visual Paradigm Doc. Composer allows you to create professional documentation with fully customizable templates. In Doc. Composer you are not limit to retrieve just the reference relationship between models, you can also output the detail information of the referenced elements. In this article we will show you how it works.

Assume we have an Actor which is reference to an Entity model and a Class model to elaborate its details.

Actor having reference to class and entity models

To retrieve the referenced entity and class models from actor in Doc. Composer:

  1. Suppose we are using Build from Scratch mode in Doc. Composer, select the actor model in Model Explorer tree.

    Select actor model in Model Explorer

  2. Right click on the References template and select Duplicate from popup menu.

    Duplicate the References template

  3. Name the template as ReferenceModel.

    Name the duplicaed template as ReferenceModel

  4. Replace the template content with the following code.
    <?xml version="1.0" encoding="UTF-8"?>
    <AnyBaseInitiationBlock>
      <HasValueChecker property="references">
        <Text style="@heading+">References</Text>
        <ParagraphBreak/>
        <TableBlock>
          <TableRow>
            <TableCell><Text>Name</Text></TableCell>
            <TableCell><Text>Model Type</Text></TableCell>
            <TableCell><Text>Description</Text></TableCell>
          </TableRow>		
          <ForEach property="references">
            <ValueChecker property="type" value="Model Element">
              <ModelElementProperty property="url">
                <TableRow>
                  <TableCell><Property property="name"/></TableCell>
                  <TableCell><Property property="modelType"/></TableCell>
                  <TableCell><Property property="description"/></TableCell>
                </TableRow>										
              </ModelElementProperty>
            </ValueChecker>
          </ForEach>
        </TableBlock>
      </HasValueChecker>
    </AnyBaseInitiationBlock>
  5. Press OK button to confirm the change and close Edit Template.
  6. Drag the ReferenceModel template from Template pane into document editor.

    Drag & drop the template into document

  7. Now the name referenced model elements as well as their model type and description are show in the table.

    Detail of reference model elements now showing in document

Understand the template

  1. There are multiple types of references available in Visual Paradigm, which can be reference of UML, reference of files, reference to diagrams, and also reference to model elements. To retrieve the model element the actor referenced we need to make sure it is a model element type reference. We can use the type property of the reference to determine what type of reference it is, and we proceed if the reference is in Model Element.
    <ForEach property="references">
      <ValueChecker property="type" value="Model Element">
  2. When the reference is a Model Element type reference, we can use the url property to find out the ID of the referenced element. The ID is a string value and we can use the ModelElementProperty node to parse it into the model element it referencing. And within the ModelElementProperty node it will be working on the referenced model element.
    <ModelElementProperty property="url">

Related Know-how

Related Link

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply