See an example of a nested query from a Rational® Tau data
source schema.
The following example shows the nested query assigned
to a IBM® Rational Tau template
element.
The first query, model/root(Package),
is performed in the context of the Rational Tau model.
The second query, model/root(Package)/ownedMember,
is performed on each package returned by the first query.
If
the list of all classes from the top level packages in model is needed,
the query is
model/root(Package)/ownedMember(Class).
In this form, the output document no longer contains the name of each
package. A class list is built in the same way as it in the first
case. The query is split into its component queries, and each query
runs in the context defined by the previous queries:
Table 1. Sub queriesSub query |
Context |
Result |
model |
Not applicable |
the model |
model/root(Package) |
model |
list of packages |
ownedMember(Class) |
list of packages |
list of classes |
Each sub query is performed once for every element, and the
results of each execution are concatenated. These results become the
context for the next subquery, or the results list, if the subquery
is the last one.