Page tree

MagicDraw 2022x Refresh1 Documentation

To find Requirements without text

  1. Create a Smart Package.
  2. Open its Specification window and click three dots next to the Query property to edit it. The Query dialog opens.
  3. Click Create operationFilter.

  4. Select Input > Find.
  5. Select Find and set the Type to Requirement.
  6. Select Predicate > Operation from Model > IfThenElse.

    If you cannot see the IfThenElse operation, make sure the Apply Filter box is not checked.

  7. Select Condition > Reset.

  8. Select Condition > Operation from Model > isEmpty.
  9. Select Input > Metachain Navigation.
  10. Click Insert
  11. Under Metaclass or Stereotype, select Requirement, and under Property, select Text.

  12. Select Then > Boolean. Set the Value to true.

  13. Select Else > Script.

  14. Select the Contextual Variable arg1Reset.  
  15. Select the Contextual Variable arg1 > Metachain Navigation
  16. Set Parameter Name to "text".
  17. Click Insert
  18. Under Metaclass or Stereotype, select Requirement, and under Property, select Text.

  19. From the Language drop-down list, select Groovy.
  20. Insert the following script as the Body:

    text.size() > 0 ? text.iterator().next().trim().length() == 0 : false ; 

  21. Click OK. You can view the requirements without text nested under the Smart Package in the Containment tree.

Sample model

The model used in these examples is the Case Studies for Querying the Model sample model. To open this model, you need to download case studies for querying the model.mdzip

  • No labels