Hi Arshad,
If you open the properties dialog, you can see which profile was used to create the element by looking at the tagged value sections on the left. There's one called "Tagged Values", which contains tagged values which do not derive from any profile. Tagged values which do derive from a profile will be grouped in a separate node of the same name, so there will be a node called either "BPMN", "BPMN1.1" or "BPMN2.0". So that's how you can do it in the GUI.
In the database, the obscure magic table t_xref contains this information. The following search will show you the profiles:
select t_object.ea_guid as CLASSGUID, t_object.Object_Type as CLASSTYPE, t_object.Name, t_xref.Description
from t_object, t_xref
where t_object.Stereotype = 'Activity'
and t_xref.Client = t_object.ea_guid
and t_xref.Description like '@STEREO%'(Note that you may need to replace the wildcard character '%' in the last clause depending on the DB engine.) So that's how you can do it in SQL.
To my knowledge the t_xref table is not accessible through the Element class in the API. But in this specific case you're dealing with BPMN Activities, so there's a way out.
The Element.CustomProperties collection is used by EA to store various things, including the default composite diagram type, which you can use to retrieve the profile.
This simple VBScript browser script lists an element's custom properties.
option explicit
!INC Local Scripts.EAConstants-VBScript
sub OnProjectBrowserScript()
dim treeSelectedType
treeSelectedType = Repository.GetTreeSelectedItemType()
Repository.EnsureOutputVisible "Script"
select case treeSelectedType
case otElement
dim theElement as EA.Element
set theElement = Repository.GetTreeSelectedObject()
dim i
for i = 0 to theElement.CustomProperties.Count - 1
Session.Output theElement.CustomProperties(i).Name & ": " & theElement.CustomProperties(i).Value
next
case else
Session.Prompt "This script does not support items of this type.", promptOK
end select
end sub
OnProjectBrowserScript
Run that on any BPMN Activity or BusinessProcess and you'll see that they include the property "_defaultDiagramType" with the value "BPMN::BPMN", "BPMN1.1::BPMN", etc (and there may be other useful properties as well).
You can easily scan for the different BPMN versions in these properties.
HTH,
/Uffe