Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Modeling (top-level project) » Modelling Attribute Dependencies
Modelling Attribute Dependencies [message #1734202] Mon, 06 June 2016 07:04 Go to next message
Xi Ng is currently offline Xi NgFriend
Messages: 26
Registered: June 2016
Junior Member
Hello,

I am new to EMF. I have a modeling question. I have already read a some papers and post, but I am not finding a proper solution. What I would like to model ist the following in my meta-modell:

The class "Features" has two attributes "material" and "color".
When the user creates an Instance of this class "Features", he should first select "material". The eType of this attribute is EEnum and the user can select, lets say "plastic" or "paper".

I am able to model it up to here. But now I don't know how to model the following:

If the user selects "plastic", it then should be able to choose for the "color" attribute between "pink" and "blue". Whereas when the user selects "paper", he should only be able to select for the "color" attribute from "black" or "white".

Does anybody have a suggestion how to model this nicely? I have thought and read about generics or dynamic modeling. But as I am new to EMF, maybe there is a nice / easy / clean way how to do it. I am happy for any suggestions.
Re: Modelling Attribute Dependencies [message #1734247 is a reply to message #1734202] Mon, 06 June 2016 14:20 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

You don't say which tool you are using.

With tools that only support static modeling tough, you cannot impose
your semantics, but you can add validation rules to warn of the
inconsistency.

Others tools offer an opportunity to filter the selections and so impose
the semantics.

Since prohibition of blue paper is not a fundamental limitation, I think
that you would be over-modeling to impose a limit on the input. Just
check it with today's validation rules.

Regards

Ed Willink

On 06/06/2016 15:04, Xi Ng wrote:
> Hello,
> I am new to EMF. I have a modeling question. I have already read a
> some papers and post, but I am not finding a proper solution. What I
> would like to model ist the following in my meta-modell:
>
> The class "Features" has two attributes "material" and "color".
> When the user creates an Instance of this class "Features", he should
> first select "material". The eType of this attribute is EEnum and the
> user can select, lets say "plastic" or "paper".
>
> I am able to model it up to here. But now I don't know how to model
> the following:
>
> If the user selects "plastic", it then should be able to choose for
> the "color" attribute between "pink" and "blue". Whereas when the user
> selects "paper", he should only be able to select for the "color"
> attribute from "black" or "white".
> Does anybody have a suggestion how to model this nicely? I have
> thought and read about generics or dynamic modeling. But as I am new
> to EMF, maybe there is a nice / easy / clean way how to do it. I am
> happy for any suggestions.
Re: Modelling Attribute Dependencies [message #1734415 is a reply to message #1734247] Wed, 08 June 2016 07:45 Go to previous messageGo to next message
Xi Ng is currently offline Xi NgFriend
Messages: 26
Registered: June 2016
Junior Member
Hello,

thank you for your reply.
I am using Eclipse Modeling Mars.
What do you mean by today's validation rules?

Greetings

Re: Modelling Attribute Dependencies [message #1734423 is a reply to message #1734415] Wed, 08 June 2016 10:06 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

The ones that you use today and which are sure to change tomorrow when
your system evolves / requirements change.

Regards

Ed Willink

On 08/06/2016 08:45, Xi Ng wrote:
> Hello,
> thank you for your reply.
> I am using Eclipse Modeling Mars.
> What do you mean by today's validation rules?
> Greetings
>
>
Re: Modelling Attribute Dependencies [message #1734441 is a reply to message #1734423] Wed, 08 June 2016 11:44 Go to previous messageGo to next message
Xi Ng is currently offline Xi NgFriend
Messages: 26
Registered: June 2016
Junior Member
Hello,

thank you for your reply.
I have two more questions:

1. Which tools only support static modeling? Or better: Does Eclipse Modeling Mars support only static modeling?

2. Where exactly (which package/class) do I implement (and find today's) validation rules?

Thank you for your help!

[Updated on: Wed, 08 June 2016 11:45]

Report message to a moderator

Re: Modelling Attribute Dependencies [message #1734470 is a reply to message #1734441] Wed, 08 June 2016 14:50 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Eclipse Modeling Mars is not just one tool, it has some tools
preconfigured and faciltyates many more.

Since you have still provided no clue as to what tool(s) you are using I
cannot reasonably tell you how to use it/them.

Regards

Ed Willink


On 08/06/2016 12:44, Xi Ng wrote:
> Hello,
> thank you for your reply. I have two more questions:
> 1. With tools that only support static modeling? Or better: Does
> Eclipse Modeling Mars support only static modeling?
>
> 2. Where exactly (which package/class) do I implement (and find
> today's) validation rules?
>
> Thank you for your help!
Re: Modelling Attribute Dependencies [message #1734782 is a reply to message #1734470] Sun, 12 June 2016 06:14 Go to previous messageGo to next message
Xi Ng is currently offline Xi NgFriend
Messages: 26
Registered: June 2016
Junior Member
Hello,

thank you again for your reply.
I am using EMF and GMF. Is that the tool names, that I should have mentioned from the beginning? I am sorry.

Kind Regards
Re: Modelling Attribute Dependencies [message #1734876 is a reply to message #1734782] Mon, 13 June 2016 07:39 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

EMF supports writing validation by manual additions to the
auto-generated Java code.

If you move on to Xcore you can embed the constraints more easily using
Xbase.

Alternatively if you move on to OCL you can embed the constraints more
easily using OCLinEcore.

If you are using EMF and GMF, you might want to look at the more
advanced design capabilities of Sirius.

Regards

Ed Willink


On 12/06/2016 07:14, Xi Ng wrote:
> Hello,
> thank you again for your reply. I am using EMF and GMF. Is that the
> tool names, that I should have mentioned from the beginning? I am sorry.
>
> Kind Regards
Re: Modelling Attribute Dependencies [message #1737569 is a reply to message #1734876] Sun, 10 July 2016 10:03 Go to previous message
Xi Ng is currently offline Xi NgFriend
Messages: 26
Registered: June 2016
Junior Member
Hello Ed Willink,

thank you very much. Your help is much apprechiated.
Sirius was a great tip!

Regards.
Previous Topic:Extension and Extension Points
Next Topic:Generating C# code form Ecore model
Goto Forum:
  


Current Time: Tue Mar 19 08:47:29 GMT 2024

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

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

Back to the top