Modelling Attribute Dependencies [message #1734202] |
Mon, 06 June 2016 03:04  |
Eclipse User |
|
|
|
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 10:20   |
Eclipse User |
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.30997 seconds