Book a Demo

Author Topic: Model Consistency: find duplicate element names  (Read 7981 times)

Rouven

  • EA User
  • **
  • Posts: 48
  • Karma: +0/-0
    • View Profile
Model Consistency: find duplicate element names
« on: August 16, 2011, 06:09:33 pm »
Hi everyone,

I have a model that is keeping on growing with several new classes or data types created each day. These types are distributed across multiple packages, maintained by different designers.
While the different packages may even make it legal to use the same element name in different contexts (as far as I have seen EA would even allow the same element name in the same package), the question is: is there a search or does somebody have a script that performs a quick consistency check and points out whether the names in use are unique?
If not I guess I'd have to write one, which could be as simple as a single SQL query, but...

Thanks anyway!
Rouven

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Model Consistency: find duplicate element name
« Reply #1 on: August 16, 2011, 06:20:24 pm »
I haven't seen a query like that, but I sure would be a nice contribution for the community site

Geert

OpenIT Solutions

  • EA User
  • **
  • Posts: 555
  • Karma: +9/-1
    • View Profile
Re: Model Consistency: find duplicate element name
« Reply #2 on: August 16, 2011, 08:49:07 pm »
Hi,

I wrote some SQL (and put it into a Model View search) to highlight duplicate elements in the model. This might help? (you could tweak it to only highlight duplicates of a specified element type)

SELECT
t_package.name AS Package, t_object.ea_guid AS CLASSGUID, t_object.Object_Type AS CLASSTYPE,t_object.Name AS Object, t_object.Object_Type AS [Type], t_object.Stereotype, t_object.Scope,t_object.Status, t_object.Phase, t_object.CreatedDate, t_object.ModifiedDate
FROM
t_object, t_package
WHERE t_object.package_id = t_package.package_id and t_object.name in
      (select name from t_object group by name having count (name) > 1)

Regards,

Jon.

Rouven

  • EA User
  • **
  • Posts: 48
  • Karma: +0/-0
    • View Profile
Re: Model Consistency: find duplicate element name
« Reply #3 on: August 17, 2011, 01:25:56 am »
Seems to work, struggled a little to figure out that it needs to be reduced to a single line (at least in my EA) SQL editor to run, otherwise it complains about reserved words or other misleading SQL errors.

Thanks for the input, the statement is about what I had in mind.

Giu Platania

  • EA User
  • **
  • Posts: 88
  • Karma: +4/-0
  • As Above so Below
    • View Profile
    • Linkedin
Re: Model Consistency: find duplicate element names
« Reply #4 on: April 27, 2018, 05:06:37 am »
I'm using this script to identify duplicates, but from the result search I cannot select all the duplicates and delete them.
Any clever way how to do this?
Giuseppe Platania
Enterprise Architect
Door Business Consulting
+++
"As above so below, to accomplish the miracles of the One Thing" - Trismegistus
===
The above content reflects my own opinion and is not endorsed by Monthy Python
***
The above is NOT a reference to Monty Python

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Model Consistency: find duplicate element names
« Reply #5 on: April 27, 2018, 06:03:04 am »
I had no problem selecting multiple rows from a search result and deleting the elements with Ctrl-DEL.

q.

Nizam

  • Prolab Moderator
  • EA User
  • *
  • Posts: 320
  • Karma: +15/-2
  • Model Sharing - Simplified
    • View Profile
    • Professional Model Collaboration
Re: Model Consistency: find duplicate element names
« Reply #6 on: April 27, 2018, 09:32:53 am »
I'm using this script to identify duplicates, but from the result search I cannot select all the duplicates and delete them.
Any clever way how to do this?

Just a note that to do any further operations from search results you need the following field t_object.ea_guid AS CLASSGUID