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.
Container element into the
template content editor.
icon and select the Class type
cast for the ownedMember.
Paragraph element and place
it below the container element, and add the name of the package inside
the Class Container by dragging the Name(string) attribute.
Text element to the template
content editor.Adding a Class cast to the ownedMember element of a package allows you to define the following query, which returns only the definitions that are classes from the same context:
