Sparx Systems Forum
Enterprise Architect => General Board => Topic started by: EAUser on June 23, 2014, 09:20:21 pm
-
Dear EA community,
Is it possible to define a search for all elements that are linked to a specific Element I specify? In my search, I would like to further specify the type of link, i.e. find all elements linked via a 'Dependency' or a 'Realization'-Link. Which properties in the search do I need to use for that?
Thank you for your help!
-
Something like
SELECT d.name FROM t_object as s, t_object as d, t_connector where s.Object_ID = t_connector.Start_Object_ID and d.Object_ID = t_connector.End_Object_ID and s.ea_guid = "<Search Term>"
You need to extend it so the type is also included. Further you should supply the t_object.ea_guid AS CLASSGUID, t_object.Object_Type AS CLASSTYPE
to make the search result navigable.
q.
-
Here, try this
select c.ea_guid as CLASSGUID,c.object_type as CLASSTYPE,c.name as Name, c.stereotype as Stereotype ,con.Connector_Type,
package.name as PackageName ,package_p1.name as PackageLevel1,package_p2.name as PackageLevel2,
package_p3.name as PackageLevel3
from ((((((t_object c
inner join t_connector con on con.End_Object_ID = c.Object_ID)
inner join t_object so on con.Start_Object_ID = so.Object_ID)
inner join t_package as package on c.package_id = package.package_id)
left join t_package as package_p1 on package_p1.package_id = package.parent_id)
left join t_package as package_p2 on package_p2.package_id = package_p1.parent_id)
left join t_package as package_p3 on package_p3.package_id = package_p2.parent_id)
where so.Name like '<Search Term>'
and con.Connector_Type in ('Realisation','Realization', 'Dependency')
I've added both spelling variants of Realization just in case EA decides to get consistent and use Realization all over. ::)
Geert
-
Wow, this is great, works like a charm.
thank you, this has been a great help!
-
I think I have an idea about what this code is about, except for this part:
inner join t_package as package on c.package_id = package.package_id)
left join t_package as package_p1 on package_p1.package_id = package.parent_id)
left join t_package as package_p2 on package_p2.package_id = package_p1.parent_id)
left join t_package as package_p3 on package_p3.package_id = package_p2.parent_id)
could you help me out explaining what this is for?
I have tried to expand the script in order to only search for requirements linked to the search term object and at the same time linked to a category object cat.
This gives me an error which I am unable to determine, does anybody know what I would have to change?
select c.ea_guid as CLASSGUID,c.object_type as CLASSTYPE,c.name as Name, c.stereotype as Stereotype ,con.Connector_Type,con2.Connector_Type,
package.name as PackageName ,package_p1.name as PackageLevel1,package_p2.name as PackageLevel2,
package_p3.name as PackageLevel3
from ((((((((t_object c
inner join t_connector con on con.End_Object_ID = c.Object_ID)
inner join t_object so on con.Start_Object_ID = so.Object_ID)
inner join t_connector con2 on con2.End_Object_ID = c.Object_ID)
inner join t_object cat on con2.Start_Object_ID = cat.Object_ID)
inner join t_package as package on c.package_id = package.package_id)
left join t_package as package_p1 on package_p1.package_id = package.parent_id)
left join t_package as package_p2 on package_p2.package_id = package_p1.parent_id)
left join t_package as package_p3 on package_p3.package_id = package_p2.parent_id)
where so.Name like '<Search Term>'
and con.Connector_Type in ('Dependency')
and con2.Connector_Type in ('Realization','Realisation')
and cat.Name like 'Category YY'
Furthermore, how can I specify to restrict the search only on requirements, at best only requirements of the type 'functional' ?
-
Well, in case Geert wont answer: this is not a SQL forum. You're probably on your own when it comes to correcting complex SQL :-/
q.
-
I think I have an idea about what this code is about, except for this part:
inner join t_package as package on c.package_id = package.package_id)
left join t_package as package_p1 on package_p1.package_id = package.parent_id)
left join t_package as package_p2 on package_p2.package_id = package_p1.parent_id)
left join t_package as package_p3 on package_p3.package_id = package_p2.parent_id)
could you help me out explaining what this is for?
That returns the package hierarchy up to four levels upwards. It usually helps to determine the context of the search result.
I have tried to expand the script in order to only search for requirements linked to the search term object and at the same time linked to a category object cat.
This gives me an error which I am unable to determine, does anybody know what I would have to change?
I just tried that one and it ran without error.
Anyway, in any circumstance, if you are seeking help with regards to an error you should always include the actual error message.
"an error" rarely yields usable results when googling.
Furthermore, how can I specify to restrict the search only on requirements, at best only requirements of the type 'functional' ?
"Requirement" is the object_type, "functional" is the stereotype.
You are probably OK using the stereotype field, except when using multiple stereotypes. In that case you'll have to query t_xref as well.
Geert
-
Thank you Geert, that helps!
Concerning the code, turns out it was just some brackets that were missing around the 'and' statements...