Author Topic: Finding messages that are not operations  (Read 1942 times)

shimon

  • EA User
  • **
  • Posts: 83
  • Karma: +1/-0
    • View Profile
Finding messages that are not operations
« on: October 22, 2023, 04:18:11 pm »
Hi,
We have a conceptual System Engineering model which is implemented in various Subsystems by many subcontractors.
We use DDS topics to communicate between these subsystems.
I imported these topics as operations (this was a compromise, not the preferred way of doing it) and now I want to replace a large part of the messages with these operations / topics.
As a first step, I would like to find all messages, that don’t correspond to operations at all, and then I would like to find messages on specific diagrams that don’t correspond with the imported Topics.
I will continue to describe what I did so far, but would appreciate any input if this was already done.
Sincerely,
Shimon

P.S. I edited the post and changed methods to operations, as per qwerty's comment.
« Last Edit: October 23, 2023, 08:00:41 pm by shimon »

Richard Freggi

  • EA User
  • **
  • Posts: 473
  • Karma: +18/-7
    • View Profile
Re: Finding messages that are not methods
« Reply #1 on: October 23, 2023, 12:39:59 am »
Hmm if you are using UML sequence or collaboration diagrams for your application architecture you should be able to use messages (that require methods in the receiving class) and signals (that don't require methods).  This would make replacing, tracking and reporting really easy.

shimon

  • EA User
  • **
  • Posts: 83
  • Karma: +1/-0
    • View Profile
Re: Finding messages that are not methods
« Reply #2 on: October 23, 2023, 12:43:12 am »
We are using UML but EA does not "force" you to use Methods, so many of the messages are free text.

shimon

  • EA User
  • **
  • Posts: 83
  • Karma: +1/-0
    • View Profile
Re: Finding messages that are not methods
« Reply #3 on: October 23, 2023, 01:03:43 am »
I created a search of diagrams and connector names where connector type ==sequence and then went on to create a search for methods and checked if they match.
The problem is that the connector name includes parentheses (and parameters). I needed to trim from  the parentheses till  the end of the connector name.
I found how to do this for SQL server and for JET, but I didn't figure out how to use the function in the second select, where I check if connector.name  in (select method names . . . )
I only have a printout of the SQL, but I'll try to post it.
Shimon

qwerty

  • EA Guru
  • *****
  • Posts: 13433
  • Karma: +390/-299
  • I'm no guru at all
    • View Profile
Re: Finding messages that are not methods
« Reply #4 on: October 23, 2023, 10:48:07 am »
I had never looked into that, but t_connector.target2 seems to hold a non-zero value for messages coming from an operation (method is behavior!). I'll look into that tomorrow in detail.

q.

qwerty

  • EA Guru
  • *****
  • Posts: 13433
  • Karma: +390/-299
  • I'm no guru at all
    • View Profile
Re: Finding messages that are not operations
« Reply #5 on: October 24, 2023, 10:34:32 am »
That number was a non-causal coincidence. Still no idea why this very test example created a number there. However, I think I can say that "dummy" operations have no brackets at the end in t_connrctor.name while the "real" ones do. That's probably the way EA figures when an operation is renamed so the message is too. Will put that for further investigation on my list for Inside EA.

q.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 12784
  • Karma: +533/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Finding messages that are not operations
« Reply #6 on: October 24, 2023, 05:23:08 pm »
IIRC there's a tagged value on the connector with the operationID

Geert

shimon

  • EA User
  • **
  • Posts: 83
  • Karma: +1/-0
    • View Profile
Re: Finding messages that are not operations
« Reply #7 on: October 24, 2023, 05:57:39 pm »
Geert is right (as usual)
The OperationGUID is in the t_connectortag.VALUE.
When using this in SQL, you should probably use the Property as well. It is operation_guid in my small example.

Q, thanks for your input. So far I made a union between messages that contain a parentheses and messages that don't contain parentheses. You got me thinking that it might be possible to add parentheses without choosing an operation.
To check what you wrote, I added a message with the same spelling of an Operation and added parentheses, and then renamed the Operation to see if it will be reflected on the sequence diagram. It did not.
The next thing I did was export this small project to XMI and try to find the messages. The ones that were chosen from the Operation list had signature="   GUID ###########" added to the end of the line, so I understood that this must be saved somewhere.
After seeing Geert's comment, I looked through all the tables that start with t_connector and found the answer.

I just checked the consistency in the case that I choose on Operation of a Base Class or Interface, and it shows the correct operation.

The inconsistency is in the case that I delete an operation. The entry in the t_connectortag table is not deleted.
Using Geert's navigator, choosing the message and clicking on "Operation" gets the error, "Missing Operation". The message text displays the exact issue.
So I guess that I should still keep the check that the trimmed message is an existing Operation.
I haven't figured out how to check that an Operation is in the recieving Object or any of its base classes or any of its interfaces.
Sincerely,
Shimon


« Last Edit: October 24, 2023, 08:35:07 pm by shimon »

qwerty

  • EA Guru
  • *****
  • Posts: 13433
  • Karma: +390/-299
  • I'm no guru at all
    • View Profile
Re: Finding messages that are not operations
« Reply #8 on: October 24, 2023, 10:04:53 pm »
Hi Shimon,
as a matter of fact I'm already old and don't stop getting older. Also I'm no longer an EA power user for various reasons. You might send a bug report (or Sparx would likely only see it as feature request) that deleting an operation should warn about existing messages and/or clear the dangling links. I wouldn't bet much on seeing any Sparx activity in that area, though.

q.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 12784
  • Karma: +533/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Finding messages that are not operations
« Reply #9 on: October 24, 2023, 10:33:32 pm »
I haven't figured out how to check that an Operation is in the recieving Object or any of its base classes or any of its interfaces.

An operation has a ParentID that corresponds to the Object_ID of the owner in t_object

Geert

shimon

  • EA User
  • **
  • Posts: 83
  • Karma: +1/-0
    • View Profile
Re: Finding messages that are not operations
« Reply #10 on: October 25, 2023, 04:19:27 pm »
Hi Shimon,
as a matter of fact I'm already old and don't stop getting older. Also I'm no longer an EA power user for various reasons. You might send a bug report (or Sparx would likely only see it as feature request) that deleting an operation should warn about existing messages and/or clear the dangling links. I wouldn't bet much on seeing any Sparx activity in that area, though.

q.

Wishing you many more years of getting older in good health.
Shimon

shimon

  • EA User
  • **
  • Posts: 83
  • Karma: +1/-0
    • View Profile
Re: Finding messages that are not operations
« Reply #11 on: October 25, 2023, 04:28:27 pm »
I haven't figured out how to check that an Operation is in the recieving Object or any of its base classes or any of its interfaces.

An operation has a ParentID that corresponds to the Object_ID of the owner in t_object

Geert

I figured that out, but I now have to join all parents and grandparents, as it is perfectly legitimate to invoke an Operation of a Base Class.
Yesterday I figured that out too, by joinng the End_Object_ID of the relations (where  Connetor_type in Generalization and Realisation ) of the recieving Class etc.
I'll probably have to adjust it to include interfaces of ports. I hope to post the search soon.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 12784
  • Karma: +533/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Finding messages that are not operations
« Reply #12 on: October 25, 2023, 05:24:23 pm »
Yeah, you'll want to join a few levels.

In a somewhat sane design you shouldn't have more than 3 or 4 levels, so if you go up to 5 or 6 you should be good.

Geert

shimon

  • EA User
  • **
  • Posts: 83
  • Karma: +1/-0
    • View Profile
Re: Finding messages that are not operations
« Reply #13 on: October 25, 2023, 10:10:12 pm »
I went up 6 levels but got it to work only on SQL Server.
It ain't pretty.

I have to check why this is not working via  JET ( local eapx file).

Server.

« Last Edit: October 25, 2023, 10:18:19 pm by shimon »

shimon

  • EA User
  • **
  • Posts: 83
  • Karma: +1/-0
    • View Profile
Re: Finding messages that are not operations
« Reply #14 on: October 26, 2023, 12:21:56 am »
Find messages that are not operations of recieving class - V3
SELECT distinct  t_diagram.ea_guid AS CLASSGUID, 't_diagram' as CLASSTABLE, t_diagram.Diagram_Type AS CLASSTYPE, t_diagram.Name as diagramName ,sender.Name as msg_Sender,t_connector.Name as full_name,rcvr.Name as msg_Rcvr, t_connector.DiagramID,t_connector.SeqNo
FROM (((
t_connector
inner join t_diagram on t_connector.DiagramID = t_diagram.Diagram_ID)
inner join t_object as sender on t_connector.Start_Object_ID = sender.Object_ID )
inner join t_object as rcvr on t_connector.End_Object_ID = rcvr.Object_ID )
where t_connector.Connector_Type = 'Sequence'
and rcvr.Object_Type = 'Class'

#DB=SQLSVR# -- and t_diagram.Name = 'Nominal Seq.' #DB=SQLSVR#

#DB=SQLSVR# -- the following lines finds all messages that have a parentheses and don't match operations of recieving class
#DB=SQLSVR#
AND   
 
t_connector.Name LIKE '#WC#(#WC#'
#DB=SQLSVR#   AND left (t_connector.Name, CHARINDEX ('(',t_connector.Name)-1) #DB=SQLSVR#
#DB=JET# and left (t_connector.Name, InStr (t_connector.Name,'(')-1)  #DB=JET#
NOT IN ( select  name from t_operation where Object_ID =rcvr.Object_ID)
 
#DB=SQLSVR# -- the following lines finds all messages that have a parentheses and don't match operations of recieving class Base Classes
#DB=SQLSVR#

#DB=SQLSVR#   AND left (t_connector.Name, CHARINDEX ('(',t_connector.Name)-1) #DB=SQLSVR#
#DB=JET# and left (t_connector.Name, InStr (t_connector.Name,'(')-1)  #DB=JET#

NOT IN (

select  name from t_operation where Object_ID in
(
select distinct relatedObjects.Object_Id as objectid from (
select  'level_0' as level_, conn1.Start_Object_ID  as StartObject, conn1.Start_Object_ID  as Object_Id from 
t_connector   conn1
where  conn1.Connector_Type IN ('Realisation' , 'Generalization')
 
and ( conn1.Start_Object_id = rcvr.Object_ID) 

union all

select  'level_1' as level_, conn1.Start_Object_ID  as StartObject, conn1.End_Object_ID   from 
t_connector   conn1
where  conn1.Connector_Type IN ('Realisation' , 'Generalization')
 
and ( conn1.Start_Object_id = rcvr.Object_ID) 
 

union all

select   'level_2' as level_,conn1.Start_Object_ID  as StartObject, conn2.end_Object_ID   as Object_Id  from (
t_connector   conn1
inner join t_connector conn2 on conn1.End_Object_id = conn2.Start_Object_id)

where conn1.Connector_Type IN ('Realisation' , 'Generalization')
and  conn2.Connector_Type  IN ('Realisation' , 'Generalization')

and ( conn1.Start_Object_id = rcvr.Object_ID) 

 
union all

select   'level_3' as level_,conn1.Start_Object_ID  as StartObject, conn3.end_Object_ID   as Object_Id  from
((t_connector   conn1
inner join t_connector conn2 on conn1.End_Object_id = conn2.Start_Object_id)
inner join t_connector conn3 on conn2.End_Object_id = conn3.Start_Object_id)

where conn1.Connector_Type IN ('Realisation' , 'Generalization')
and  conn2.Connector_Type  IN ('Realisation' , 'Generalization')
and  conn3.Connector_Type  IN ('Realisation' , 'Generalization')

and ( conn1.Start_Object_id = rcvr.Object_ID) 

union all

select   'level_4' as level_,conn1.Start_Object_ID  as StartObject, conn4.end_Object_ID   as Object_Id  from
(((t_connector   conn1
inner join t_connector conn2 on conn1.End_Object_id = conn2.Start_Object_id)
inner join t_connector conn3 on conn2.End_Object_id = conn3.Start_Object_id)
inner join t_connector conn4 on conn3.End_Object_id = conn4.Start_Object_id)

where conn1.Connector_Type IN ('Realisation' , 'Generalization')
and  conn2.Connector_Type  IN ('Realisation' , 'Generalization')
and  conn3.Connector_Type  IN ('Realisation' , 'Generalization')
and conn4.Connector_Type   IN ('Realisation' , 'Generalization')
and ( conn1.Start_Object_id = rcvr.Object_ID) 
 
 
 union all


select   'level_5' as level_,conn1.Start_Object_ID  as StartObject, conn5.end_Object_ID   as Object_Id  from
((((t_connector   conn1
inner join t_connector conn2 on conn1.End_Object_id = conn2.Start_Object_id)
inner join t_connector conn3 on conn2.End_Object_id = conn3.Start_Object_id)
inner join t_connector conn4 on conn3.End_Object_id = conn4.Start_Object_id)
inner join t_connector conn5 on conn4.End_Object_id = conn5.Start_Object_id)


where conn1.Connector_Type IN ('Realisation' , 'Generalization')
and  conn2.Connector_Type  IN ('Realisation' , 'Generalization')
and  conn3.Connector_Type  IN ('Realisation' , 'Generalization')
and conn4.Connector_Type   IN ('Realisation' , 'Generalization')
and conn5.Connector_Type   IN ('Realisation' , 'Generalization')
and ( conn1.Start_Object_id = rcvr.Object_ID)   

) AS relatedObjects
)

)


 
union all

#DB=SQLSVR# -- the following lines finds all messages that don't have parentheses   #DB=SQLSVR#

SELECT distinct  t_diagram.ea_guid AS CLASSGUID, 't_diagram' as CLASSTABLE, t_diagram.Diagram_Type AS CLASSTYPE, t_diagram.Name as diagramName ,sender.Name as msg_Sender,t_connector.Name as full_name,rcvr.Name as msg_Rcvr, t_connector.DiagramID,t_connector.SeqNo
FROM (((
t_connector
inner join t_diagram on t_connector.DiagramID = t_diagram.Diagram_ID)
inner join t_object as sender on t_connector.Start_Object_ID = sender.Object_ID )
inner join t_object as rcvr on t_connector.End_Object_ID = rcvr.Object_ID )
where t_connector.Connector_Type = 'Sequence'

AND t_connector.Name NOT LIKE '#WC#(#WC#'

 #DB=SQLSVR# -- Find messages that are not operations of recieving class - V3 END
 #DB=SQLSVR#

;