Home / eaSheets Homepage / eaSheets Help / Smart Tags / Smart Tags
Smart Tags
Smart Tags work by collecting together a number of related elements, and doing an arithmetic operation on the tagged values of those elements. The idea is to use the power of EA to give structure to a set of elements, by arranging them into a hierarchy, and use some simple arithmetic to understand more about what that structure means.
One Smart Tag operates on a single type of tagged value. Smart Tags finds all the elements related to to a ‘parent’ element, and finds the value of the tagged value that each child element has, then does the arithmetic operation on that collection of values.
Smart Tag definition
The definition of a Smart Tag has two parts:
- the name of the tagged value to look for
- the arithmetic operation to apply to all child elements.
Currently, you cannot define how children are discovered.
The arithmetic is the simple part. Find the sum of some values, or the maximum of a set of numbers.
Collecting all the values to use in that arithmetic is more difficult.
Valid Relationships
A Smart Tag will collect all the child elements using four kinds of relationship:
- UML aggregation
- UML composition
- Archimate aggregation (implemented in EA as stereotype of an Association relationship)
- EA Parent / child relationships.
Smart Tags applies these rules recursively at all levels.
For example, if Component 1 is made up of Components 2 and 3 (related by aggregation and composition), and Component 1 also has a child Component 1.1, then smart tags will collect elements 2,3 and 1.1. it will then look for the aggregates, composites and children of those children. In this example, all the elements when are children of Component 1. Note that there may be other children of any of these elements which are not shown in the diagram. (also, the two Archimate components do have the ‘OPEX’ tagged value, but EA doesn’t show it).
SmartTags first creates a list of elements which it’s going to look at, and finds the specified tagged value which any of those elements might have. If it finds an element which doesn’t have the tagged value, it will carry on looking for children, until the tree runs out. Also, if any of these element themselves have the same Smart Tag defined, these will be ignored – SmartTags only operates on the individual tagged values. Instead, Smart Tags will carry on looking at the children of such an element.
Potential issues
There is an obvious danger to this approach. The algorithm which walks the tree does not currently detect circular relationships. So if element 1 consists of 2, and 2 of 3, if 3 also consists of 1 then the algorithm will blow up, and you’ll get an error. This probably represents an error in the model, so it’s worth checking this before defining and calculating Smart Tags.
Other relationship types
SmartTags currently uses just the 4 relationship types as described above, but in some modeling styles you may use other types of relationship to describe this kind of “containment’ hierarchy.
If you need additional relationship types to use SmartTags, then please contact the eaTeamWorks team, and explain what you need. Our aim is to make SmartTags model-agnostic, so we may in future allow you to define your own relationship types, in addition to those built-in to the algorithm today.
Other arithmetic operators
SmartTags currently supports the SUM, MAX, MIN, Average and CountIf operators. If you need more, again please contact the eaTeamWorks team.
Data types
SmartTags currently only understands two data types: numbers (specifically decimal numbers) and dates. (Using CountIf to count string values may count as another data type).
We think these should be enough for 90% of cases, and it’s the responsibility of the user to make sure youâre not adding values in kW with values in W, for example.
Combining multiple tagged value types.
Currently you cannot use SmartTags to combine multiple value types. For example, if you have two tagged values “Winter cost” and “Summer cost” you can’t combine them to make “annual cost”.
How to get the most from SmartTags
We suggest that a model manager should maintain a list of SmartTag rules, in the same way that EA allows for a managed list of simple Tagged Value Types, These SmartTag definitions are stored in the repository, so that they can easily be copied between different repositories, baselined, and secured against accidental changes.
You can find the list of defined SmartTag rules from the main EA menu, Specialize/ eaSheets/ Manage SmartTags
Note that when you create an SmartTag in an element, it takes a copy of the SmartTag rule and saves it in the new Smart Tag. So if you change the central rule definition, or delete it, the SmartTags you have defined are not changed. We think this is safer.
Using SmartTags Safely
In order to be valid, SmartTags need to re-calculate their value. So before you use them, it’s a good idea to make them re-calculate. You can do this easily by putting elements which have SmartTags on a diagram, then choosing Specialize / eaSheets / Recalculate SmartTags.
SmartTags will automatically recalculate when new aggregate or composite connectors are added directly to them, but not when such relationships are added to their children. To recalculate when this happens would be a performance overhead.