archimatetool / archi

Archi: ArchiMate Modelling Tool
https://www.archimatetool.com
MIT License
914 stars 267 forks source link

Label Expressions - add msource and mtarget expressions #972

Closed Phillipus closed 8 months ago

Phillipus commented 8 months ago

There seems to be a need from some users to access source and target of relations at the model level rather than the visual connection level. See

https://forum.archimatetool.com/index.php?topic=1432.0 https://github.com/archimatetool/archi/issues/970 https://github.com/archimatetool/archi/issues/713

Perhaps we could add msource and mtarget expressions to get the model objects? I have actually written the code to do this sometime ago.

@jbsarrodie WDYT?

jbsarrodie commented 8 months ago

I've had a need for this some time ago, so it's worth having a look at it.

Perhaps we could add msource and mtarget expressions to get the model objects?

I wonder if we actually need dedicated expressions for that or if the existing source and target could be extended: when getting the list of relationships matching the criteria, we could make sure we have those shown on the view first, and those coming from the model after. As we pick the first one to render expression, this doesn't change anything for currently supported use-case.

BTW, I have a small list of enhancements to label expressions, maybe I could do it for the upcoming version of Archi.

Phillipus commented 8 months ago

I wonder if we actually need dedicated expressions for that or if the existing source and target could be extended: when getting the list of relationships matching the criteria, we could make sure we have those shown on the view first, and those coming from the model after. As we pick the first one to render expression, this doesn't change anything for currently supported use-case.

Good idea.

~But why check for view connections first, why not just use model relationship in all cases? If the view connection exists then it will be the same as the model relationship. If not, it will also be the model relationship.~

Phillipus commented 8 months ago

But why check for view connections first, why not just use model relationship in all cases? If the view connection exists then it will be the same as the model relationship. If not, it will also be the model relationship.

Ignore that. There may be several relations/connection to/from the object and some may be on the view and some may not.

Phillipus commented 8 months ago

I've implemented this in branch label-expressions now. Will use the model relationship if there are no diagram connections.

Given the label expression $serving:source{name}

  1. If there is one or more Serving diagram connections leading to the object it will reference the first one found.
  2. If there are no Serving diagram connections leading to the object it will reference the first model relationship found.
Phillipus commented 8 months ago

This is in Archi 5.2.

romualdrichard commented 6 months ago

Hi,

Sorry about that, I tried this and I certainly messed somewhere. With $association:source{name} I have "Feuille de temps" on the flow relation even if the Data Object is not in the view With $serving:source{name} I have nothing Capture d’écran 2024-01-04 160752