Compartir a través de


How to: Query UML Data in Modeling Services

[This content is no longer valid. For the latest information on "M", "Quadrant", SQL Server Modeling Services, and the Repository, see the Model Citizen blog.]

This is the third topic in the Walkthrough: Using the Microsoft.Uml2 Domain. The preceding topic is How to: Browse the UML Data in "Quadrant"; the following topic is How to: Export UML Data as an .xmi File. This topic shows how to use Microsoft code name “Quadrant” to query the UML data loaded in How to: Load an .xmi File By Using "Quadrant".

Querying UML data in “Quadrant”

  1. On the File menu, click New, and then click Workpad to create an empty workpad.

    Shows the empty workpad.

  2. Type the following Microsoft code name “M” query syntax to show all the packages within the DinnerNowDesign folder, and then press Enter.

    Microsoft.Uml2.Packages 
       where value.Folder == 
       (Repository.Item.FoldersTable where value.Name == "DinnerNowDesign" select value.Id).Choose 
    

    Shows the results of a query in "Quadrant".

  3. Switch the workpad’s viewer to UML Packages Browser.

    Shows the results of a query in "Quadrant".

  4. Expand the Dinner Now Class Model – Lucerne Integrated Payment System to find details about its child elements.

    Shows the results of a query in "Quadrant".

  5. Change the workpad’s viewer to List view.

    Shows the results of a query in "Quadrant".

  6. Modify the previous query to show only those packages that contain the name Data within the DinnerNowDesign folder.

    Microsoft.Uml2.Packages 
       where value.Name == "Data" && value.Folder == 
       (Repository.Item.FoldersTable where value.Name == "DinnerNowDesign" select value.Id).Choose
    

    Shows the results of a query in "Quadrant".

  7. Reuse the workpad query bar to test various queries.

    Note

    Make sure you set the viewer for the workpad to List before executing these queries.

    1. Select all packages that are root packages.

      Microsoft.Uml2.Packages where value.OwningPackage == null
      

      Shows the results of a query in "Quadrant".

    2. Show all packages that have a class in them. For more information, see Classes Function (Microsoft.Uml2 Module).

      from p in Microsoft.Uml2.Packages
      from c in Microsoft.Uml2.Classes
      where p.Id == c.OwningPackage && c.ElementKind == "Class"
      select {PackageName=>p.Name, ClassName=>c.Name}
      

      Shows the results of a query in "Quadrant".

    3. Find the total number of components in the Modeling Services database. For more information, see Components Function - Microsoft.Uml2 Module.

      Microsoft.Uml2.Components.Count()
      

      Shows the results of a query in "Quadrant".

See Also

Tasks

Walkthrough: Using the Microsoft.Uml2 Domain