Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » [RESOLVED] Cardinalities on begin/end labels
[RESOLVED] Cardinalities on begin/end labels [message #1767742] Mon, 10 July 2017 13:56 Go to next message
sonny selhorst is currently offline sonny selhorstFriend
Messages: 60
Registered: May 2015
Member
Dear,

I would like to add variable cardinalities to the begin/end labels of my bi-directional relationships in my modelling tool, with a name added to them as well. Before I start changing things up in my meta-model, I thought I'd ask first on how this exactly can be reached.

What I am aiming for is to have cardinalities that can be modified as in Ecore Tools, so having 0..1 for example, in which you can change the 0 and the 1 in properties. There should also be a name possible for those cardinalities, the same as in EcoreTools.

I am guessing that I would have to use AQL to write an expression for the begin/end label in which the cardinalities are involved?

Is there any place where I could find the meta-meta-model for Ecore Tools?

Thank you very much.

Kind regards,

Sonny

[Updated on: Sat, 29 July 2017 11:28]

Report message to a moderator

Re: Cardinalities on begin/end labels [message #1767744 is a reply to message #1767742] Mon, 10 July 2017 14:33 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6996
Registered: July 2009
Senior Member
Hi

It is very unusual to use multiplicities other than 0, 1, *. Occasionally I have seen 2, so I would question whether you are over-modeling. Variable bounds seems even more dubious, potentially something saved with one set of bounds might become invalid later. I recommend that you use constraints to diagnose excessive content rather than tooling to mandate it. Ecore has no support for variable bounds. UML does though I expect that attempting to do so will provoke bugs in most tools that you try to use, since quite apart from anything else you would have to use a non-UML (e.g. OCL) ValueSpecification to define the 'UML' value.

Ecore.ecore is available in the org.eclipse.emf.ecore plugin. Directly loadable in the Sample core Editor. Or see the EMF book. Or google.

Regards

Ed Willink

Re: Cardinalities on begin/end labels [message #1767751 is a reply to message #1767742] Mon, 10 July 2017 15:44 Go to previous messageGo to next message
Maxime Porhel is currently offline Maxime PorhelFriend
Messages: 500
Registered: July 2009
Location: Nantes, France
Senior Member
Hi,

It seems that you would like to add "Smart" direct edit and labels in your modeler as in Ecore Tools (https://wiki.eclipse.org/Ecore_Tools) : the label is computed from various properties of the element represented by an edge for exemple and then you can type type "name:String", or "[1]", or ":Integer" and the modeler will figure what you meant.

You should look in the VSM defined for EcoreTools: http://git.eclipse.org/c/ecoretools/org.eclipse.ecoretools.git/tree/org.eclipse.emf.ecoretools.design

In ecore.odesign, you should look into the EC_EReference edge mapping and its label descriptions, you will see that the label expression is service:render.

Then you can look the DirectEditLabel tool named "EReference Name", there is no edit mask (as described in https://www.eclipse.org/sirius/doc/specifier/diagrams/Diagrams.html#tools_specification) in this case because all the tricks are done in a Java service as shown by the expression service:performEdit(arg0)

You can find both Java services in http://git.eclipse.org/c/ecoretools/org.eclipse.ecoretools.git/tree/org.eclipse.emf.ecoretools.design/src/org/eclipse/emf/ecoretools/design/service/EReferenceServices.java

The label are computed from the name, lowerBound, upperBound and type features of the EMF meta model EReference type.

Regards;

Maxime

Re: Cardinalities on begin/end labels [message #1769273 is a reply to message #1767751] Fri, 28 July 2017 13:34 Go to previous messageGo to next message
sonny selhorst is currently offline sonny selhorstFriend
Messages: 60
Registered: May 2015
Member
Hey Maxime, thank you for your straightforward response, it answered all my questions.

The problem now is that I am limited in my knowledge of Java. I should have expected that Ecore wouldn't solely be programmed with an MDD but also with manual code manipulation.
I would like to make my EER tool without the necessity of manual code manipulation, thus making the most out of Sirius.

Something that I was thinking that could maybe solve this problem for me, with my knowledge, is to make a bordered node out of a class named "Role" that has the attributes "Name", "Lower Bound" and "Upper Bound". I could then design this feature to have an invisible bordered node on each entity with a label written in AQL, so that it displays "[" + LowerBound + ".." + UpperBound + "]" + roleName.

But then there is the problem that the roles should be inherently linked to the relationship between two entities. Would it be possible to automatically have two bordered nodes created (on each of the entities between which the relationship counts) when a bi-directional relationship is created?

I will add my current meta-model to give you more of an idea.

I am sorry if I sound confusing, if you need me to clarify anything, please ask and I will answer within a day.

Thank you so much in advance and for all the help you have already given me.

https://ibb.co/iUNgaQ
Re: Cardinalities on begin/end labels [message #1769274 is a reply to message #1767751] Fri, 28 July 2017 13:34 Go to previous messageGo to next message
sonny selhorst is currently offline sonny selhorstFriend
Messages: 60
Registered: May 2015
Member
Hey Maxime, thank you for your straightforward response, it answered all my questions.

The problem now is that I am limited in my knowledge of Java. I should have expected that Ecore wouldn't solely be programmed with an MDD but also with manual code manipulation.
I would like to make my EER tool without the necessity of manual code manipulation, thus making the most out of Sirius.

Something that I was thinking that could maybe solve this problem for me, with my knowledge, is to make a bordered node out of a class named "Role" that has the attributes "Name", "Lower Bound" and "Upper Bound". I could then design this feature to have an invisible bordered node on each entity with a label written in AQL, so that it displays "[" + LowerBound + ".." + UpperBound + "]" + roleName.

But then there is the problem that the roles should be inherently linked to the relationship between two entities. Would it be possible to automatically have two bordered nodes created (on each of the entities between which the relationship counts) when a bi-directional relationship is created?

I will add my current meta-model to give you more of an idea.

I am sorry if I sound confusing, if you need me to clarify anything, please ask and I will answer within a day.

Thank you so much in advance and for all the help you have already given me.

https://ibb.co/iUNgaQ
Re: Cardinalities on begin/end labels [message #1769275 is a reply to message #1767751] Fri, 28 July 2017 13:34 Go to previous messageGo to next message
sonny selhorst is currently offline sonny selhorstFriend
Messages: 60
Registered: May 2015
Member
Hey Maxime, thank you for your straightforward response, it answered all my questions.

The problem now is that I am limited in my knowledge of Java. I should have expected that Ecore wouldn't solely be programmed with an MDD but also with manual code manipulation.
I would like to make my EER tool without the necessity of manual code manipulation, thus making the most out of Sirius.

Something that I was thinking that could maybe solve this problem for me, with my knowledge, is to make a bordered node out of a class named "Role" that has the attributes "Name", "Lower Bound" and "Upper Bound". I could then design this feature to have an invisible bordered node on each entity with a label written in AQL, so that it displays "[" + LowerBound + ".." + UpperBound + "]" + roleName.

But then there is the problem that the roles should be inherently linked to the relationship between two entities. Would it be possible to automatically have two bordered nodes created (on each of the entities between which the relationship counts) when a bi-directional relationship is created?

I will add my current meta-model to give you more of an idea.

I am sorry if I sound confusing, if you need me to clarify anything, please ask and I will answer within a day.

Thank you so much in advance and for all the help you have already given me.

https://ibb.co/iUNgaQ
Re: Cardinalities on begin/end labels [message #1769316 is a reply to message #1769275] Sat, 29 July 2017 11:27 Go to previous message
sonny selhorst is currently offline sonny selhorstFriend
Messages: 60
Registered: May 2015
Member
I have found a solution. So no need to respond anymore, thank you!
Previous Topic:When delete edge
Next Topic:[RESOLVED] Variable label icons
Goto Forum:
  


Current Time: Wed Jan 27 11:29:09 GMT 2021

Powered by FUDForum. Page generated in 0.02261 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top