Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Multiple roots
Multiple roots [message #414280] Mon, 29 October 2007 15:30 Go to next message
Tomas Zijdemans is currently offline Tomas ZijdemansFriend
Messages: 90
Registered: July 2009
Member
I need some advice regarding multiple roots (Diagram Elements).

Consider this scenario:

1. Library contains Book and Author (They relate to each other).
2. University contains Professor.
3. Professor and Author have a opposite relation to each other (1,*)

Since library and university are opened as two separate editors (with
their own resource), how can this relation be handled?


Best regards,

Tomas
Re: Multiple roots [message #414282 is a reply to message #414280] Mon, 29 October 2007 16:30 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Tomas,

I'm not sure I understand the Professor-Author relation nor specifically
what you are asking in terms of "handling" it. Maybe you could provide
a few more details...


Tomas Zijdemans wrote:
> I need some advice regarding multiple roots (Diagram Elements).
>
> Consider this scenario:
>
> 1. Library contains Book and Author (They relate to each other).
> 2. University contains Professor.
> 3. Professor and Author have a opposite relation to each other (1,*)
>
> Since library and university are opened as two separate editors (with
> their own resource), how can this relation be handled?
>
>
> Best regards,
>
> Tomas


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Multiple roots [message #414292 is a reply to message #414282] Mon, 29 October 2007 18:48 Go to previous messageGo to next message
Tomas Zijdemans is currently offline Tomas ZijdemansFriend
Messages: 90
Registered: July 2009
Member
Thanks for helping Ed!

Ed Merks wrote:
> Tomas,
>
> I'm not sure I understand the Professor-Author relation nor specifically
> what you are asking in terms of "handling" it. Maybe you could provide
> a few more details...

Sorry for explaining a bit poorly. My real case has 7 editors,
containing 3 diagram elements (roots) and about 50 model elements - so I
tried to simplify. Let me give it another go:

1. In the first editor, Library is the root. Book objects and Author
objects can be created - they have some attributes and a relation to
each other. Author has a relation/connection to, one or more, Professor
objects - but Professors are not contained by the Library root (Because
they belong in a different editor).

2. In the second editor, University is the root. Professor objects can
be created. Professors have some attributes and a relation/connection to
one, and only one, Author object.

The user will have both editors opened at the same time. Create an
Author (in the first editor), then a Professor (in the second editor).
Furthermore the user - in some way - should be able to select a
Professor object (in the second editor), and then be able to relate it
to an Author object (in the first editor) or visa vera.


This is taken a bit out of context (to save time and space), but should
give you the general picture.

Thanks,

Tomas

>
> Tomas Zijdemans wrote:
>> I need some advice regarding multiple roots (Diagram Elements).
>>
>> Consider this scenario:
>>
>> 1. Library contains Book and Author (They relate to each other).
>> 2. University contains Professor.
>> 3. Professor and Author have a opposite relation to each other (1,*)
>>
>> Since library and university are opened as two separate editors (with
>> their own resource), how can this relation be handled?
>>
>>
>> Best regards,
>>
>> Tomas
Re: Multiple roots [message #414295 is a reply to message #414292] Mon, 29 October 2007 19:02 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Tomas,

The properties view will generally allow you to select any object that's
reachable within the editor, so it sounds like it will be necessary to
use the editor's "Load Resource..." action to either load the Library
for it to be visible to the University editor or to load the University
so it will be visible to the Library editor. Once you load the
resource, the Professors/Authors should be available so you can populate
the references between them.


Tomas Zijdemans wrote:
> Thanks for helping Ed!
>
> Ed Merks wrote:
>> Tomas,
>>
>> I'm not sure I understand the Professor-Author relation nor
>> specifically what you are asking in terms of "handling" it. Maybe
>> you could provide a few more details...
>
> Sorry for explaining a bit poorly. My real case has 7 editors,
> containing 3 diagram elements (roots) and about 50 model elements - so
> I tried to simplify. Let me give it another go:
>
> 1. In the first editor, Library is the root. Book objects and Author
> objects can be created - they have some attributes and a relation to
> each other. Author has a relation/connection to, one or more,
> Professor objects - but Professors are not contained by the Library
> root (Because they belong in a different editor).
>
> 2. In the second editor, University is the root. Professor objects can
> be created. Professors have some attributes and a relation/connection
> to one, and only one, Author object.
>
> The user will have both editors opened at the same time. Create an
> Author (in the first editor), then a Professor (in the second editor).
> Furthermore the user - in some way - should be able to select a
> Professor object (in the second editor), and then be able to relate it
> to an Author object (in the first editor) or visa vera.
>
>
> This is taken a bit out of context (to save time and space), but
> should give you the general picture.
>
> Thanks,
>
> Tomas
>
>>
>> Tomas Zijdemans wrote:
>>> I need some advice regarding multiple roots (Diagram Elements).
>>>
>>> Consider this scenario:
>>>
>>> 1. Library contains Book and Author (They relate to each other).
>>> 2. University contains Professor.
>>> 3. Professor and Author have a opposite relation to each other (1,*)
>>>
>>> Since library and university are opened as two separate editors
>>> (with their own resource), how can this relation be handled?
>>>
>>>
>>> Best regards,
>>>
>>> Tomas


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Multiple roots [message #414301 is a reply to message #414295] Mon, 29 October 2007 20:32 Go to previous messageGo to next message
Tomas Zijdemans is currently offline Tomas ZijdemansFriend
Messages: 90
Registered: July 2009
Member
Thanks, I should have thought about this. Two problems appeared using
this approach:

1. After loading the resource and populating a reference, ex: Professor
-> Author, the Authors list of related Professors doesn't add the
opposite end (it is an opposite relation).

2. Loading resource does'nt seem to work in GMF for me (but that doesn't
belong at this mailing list).

Are there other possibilities.. Shared Editing domain?


Ed Merks wrote:
> Tomas,
>
> The properties view will generally allow you to select any object that's
> reachable within the editor, so it sounds like it will be necessary to
> use the editor's "Load Resource..." action to either load the Library
> for it to be visible to the University editor or to load the University
> so it will be visible to the Library editor. Once you load the
> resource, the Professors/Authors should be available so you can populate
> the references between them.
Re: Multiple roots [message #414302 is a reply to message #414301] Mon, 29 October 2007 21:04 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Tomas,

For a properly defined bidirectional reference not to properly update
both seems virtually impossible given how many years this has been in
use. So you'll understand that I'm doubtful. Which version of EMF are
you using?


Tomas Zijdemans wrote:
> Thanks, I should have thought about this. Two problems appeared using
> this approach:
>
> 1. After loading the resource and populating a reference, ex:
> Professor -> Author, the Authors list of related Professors doesn't
> add the opposite end (it is an opposite relation).
>
> 2. Loading resource does'nt seem to work in GMF for me (but that
> doesn't belong at this mailing list).
>
> Are there other possibilities.. Shared Editing domain?
>
>
> Ed Merks wrote:
>> Tomas,
>>
>> The properties view will generally allow you to select any object
>> that's reachable within the editor, so it sounds like it will be
>> necessary to use the editor's "Load Resource..." action to either
>> load the Library for it to be visible to the University editor or to
>> load the University so it will be visible to the Library editor.
>> Once you load the resource, the Professors/Authors should be
>> available so you can populate the references between them.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Multiple roots [message #414307 is a reply to message #414302] Tue, 30 October 2007 11:15 Go to previous messageGo to next message
Tomas Zijdemans is currently offline Tomas ZijdemansFriend
Messages: 90
Registered: July 2009
Member
Ed Merks wrote:
> Tomas,
>
> For a properly defined bidirectional reference not to properly update
> both seems virtually impossible given how many years this has been in
> use. So you'll understand that I'm doubtful. Which version of EMF are
> you using?

I'm using 2.3.1, but as you suggest, it's probably something I've
overlooked.

I got another idea last night when I couldn't sleep:

Would it be possible to create a second resource (set), and add new
model elements to this as well (It would be a "super" resource, holding
all elements from different editors). Then I could Iterate through this
new super resource and ex. catch all Professor objects - regardless of
where they have been created.

Crazy idea?


Regards,

Tomas
Re: Multiple roots [message #414308 is a reply to message #414307] Tue, 30 October 2007 12:23 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Tomas,

If you're using EMF 2.3, it should verify that the Ecore model is well
formed at the time you load the GenModel.

I don't really see how your idea would work, objects are contained by
other objects and the root object is contained by a resource, which is
contained by a resource set. These are all literally containment-type
relationships, i.e., an object can only be contained in one resource set
because eObject.eResource().getResourceSet() can only give one answer...


Tomas Zijdemans wrote:
> Ed Merks wrote:
>> Tomas,
>>
>> For a properly defined bidirectional reference not to properly update
>> both seems virtually impossible given how many years this has been in
>> use. So you'll understand that I'm doubtful. Which version of EMF
>> are you using?
>
> I'm using 2.3.1, but as you suggest, it's probably something I've
> overlooked.
>
> I got another idea last night when I couldn't sleep:
>
> Would it be possible to create a second resource (set), and add new
> model elements to this as well (It would be a "super" resource,
> holding all elements from different editors). Then I could Iterate
> through this new super resource and ex. catch all Professor objects -
> regardless of where they have been created.
>
> Crazy idea?
>
>
> Regards,
>
> Tomas


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:How to auto generate derived features' logic code?
Next Topic:How to auto generate derived features' logic code?
Goto Forum:
  


Current Time: Sat Apr 27 03:40:54 GMT 2024

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

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

Back to the top