Metric - Helmut-Ortmann/EnterpriseArchitect_hoTools GitHub Wiki

Metric

For processes like SPICE and Functional Safety you need

This page shows you with the focus on metrics:

  • SQL
  • Visualization in EA

The Examples you find at GitHub, ScriptDotNet.eap

Mechanismn

Beneath you see some mechanism to accomplish metrics and visualisations. Always keep in mind:

  • Diagrams are powerful to communicate understanding
  • Tables and Matrixes are powerful to find and analyse
  • Charts help you get the big picture
  • Excel & Co suits you well for advanced requirements
  • Scripts and advanced analyse-tools like LinqPad help you to dig deep in the data

Check sql

SQL is your basic tool to accomplish this. Here you find some useful references.

Combine Multiple columns

select "Count Objects" As Metric, t1.CountAll, t2.CountClass, t3.ClassWithOutLinks, t4.ClassWithInLinks, t5.ClassNoLinks, t6.ClassWithLinks, t5.ClassNoLinks + t6.ClassWithLinks As [Sum Classes to check]
from
    (Select count(o.name) As CountAll from t_object o ) As t1,
    (Select count(o.name) As CountClass from t_object o where o.object_type = "Class") As t2,
    (Select count(o.name) As ClassWithOutLinks
        from t_object o where o.object_type = "Class" AND exists (select * from t_connector c where c.start_object_id = o.object_id) ) as t3,
    (Select count(o.name) As ClassWithInLinks
        from t_object o where o.object_type = "Class" AND exists (select * from t_connector c where c.end_object_id = o.object_id) ) as t4,
    (Select count(o.name) As ClassNoLinks
         from t_object o where o.object_type = "Class" AND NOT exists (select * from t_connector c where c.end_object_id = o.object_id or c.start_object_id = o.object_id) ) as t5,
    (Select count(o.name) As ClassWithLinks
        from t_object o where o.object_type = "Class" AND exists (select * from t_connector c where c.end_object_id = o.object_id or c.start_object_id = o.object_id) ) as t6

Multiple Comumns

Combine Multiple rows

select "Count Classes" As Metric, t2.Count, t3.WithOutLinks As [with Out-Links], t4.WithInLinks As [with In-Links], t5.NoLinks as [no Links], t6.WithLinks as [with Links],
        t5.NoLinks + t6.WithLinks As [Sum to check]
from
    (Select count(o.name) As Count from t_object o where o.object_type = "Class") As t2,
    (Select count(o.name) As WithOutLinks
        from t_object o where o.object_type = "Class" AND exists (select * from t_connector c where c.start_object_id = o.object_id) ) as t3,
    (Select count(o.name) As WithInLinks
        from t_object o where o.object_type = "Class" AND exists (select * from t_connector c where c.end_object_id = o.object_id) ) as t4,
    (Select count(o.name) As NoLinks
         from t_object o where o.object_type = "Class" AND NOT exists (select * from t_connector c where c.end_object_id = o.object_id or c.start_object_id = o.object_id) ) as t5,
    (Select count(o.name) As WithLinks
        from t_object o where o.object_type = "Class" AND exists (select * from t_connector c where c.end_object_id = o.object_id or c.start_object_id = o.object_id) ) as t6

UNION
select "Count Parts" As Metric, t2.Count, t3.WithOutLinks, t4.WithInLinks, t5.NoLinks, t6.WithLinks, t5.NoLinks + t6.WithLinks
from
    (Select count(o.name) As Count from t_object o where o.object_type = "Part") As t2,
    (Select count(o.name) As WithOutLinks
        from t_object o where o.object_type = "Part" AND exists (select * from t_connector c where c.start_object_id = o.object_id) ) as t3,
    (Select count(o.name) As WithInLinks
        from t_object o where o.object_type = "Part" AND exists (select * from t_connector c where c.end_object_id = o.object_id) ) as t4,
    (Select count(o.name) As NoLinks
         from t_object o where o.object_type = "Part" AND NOT exists (select * from t_connector c where c.end_object_id = o.object_id or c.start_object_id = o.object_id) ) as t5,
    (Select count(o.name) As WithLinks
        from t_object o where o.object_type = "Part" AND exists (select * from t_connector c where c.end_object_id = o.object_id or c.start_object_id = o.object_id) ) as t6

Order by 1

Multiple Rows and Comumns

Package, Tagged Value

You have to use a LEFT JOIN for Tagged Values because of possible NULL values.

select o.ea_guid AS CLASSGUID , o.object_type AS CLASSTYPE,
    p.Name as [Package], o.name As [Requirement],  
    Left(o.Note,100) As [Description],
    pASIL.Value  As ASIL
from (t_object o
inner join t_package p on o.Package_id = p.Package_id)
left join t_objectproperties pASIL on pASIL.object_id = o.object_id

where
o.object_type = "Requirement"
order by 3, 4, 6

Tagged Values

GROUP BY

Use the column number, here count(2), instead of count(pASIL.Value), to also count NULL values of the ASIL level.

select
    p.Name as [Package],
    pASIL.Value As ASIL,
    count(2) As Count
from (t_object o
inner join t_package p on o.Package_id = p.Package_id)
left join t_objectproperties pASIL on pASIL.object_id = o.object_id

where
o.object_type = "Requirement"

group by p.Name,pASIL.Value
order by 1,2

Tagged Values

Use Model View

SQL

select
    p.Name as [Package],
    pASIL.Value As ASIL,
    count(2) As Count
from (t_object o
inner join t_package p on o.Package_id = p.Package_id)
left join t_objectproperties pASIL on pASIL.object_id = o.object_id

where
o.object_type = "Requirement"

group by p.Name,pASIL.Value
order by 1,2

ModelView

Edit the View

With Context Menu, Edit List View you have powerfull list functions:

  • Filter
  • Sort
  • Choose column
  • Navigate to Browser/Diagram

ModelView ModelView

Charts

Different Visualisations

Bar

Different Visualisations

select    pASIL.Value As [Series],
    p.Name As [GroupName]
from (t_object o
inner join t_package p on o.Package_id = p.Package_id)
left join t_objectproperties pASIL on pASIL.object_id = o.object_id

where
o.object_type = "Requirement"

Pie

Different Visualisations

select    pASIL.Value As [Series]
from (t_object o
inner join t_package p on o.Package_id = p.Package_id)
left join t_objectproperties pASIL on pASIL.object_id = o.object_id

where
o.object_type = "Requirement"

Excel

You can export Searches to Excel & Co for further analysis.

EA Standard

  1. Run the SQL Query with EA
  2. Export to CSV or use the Clipboard

hoTools

hoTools allows you to run Queries to Excel, Export to Excel.

Remember

Glossary

Term Description
Heat Map A heat map uses a warm-to-cool color spectrum to quickly show you important things.A heat map is a two-dimensional representation of data in which values are represented by colors. A simple heat map provides an immediate visual summary of information. More elaborate heat maps allow the viewer to understand complex data sets. A powerful tool to intuively understand complex data

References