Alternative types of top node elements [message #189965] |
Thu, 29 May 2008 05:33  |
Eclipse User |
|
|
|
Hi there,
I want to do something very simple:
I have two objects in my domain model: A State and a CompartmentState,
where the CompartmentState extends the State. Now the CompartmentState
aggregates States in a "myStates" relation, hence it can contain States
and CompartmentStates recursively, modeling hierarchy.
The diagram extends CompartmentState, hence it can contain both types.
How do I set this up correctly in the mapping?
1. I cannot create two TopNodeReference for both State and
CompositeState, because I have only one aggregation "myStates". Hence I
get an error message if I choose the same Containment Feature:
"Phantom nodes that are not targeted by a link mapping exist".
2. I cannot create a single TopNodeReference to State (which gets
extended by CompartmentState), because only the latter has a Child
Reference to "myStates".
3. Next try would be to create a second aggregation from
CompartmentState to CompartmentState recursively to get two distinct
aggregations, but this is not exactly what I want...
How to do it?
Cheers,
Hauke
|
|
|
|
|
|
|
|
Re: Alternative types of top node elements [message #191106 is a reply to message #190963] |
Wed, 04 June 2008 14:19   |
Eclipse User |
|
|
|
Hi Alex, thanks a lot for your hints so far!
Alex Shatalin wrote:
>>> Do you have corresponding constraints specified in mapping file?
>>> Something like "not self.oclIsTypeOf(CompartmentState)" for
>>> AState mappings.
>> No, there are no constraints at all. That's why I'm a bit confused
>> about it here...
> So, I suggest you to add these constraints - GMF can mistakenly
> recognize CompartmentState as a State (it actually is instance of
> State...) So, I suggest you to prevent framework from doing it by
> addition proper constraint (see my prev. message).
ah, okay, got what you meant. I added that ocl constraint and: Yes, I
now can add as many hierarchichal CompositeStates as I want recursively
into each other. Yipiie!
BUT: Now I cannot add a simple "State" anymore, neither to the root
element nor to a CompositeState. I get same exception for the States now
as I got for CompositeStates before. Anything else I need to constrain?
Cheers,
Hauke
|
|
|
|
Re: Alternative types of top node elements [message #191590 is a reply to message #191255] |
Mon, 09 June 2008 03:58  |
Eclipse User |
|
|
|
Alex Shatalin wrote:
> It's ratehr strange - looks like incorrect OCL constraint.. Can you
> debug generated ???VisualIDRegistry to see why corresponding condition
> was not satisfied for simple "State"?
Hi Alex,
works now: debugged it and found some syntax error in the OCL
expression. With the correct expression it works now perfectly. Thanks a
lot for your time and help!
Cheers,
Hauke
|
|
|
Powered by
FUDForum. Page generated in 0.05890 seconds