Adding common types of model information to reports

You can design Business Intelligence Reporting Tools (BIRT) reports to incorporate all types of information that EMF and UML models provide. For certain types of information that are commonly included in reports, such as model element documentation, you must follow special procedures. This topic provides specific instructions for adding the most common types of information and identifies the corresponding element that you must add to your report design.

Before you begin

About this task

Some report design elements depend on custom XPath functions. For information about authoring and deploying XPath functions, see the topic "Writing custom XPath functions." For a list of additional XPath functions that are shipped with your IBM® Rational® product and that are useful for designing reports, see the topic "Additional XPath functions for EMF and UML data sets."

Procedure

The following table includes specific instructions for adding types of model information to BIRT reports:
Information to include in report Corresponding report design element
Documentation for model elements
To add the documentation for a model element to a report design, add the following column mapping to the data set:
  • Name: documentation
  • Expression: getElementsWithStereotype(ownedComment, 'Default::Documentation')[1]/@body
  • Type: String
Use a dynamic text element for this column, not a label element. When you use dynamic text, the documentation in the report is formatted the same way as in the model; when you use a label, HTML tags are generated in the report.

The function getElementsWithStereotype is included with your IBM Rational product.

List of profiles that are applied to a model

For an example, see the Applied Profiles data set in the Blank UML Model Report (blankUMLModelReport.rptdesign), which you can access from the Report Explorer view.

List of stereotypes that are applied to an element
Create a UML data set with the following characteristics:
  • Parameter: element
  • Row Mapping:
    • Expression: oclEvaluate(resolveURI($element), "self.getAppliedStereotypes()")
    • Type: uml:Stereotype

When you use the data set in a report design, set the parameter value to the URI of a model element.

List of classes that are directly in a package
Create a UML data set with the following characteristics:
  • Parameter: package
  • Row Mapping:
    • Expression: oclQuery(resolveURI($package)/packagedElement, "self.oclIsKindOf(uml::Class)")
    • Type: uml:Class

When you use the data set in a report design, set the parameter value to the URI of a package in the model.

List of attributes that are in a class, with their types

For an example, see the Classes with Attributes data set in the Blank UML Model Report (blankUMLModelReport.rptdesign), which you can access from the Report Explorer view.

List of operations that are in a class, with their return types

For an example, see the Classes with Attributes data set in the Blank UML Model Report (blankUMLModelReport.rptdesign), which you can access from the Report Explorer view.

Including a list of operations in a class is similar to including a list of attributes in a class, but you use operations instead of attributes.

List of parameters (other than “return”) that are in an operation, with their types
Create a UML data set with the following characteristics:
  • Parameter: operation
  • Row Mapping:
    • Expression: oclQuery(resolveURI($operation)/ownedParameter, "self.direction <> ParameterDirectionKind::return")
    • Type: uml:Parameter
  • Column Mapping: typeName, type/@name, String

When you use the data set in a report design, set the parameter value to the URI of an operation in the model.

List of exceptions that an operation throws
Create a UML data set with the following characteristics:
  • Parameter: operation
  • Row Mapping:
    • Expression: resolveURI($operation)/raisedException
    • Type: uml:Type

When you use the data set in a report design, set the parameter value to the URI of an operation in the model.

List of all classes that implement an interface
Create a UML data set with the following characteristics:
  • Parameter: interface
  • Row Mapping:
    • Expression: oclEvaluate(resolveURI($interface), "InterfaceRealization.allInstances()->select(i | i.supplier->includes(self))")
    • Type: uml:InterfaceRealization
  • Column Mapping:
    • clientName, client[1]/@name,, String
    • clientURI, getURI(client[1]), String

When you use the data set in your report design, set the parameter value to the URI of an interface in the model.

List of all interfaces that a class implements
Create a UML data set with the following characteristics:
  • Parameter: class
  • Row Mapping:
    • Expression: oclEvaluate(resolveURI($class), "InterfaceRealization.allInstances()->select(i | i.client->includes(self))")
    • Type: uml:InterfaceRealization
  • Column Mapping:
    • supplierName, supplier[1]/@name, String
    • supplierURI, getURI(supplier[1]), String

When you use the data set in a report design, set the parameter value to the URI of a class in the model.

List of all classes that inherit from a class For an example, see the Subclasses data set in the UML Model Metric Report (umlModelMetrics.rptdesign).
List of all classes that a class inherits from
Create a UML data set with the following characteristics:
  • Parameter: class
  • Row Mapping:
    • Expression: resolveURI($class)/superClass
    • Type: uml:Classifier

When you use the data set in a report design, set the parameter value to the URI of a class in the model.

List of the fully qualified names of all classes that a class has a directed association to, with target role name, visibility, and multiplicity
Create a UML data set with the following characteristics:
  • Parameter: class
  • Row Mapping:
    • Expression: oclQuery(resolveURI($class)/ownedAttribute, "Association.allInstances()->select(a|a.memberEnd->includes(self))->notEmpty()")
    • Type: uml:Property
  • Column Mapping:
    • targetRoleName, @name, String
    • visibility, @visibility, String
    • multiplicity, concat(concat(@lower,".."), @upper), String

When you use the data set in a report design, set the parameter value to the URI of a class in the model.

Use cases associated to an actor
Create a UML data set with the following characteristics:
  • Parameter: actor
  • Row Mapping:
    • Expression: oclEvaluate(resolveURI($actor), "Association.allInstances()->select(a|a.endType->includes(self) and a.endType->select(t|t.oclIsKindOf(uml::UseCase))->notEmpty())->collect(a|a.endType->select(t|t <> self))")
    • Type: uml:UseCase

When you use the data set in a report design, set the parameter value to the URI of an actor in the model.

Actors associated with a use case
Create a UML data set with the following characteristics:
  • Parameter: usecase
  • Row Mapping:
    • Expression: oclEvaluate(resolveURI($usecase), "Association.allInstances()->select(a|a.endType->includes(self) and a.endType->select(t|t.oclIsKindOf(uml::Actor))->notEmpty()) ->collect(a|a.endType->select(t|t <> self))")
    • Type: uml:Actor

When you use the data set in a report design, set the parameter value to the URI of a use case in the model.

For a class diagram, a list of classes that are in the diagram
Create a UML data set with the following characteristics:
  • Parameter: diagram
  • Row Mapping:
    • Expression: oclEvaluate(resolveURI($diagram), "self.children->select(c|c.element.oclIsKindOf(uml::Class))->collect(c|c.element)")
    • Type: uml:Class

When you use the data set in a report design, set the parameter value to the URI of a diagram in the model.

For a sequence diagram, a list of object names and types of the lifelines
Create a UML data set with the following characteristics:
  • Parameter: sequenceDiagram
  • Row Mapping:
    • Expression: oclEvaluate(resolveURI($sequenceDiagram), "self.element.oclAsType(uml::Interaction).lifeline->collect(l|l.represents)")
    • Type: uml:ConnectableElement
    Column Mapping:
    • objectName, @name, String
    • typeName, type/@name, String
When you use the data set in a report design, set the parameter value to the URI of a sequence diagram in the model.
For a sequence diagram, for each lifeline, which messages go to that lifeline
Create a UML data set with the following characteristics:
  • Parameter: lifeline
  • Row Mapping:
    • Expression: oclEvaluate(resolveURI($lifeline), "self.coveredBy->select(c|c.oclIsKindOf(uml::MessageOccurrenceSpecification))->select(m|m.oclAsType(uml::MessageOccurrenceSpecification).event->any(true).oclIsKindOf(uml::ReceiveOperationEvent))->collect(m|m.oclAsType(uml::MessageOccurrenceSpecification).message)")
    • Type: uml:Message
  • Column Mapping:
    • messageName, @name, String
    • signatureName, signature/@name, String
When you use the data set in a report design, set the parameter value to the URI of a lifeline from a sequence diagram in the model.
For a sequence diagram, a list of only the top-level messages

Top-level messages are messages sent from gates on the interaction.

Create a UML data set with the following characteristics:
  • Parameter: sequenceDiagram
  • Row Mapping:
    • Expression: oclEvaluate(resolveURI($sequenceDiagram), "self.element.oclAsType(uml::Interaction).formalGate->collect(g|g.message)")
    • Type: uml:Message
  • Column Mapping:
    • messageName, @name, String
    • signatureName, signature/@name, String
When you use the data set in a report design, set the parameter value to the URI of a sequence diagram in the model.
For a structured classifier, a list of ports
Create a UML data set with the following characteristics:
  • Parameter: structuredClassifier
  • Row Mapping:
    • Expression: resolveURI($structuredClassifier)/ownedPort
    • Type: uml:Port
When you use the data set in a report design, set the parameter value to the URI of a structured classifier in the model.
For a port, a list of provided interfaces
Create a UML data set with the following characteristics:
  • Parameter: port
  • Row Mapping:
    • Expression: resolveURI($port)/provided
    • Type: uml:Interface
When you use the data set in a report design, set the parameter value to the URI of a port in the model.
For a port, a list of required interfaces
Create a UML data set with the following characteristics:
  • Parameter: port
  • Row Mapping:
    • Expression: resolveURI($port)/required
    • Type: uml:Interface
When you use the data set in your report design, set the parameter value to the the URI of a port in the model.
For an activity diagram, a list of partitions

Create a UML data set with the following characteristics:
  • Parameter: activityDiagram
  • Row Mapping:
    • Expression: resolveURI($activityDiagram)/element/partition
    • Type: uml:ActivityPartition
When you use the data set in a report design, set the parameter value to the URI of an activity diagram in the model.
For an activity diagram, a list of data stores
Create a UML data set with the following characteristics:
  • Parameter: activityDiagram
  • Row Mapping:
    • Expression: oclEvaluate(resolveURI($activityDiagram), "self.element.oclAsType(uml::Activity).node->select(n|n.oclIsKindOf(uml::DataStoreNode))")
    • Type: uml:DataStoreNode
When you use the data set in a report design, set the parameter value to the URI of an activity diagram in the model.
For an activity diagram, a list of central buffers whose classifiers have a particular stereotype

The stereotype in this scenario is "Business Modeling::BusinessWorker"

Create a UML data set with the following characteristics:
  • Parameter: activityDiagram
  • Row Mapping:
    • Expression: oclEvaluate(resolveURI($activityDiagram), "self.element.oclAsType(uml::Activity).node->select(n|n.oclIsKindOf(uml::CentralBufferNode))->select(c|c.oclAsType(uml::CentralBufferNode).type.isStereotypeApplied(c.oclAsType(uml::CentralBufferNode).type.getApplicableStereotype('Business Modeling::BusinessWorker')))")
    • Type: uml:CentralBufferNode
When you use the data set in a report design, set the parameter value to the URI of an activity diagram in the model.
For an activity diagram, a list of types in object flows
Create a UML data set with the following characteristics:
  • Parameter: activityDiagram
  • Row Mapping:
    • Expression: oclEvaluate(resolveURI($activityDiagram), "self.element.oclAsType(uml::Activity).edge->select(e|e.oclIsKindOf(uml::ObjectFlow))")
    • Type: uml:ObjectFlow
  • Column Mapping:
    • sourceType, oclEvaluate(source, "self.oclAsType(uml::ObjectNode).type")/@name, String
    • targetType, oclEvaluate(target, "self.oclAsType(uml::ObjectNode).type")/@name, String

When you use the data set in a report design, set the parameter value to the URI of an activity diagram in the model.

For a state diagram, a list of state names
Create a UML data set with the following characteristics:
  • Parameter: statechartDiagram
  • Row Mapping:
    • Expression: oclEvaluate(resolveURI($statechartDiagram), "self.element.oclAsType(uml::StateMachine).region->collect(r|r.subvertex)")
    • Type: uml:State
When you use the data set in a report design, set the parameter value to the URI of a statechart diagram in the model.
For a state in a state diagram, a list of transitions to states
Create a UML data set with the following characteristics:
  • Parameter: state
  • Row Mapping:
    • Expression: resolveURI($state)/outgoing/target
    • Type: uml:Vertex
When you use the data set in a report design, set the parameter value to the URI of a state in the model.
UML diagram images

Create a UML data set with the following characteristics:

  • Row mapping:
    • Expression: //Diagram, for example. This maps all the diagrams from the model.
    • Type: Diagram
  • Column mapping: Define a column for the diagram image.
The column-mapping query depends on which of the following methods you use to create the images:
  1. This method is for HTML reports and other reports with unlimited page size only, and for images that can be rendered by division into tiles.

    Example: getDiagramHtmlImage(".", $genPath, $tileWidth, $tileHeight)

    When you write a column definition with this query, assign the name and string for the type.

    The images in the generated report have the original size of the diagram and the full resolution, but are divided into tiles of the size specified in the query. For additional information about the function, see the topic "Additional XPath functions for EMF and UML data sets."

    Note: After you define the data set, you can create a Table control in the report layout design, bind it to the diagram data set, and insert a Dynamic Text control in the table's detail row. Set the text expression row["image"]. Set the width and height of the text control to 100% of the parent so that the image is not clipped.
  2. This method is for all report formats, especially those with defined page sizes such as PDF and Microsoft® Word, and for images that can be rendered with a maximum resolution.

    Example: getDiagramImage(".", $maxResWidth, $maxResHeight)

    When you write a column definition with this query, assign the name and blob for the type.

    For additional information about the function, see the topic "Additional XPath functions for EMF and UML data sets."

    After you define the data set is defined, you can create a Table control in the report layout design, bind it to the diagram data set, and insert an Image control in the table's detail row. Set the image to Dynamic and assign a URI of row["image"]. Make sure to set the width and height of the image control to 100% of the parent so that the image is not clipped.

For information about designing reports, see the Field Guide to BIRT.

What to do next

Note: Some information, such as links to Eclipse documentation or to developer guides, is available only from the help topics that are installed with the product.

Feedback