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

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13404
  • Karma: +567/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Finding messages that are not operations
« Reply #15 on: October 26, 2023, 12:34:08 am »
Wow, that's quite the query.

What I sometimes do to simplify hiearchies like this, is to do left joins like this.
That often eliminates the need for unions on each level.

Code: [Select]
select o.* from (((((t_connector   conn1
left join t_connector conn2 on (conn1.End_Object_id = conn2.Start_Object_id
                                             conn1.Connector_Type IN ('Realisation' , 'Generalization')))
left join t_connector conn3 on conn2.End_Object_id = conn3.Start_Object_id)
                                             conn2.Connector_Type IN ('Realisation' , 'Generalization')))
left join t_connector conn4 on conn3.End_Object_id = conn4.Start_Object_id)
                                             conn3.Connector_Type IN ('Realisation' , 'Generalization')))
left join t_connector conn5 on conn4.End_Object_id = conn5.Start_Object_id)
                                             conn4.Connector_Type IN ('Realisation' , 'Generalization')))
inner join t_object o on o.Object_ID in (conn1.End_Object_id , conn2.End_Object_id , conn3.End_Object_id , conn4.End_Object_id ))
where con1.start_object_ID = ...

Also, be ware of the spelling of Realization and Generalization. I think they might have been mixed up in the past, so I would cater for both Realization and Realisation

Geert

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Finding messages that are not operations
« Reply #16 on: October 26, 2023, 03:34:14 am »
For me it's almost every time easier to have a simple query and code a bit in my standard language. Allows me to have queries which can be kept on a general level to work across multiple platforms.

q.

shimon

  • EA User
  • **
  • Posts: 167
  • Karma: +5/-0
    • View Profile
Re: Finding messages that are not operations
« Reply #17 on: October 26, 2023, 06:27:48 pm »
Geert,
Your solution is much neater than mine.
I couldn't get it to work  on JET for two reasons. It does not allow me to join on two criteria and does not allow to join on IN ( t1.id, t2.id).

Q,
You are right that is better to keep things simple, and that is the reason that I built the monster query in pieces.
I work in a closed (security conscious) environment, where I have no access to any programming environment.
I doubt that they'll allow me in bring any addon in.
Shimon


Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13404
  • Karma: +567/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Finding messages that are not operations
« Reply #18 on: October 26, 2023, 06:50:36 pm »
Joining on two conditions can be done using extra parentheses

left join table x on (x.columnA = y and x.ColumnB = z)

You can replace the IN () with
on (
o.Object_ID in = conn1.End_Object_id 
or o.Object_ID in =  conn2.End_Object_id
or o.Object_ID in =   conn3.End_Object_id
or o.Object_ID in =   conn4.End_Object_id )


or you move the IN() to the where clause. Since it's an inner join, that has the same result.

Geert

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13404
  • Karma: +567/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Finding messages that are not operations
« Reply #19 on: October 26, 2023, 06:52:33 pm »
I work in a closed (security conscious) environment, where I have no access to any programming environment.
I doubt that they'll allow me in bring any addon in.
Shimon
Have you tried the internal scripting of EA?
You IT Security department may consider that a risk though.

Geert

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Finding messages that are not operations
« Reply #20 on: October 26, 2023, 08:09:35 pm »
The internal IT security. You could make a sitcom from that :-/

q.

shimon

  • EA User
  • **
  • Posts: 167
  • Karma: +5/-0
    • View Profile
Re: Finding messages that are not operations
« Reply #21 on: October 29, 2023, 09:58:17 pm »
Ha Ha Ha,
The server based environment does not allow scripting. If I do choose to go that way (learn and use scripting), I will probably get them to create a group and allow this group to script.
Shimon

Jan van Duuren

  • EA Novice
  • *
  • Posts: 15
  • Karma: +1/-0
    • View Profile
Re: Finding messages that are not operations
« Reply #22 on: December 21, 2023, 06:13:58 pm »
I use the following SQL query (MySQL) to retrieve the linked operation of a message in a sequence diagram.

SELECT CONN.CONNECTOR_ID, IFACE.OBJECT_ID AS [INTERFACE_ID], IFACE.NAME AS [INTERFACE], IFACE.OBJECT_TYPE, OPER.OPERATIONID, OPER.NAME AS [OPERATION],
OPER.STYLE AS [REQUEST], OPER.TYPE AS [RETURN], CONN.PDATA4 AS [IS_RETURN]
FROM T_CONNECTOR CONN
LEFT JOIN T_CONNECTORTAG CONNTAG ON CONN.CONNECTOR_ID=CONNTAG.ELEMENTID AND CONNTAG.PROPERTY='operation_guid'
LEFT JOIN T_OPERATION OPER ON OPER.EA_GUID=CONNTAG.[VALUE]
LEFT JOIN T_OBJECT IFACE ON OPER.OBJECT_ID=IFACE.OBJECT_ID
WHERE CONN.CONNECTOR_ID IN (83509, 89807)


result:
CONNECTOR_ID;INTERFACE_ID;INTERFACE         ;OBJECT_TYPE;OPERATIONID;OPERATION         ;REQUEST;RETURN;IS_RETURN;
83509       ;32126       ;OneApp Vehicle API;Interface  ;11076      ;getParkingPosition;       ;void  ;0        ;
89807       ;            ;                  ;           ;           ;                  ;       ;      ;0        ;


first connector does have a linked operation
second connector does not have a linked operation
« Last Edit: December 21, 2023, 06:16:14 pm by Jan van Duuren »
EA scripting since 2013 (JScript, Javascript and Node.js)