Example: Type casting in Engineering Rhapsody

Type casting refines the results of a query and allows the product to treat .xsd schema types as being from a different type, similar to cast operations in programming languages. A type is not assigned to schema elements that can have more than one valid type. You define the types for these elements with the cast to type feature in the Data Source view.

About this task

Type casting works as an alternate filter for data source elements. A cast query filters the results of the regular query to return only the elements that can be cast to the selected type. After the type is selected, it becomes available in the Data Source View under the anyType element. Queries built using cast allow access to all the child elements and attributes of the type cast. The result set returned by a cast query is identical to the result set returned by a query that is filtered with an equivalent IsKindOf predicate. The difference between the cast query and filtered query is that a cast query gives access to the cast type attributes and child elements while the filtered query does not.


  1. From the Palette view, drag a Container icon Container element into the template content editor.
  2. From the Data Source View, drag the ownedMember class into the container element.
  3. Optional: Name the container Class Container for easier reference.
  4. Click the Cast to type icon Cast to Type icon to add the Class type cast for the ownedMember.
  5. Add a Paragraph icon Paragraph element beneath the container element.
  6. From the Data Source View, drag the Name(string) attribute into the Class Container to add the name of the package.