Creating EMF data sets

An Eclipse Modeling Framework (EMF) data set is a database in table format whose rows and columns are mapped from an EMF data source. The data set is formatted so that you can use Business Intelligence and Reporting Tools (BIRT) to generate reports from it.

The data source that you use must exist before you start this task. To create a new data source, see the related task named "Creating EMF data sources."

  1. Open the Report Explorer view. Click Window > Show View > Other > Reporting > Report Explorer.
  2. In the Report Explorer view, right-click a report design; then click Open.
  3. Open the Data Explorer view. Click Window > Show View > Other > Report Design > Data Explorer.
  4. In the Data Explorer view, right-click Data Sets; then click New Data Set.

    If you want to join data from multiple tables, you can also click New Joint Data Set. For additional information, see the topic "How to join data sets" in the Field Guide to BIRT.

  5. Type a name for the data set, select EMF Data Set as the type, select a data source, and click Next.
  6. On the Query Parameters page, list all the query parameters that you need to define queries in the data set; then click Next. Use this page to add, remove, reorder, and rename parameters. Parameters on this page are identified by the internal name of the parameter. The internal name is the name that you use in XPath expressions, so it must conform to XPath naming conventions for variables; it must start with a letter or underscore (_), and can contain any sequence of letters, digits, or underscore characters. Changes that you make on this page also appear on the Parameters page; see step 10.

    Parameters are a flexible and powerful tool that allow you to include many special types of information in reports. For information about how you can use parameters, see the related concept named "Parameters in EMF and UML data sets."

    Note: After you define a parameter, you can refer to it in both row-mapping and column-mapping queries by using its internal name preceded by a dollar sign ($).
  7. Define the row mapping for the data set. You define a collection of elements that form the rows of a table and that specify the element types. To define the row mapping, complete the following steps:
    1. Browse to select one of the models specified in the data source that you are using.
    2. To define the row mapping, specify an XPath expression. For example, to map all classes in the model, the expression is //Class and the type is Class.
      Note: When you write row-mapping XPath expressions, remember that root is the resource instance. For more information about XPath syntax, see the related links at the end of this topic.
      You can type the expression directly, or build it from elements in the EMF structure, which you add to the Expression field by selecting a node in the EMF structure and then clicking the right arrow (>) button.
    3. If the expression starts from a parameter as a context, and not from the root of the resource, you can deselect the check box for Evaluate for every data source instance model. This can improve performance, because the expression does not need to run for every resource.
    4. Select an element in the EMF structure that has the type required for the XPath expression; then click the right arrow (>) button for the Type field. For example, for //Class, the result type is Class.
    5. Click Next.
  8. Define the table columns for your data set. For column-defining XPath expressions, root is an object of the type that you specified for the return type in the previous step. You can define columns either by typing the values for them directly in the matrix or by completing the following steps:
    1. Click Browse to display a type to browse.
    2. Select an entry in the tree to use as a table column and click the right arrow (>) button.
    3. Specify all the columns that you need. You can delete columns, or change their order, by clicking the buttons to the right of the Column Mapping matrix.
    4. Adjust the values for Query and Type for each column as necessary.
  9. After you configure the table, click Finish. The Edit Data Set window opens.
  10. If the data set includes parameters, use the Parameters page of the Edit Data Set window to complete the definition of the parameters. Specify the display name, which is initially set to the internal name; the type, which is initially set to String; the direction, which is initially set to Input; and the name of the report parameter, if any, to bind to the data set parameter. When you bind values to a data set parameter on the Property Binding page, you use the parameter display name.
  11. You can continue to edit, click Preview Results to check your work, or click OK to close the window.
    Note: To modify your data set at any time, in the Data Explorer view, right-click the data set; then click Edit.
You can now use the BIRT feature to complete the report design, incorporating elements from the data set. For information, see the Field Guide to BIRT.
Related information
Syntax for XPath 1.0
IBM Rational Technote: Frequently asked questions about authoring Model Reports using BIRT
Field Guide to BIRT

Feedback