Book a Demo

Author Topic: Connectors in MDG  (Read 3542 times)

GrahamL

  • EA User
  • **
  • Posts: 111
  • Karma: +2/-0
    • View Profile
Connectors in MDG
« on: June 07, 2020, 10:26:41 pm »
Hi
I am developing an MDG and have defined the stereotypes for my elements
Now I want to define a connector that can only be used to link elements of a certain type but am not sure how to do this.
I defined a sterotype for my connector but cannot see how to to restrict its use.
Please can you give an example as to how to achieve this

Thanks

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13471
  • Karma: +571/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Connectors in MDG
« Reply #1 on: June 08, 2020, 01:12:33 am »
There's two ways. You can create a meta-constraint from your connector stereotype to the source and target, specifying the umlRole, or you can create a «stereotyped relationship» from your source stereotype to your target stereotype, and fill in your connector stereotype name in the tagged value.

More about these connectors here: https://www.sparxsystems.com/enterprise_architect_user_guide/15.1/modeling/metamodelconstraints.html

Geert

GrahamL

  • EA User
  • **
  • Posts: 111
  • Karma: +2/-0
    • View Profile
Re: Connectors in MDG
« Reply #2 on: June 08, 2020, 05:44:22 pm »
Thanks for that
What is the method for limiting the use of my connector to only link 2 particular sterotypes in only one direction.

I have many stereotypes and have defined a sterotyped connector. This connector should only be used between 2 particular element types and only in one direction.

Thanks

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13471
  • Karma: +571/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Connectors in MDG
« Reply #3 on: June 08, 2020, 06:03:59 pm »
You can use both.

«stereotyped relationship» is less work as you only need to create a single relation (instead of two meta-constraints)

Geert

GrahamL

  • EA User
  • **
  • Posts: 111
  • Karma: +2/-0
    • View Profile
Re: Connectors in MDG
« Reply #4 on: June 08, 2020, 09:03:11 pm »
I tried both ways, but cannot get it working
My stereotyped connector has a metatype of InContextOf
The 2 elements I want to be availabel for the connector are called Context and Goal so I added a <<stereotyped relationship>> between the two.
In the Tags for this relationship I have set sterotype to InContextOf
When I use the profile I am able to use my new connector in both directions between Goal and Context but I only want one direction
I can also use the new connector between Goal and any of the other elements which I don't want to be able to happen

I'm clearly not understanding how to achieve this.

Any help is much appreciated

Thanks

Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: Connectors in MDG
« Reply #5 on: June 08, 2020, 09:41:06 pm »
Hi Graham,


I tried both ways, but cannot get it working
My stereotyped connector has a metatype of InContextOf
The 2 elements I want to be availabel for the connector are called Context and Goal so I added a <<stereotyped relationship>> between the two.
In the Tags for this relationship I have set sterotype to InContextOf
You should set the connector's stereotype tag to the name of the stereotype class, not the _metatype attribute.

Quote
When I use the profile I am able to use my new connector in both directions between Goal and Context but I only want one direction
This is odd. My understanding is that in order to allow the connector in either direction you actually need to create two stereotyped relationships, one in either direction between the two stereotypes.

If you've drawn a stereotyped relationship from Goal to Context, it might be that the relationship shows up as an option when you draw a connector from a Context to a Goal, but if you select it, EA actually creates the reverse relationship (from Goal to Context).

You should definitely set the _MeaningForwards and _MeaningBackwards special attributes in the connector metaclass. These are used for the quick linker popup menu so they're very helpful when debugging.

Quote
I can also use the new connector between Goal and any of the other elements which I don't want to be able to happen
Are your stereotypes generalizations of each other? That would explain this behaviour.

Quote
I'm clearly not understanding how to achieve this.
This is fairly new functionality still, and unfortunately it doesn't appear to be completely thought through. But what you describe is simple enough that it should have been covered by even EA's QA.

HTH,


/Uffe
My theories are always correct, just apply them to the right reality.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8090
  • Karma: +118/-20
    • View Profile
Re: Connectors in MDG
« Reply #6 on: June 09, 2020, 10:19:43 am »
When I use the profile I am able to use my new connector in both directions between Goal and Context but I only want one direction
I can also use the new connector between Goal and any of the other elements which I don't want to be able to happen

First, make sure you have Strict Connector Syntax enabled. If you don't, just like the UML rules, your rules won't be enforced. It won't show up in the quicklinker, but you can still create it using the toolbox.

If you've drawn a stereotyped relationship from Goal to Context, it might be that the relationship shows up as an option when you draw a connector from a Context to a Goal, but if you select it, EA actually creates the reverse relationship (from Goal to Context).

You should definitely set the _MeaningForwards and _MeaningBackwards special attributes in the connector metaclass. These are used for the quick linker popup menu so they're very helpful when debugging.

Other than that, it's a bit hard to help without seeing the actual structure of your profile. Below is a profile I just created to ensure it works. Compare the stereotypedrelationship element with one exported from your technology.

Code: [Select]
<?xml  version='1.0' encoding='windows-1252' ?>
<UMLProfile profiletype="uml2">
<Documentation id="33239B07-6" name="Contexts" notes="Contexts" version="1.0"/>
<Content>
<Stereotypes>
<Stereotype name="Context" notes="">
<stereotypedrelationships>
<stereotypedrelationship constraint="Contexts::Goal" stereotype="Contexts::contextOf"/>
</stereotypedrelationships>
<AppliesTo>
<Apply type="Class"/>
</AppliesTo>
</Stereotype>
<Stereotype metatype="IsContextOf" name="contextOf" notes="">
<AppliesTo>
<Apply type="Dependency">
<Property name="_MeaningBackwards" value="In Context"/>
<Property name="_MeaningForwards" value="Is Context Of"/>
</Apply>
</AppliesTo>
</Stereotype>
<Stereotype name="Goal" notes="">
<AppliesTo>
<Apply type="Class"/>
</AppliesTo>
</Stereotype>
</Stereotypes>
<TaggedValueTypes/>
<ViewDefinitions/>
<Metamodel/>
</Content>
</UMLProfile>