Certain AQL services are especially useful when working with M2Doc in medini. Following is a list of examples with typical usage. These services also appear in other examples in this guide.
For more information about these services, see the AQL documentation.
To find all elements below an object, use .eAllContents().
Using the .eAllContents() function is similar to using the medini analyze
Finder with .all() (use no arguments to find all elements) or
.findByType() (find elements of a certain type). The function returns a
sequence, which is a list that can include duplicates.
In the following example, the function lists all SafetyRequirement
elements in the model's safetygoals object.
{m:myRequirementsModel.eAllContents(safetygoals::SafetyRequirement)}To filter a list for a given condition, use ->select(x|...), where
x is an iteration variable and ... is an AQL expression.
The function filters the elements for which the AQL expression is true.
The function returns a sequence (a list that can include duplicates) or an ordered set (a list that does not allow duplicates). The output depends on the input type.
In the following example, the list returned by .eAllContents is filtered
for safety requirement IDs that begin with SR.
{m:myRequirementsModel.eAllContents(safetygoals::SafetyRequirement)
->select(req|req.identifier.startsWith('SR'))}