Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » problems with opposites in custom resource
problems with opposites in custom resource [message #490002] Tue, 06 October 2009 20:12 Go to next message
gary s thompson is currently offline gary s thompsonFriend
Messages: 92
Registered: July 2009
Member
Dear all

I have a problem. I cave created a custom resource type to read a non emf model. Now this uses proxy resolution across resource boundaries and I am having problems with proxy resolution when I have have bi directional non containment references which cross resource boundaries.

consider



P0 | P1 | P2
 O |    |
  \|    |
   \    |
   |\   |
   | A  |  D
   | |  |  |
   | B--|--C



P0 P1 and P2 are packages and
O contains an A via a proxy resolving reference
A contains a list of B
and C is contained by D
B and C have opposite references to each other: C contains a list of B and each B refers back to its C

when I first load a C I also create a set of B proxy objects and each of these Bs has its opposite reference to its C set correctly (this is all done by setting keys on the proxy URIs) however O and A are not created as they are on the wrong end of proxies and in different packages.
however when I resolve A and its contained Bs by resolving the O-A reference a new A is created as the package P1 is loaded and each C loses its B proxies' which get replaced by real Bs. However I don't seem to have them in the correct opposite relationship thus at the end of the process each C has a B but the B doesn't have a C.

So here are the questions

1. am I doing it all wrong Wink
2. if so what do i need to do
3. if I am not doing it wrong what do i need to solve the problem? Is my resource reposnsible for setting the opposite link and do i need to set it at a diferent time or reset it when I resolve the Bs (and if so where)?

many thanks for any help proffered

regards
gary
Re: problems with opposites in custom resource [message #490067 is a reply to message #490002] Wed, 07 October 2009 07:18 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Gary,

Comments below.

gary s thompson wrote:
> Dear all
>
> I have a problem. I cave created a custom resource type to read a non
> emf model. Now this uses proxy resolution across resource boundaries
> and I am having problems with proxy resolution when I have have bi
> directional non containment references which cross resource boundaries.
Generally that requires a proxy on both sides because proxy resolution
only operates on one side without affecting the other.
>
> consider
>
>
>
>
> P0 | P1 | P2
> O | |
> \| |
> \ |
> |\ |
> | A | D
> | | | |
> | B--|--C
>
>
>
> P0 P1 and P2 are packages and O contains an A via a proxy resolving
> reference
> A contains a list of B and C is contained by D
> B and C have opposite references to each other: C contains a list of B
> and each B refers back to its C
I see, a container reference... But it sounds contradictory. A
contains B and also C contains B. Do you really mean containment? It
can't be contained in two places at once.
>
> when I first load a C I also create a set of B proxy objects and each
> of these Bs has its opposite reference to its C set correctly (this is
> all done by setting keys on the proxy URIs)
So you create B's, add the to C's list of Bs, and set proxy URIs on
these Bs.
> however O and A are not created as they are on the wrong end of
> proxies and in different packages.
Packages make no difference in the story...
>
> however when I resolve A and its contained Bs by resolving the O-A
> reference a new A is created as the package P1
Again, I don't see that packages has any impact. When you resolve A,
that should involve loading a resource (unless it's already loaded),
find the "real" A in it, and replacing the reference to that real A.
A's relationship to Bs established at that point already...
> is loaded and each C loses its B proxies' which get replaced by real Bs.
It's not clear what causes that to happen. Resolving A should not cause
that to happen.
> However I don't seem to have them in the correct opposite relationship
> thus at the end of the process each C has a B but the B doesn't have
> a C.
My brain kind of hurts trying to map that to reality...
>
> So here are the questions
>
> 1. am I doing it all wrong ;)
Perhaps you're trying to contain the same object in two places.
> 2. if so what do i need to do
Not do that. :-P
> 3. if I am not doing it wrong what do i need to solve the problem? Is
> my resource reposnsible for setting the opposite link
No.
> and do i need to set it at a diferent time or reset it when I resolve
> the Bs (and if so where)?
You might be trying the impossible.
>
> many thanks for any help proffered
>
> regards
> gary


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: problems with opposites in custom resource [message #490083 is a reply to message #490067] Wed, 07 October 2009 09:29 Go to previous messageGo to next message
gary s thompson is currently offline gary s thompsonFriend
Messages: 92
Registered: July 2009
Member
Quote:

Gary,

Comments below.

gary s thompson wrote:
> Dear all
>
> I have a problem. I cave created a custom resource type to read a non
> emf model. Now this uses proxy resolution across resource boundaries
> and I am having problems with proxy resolution when I have have bi
> directional non containment references which cross resource boundaries.
Generally that requires a proxy on both sides because proxy resolution
only operates on one side without affecting the other.
>
> consider
>
>
>
>
> P0 | P1 | P2
> O | |
> \| |
> \ |
> |\ |
> | A | D
> | | | |
> | B--|--C
>
>
>
> P0 P1 and P2 are packages and O contains an A via a proxy resolving
> reference
> A contains a list of B and C is contained by D
> B and C have opposite references to each other: C contains a list of B
> and each B refers back to its C
I see, a container reference... But it sounds contradictory. A
contains B and also C contains B. Do you really mean containment? It
can't be contained in two places at once.


Hi Ed
sorry i meant contains in the collections sense rather than the emf sense Wink. Contains is a slightly overloaded word in this domain. I shall try to use 'in' or some other phrase instead (unless there is a better syntax you can suggest)

so to be clearer the following are emf containment references
O-A
A-B
D-C

B-C is a bi directional cross reference with cross containment proxy resolution but is not a containment reference.

so I load a C and this has a reference to a list of Bs which get created as proxies and get there opposite references to there C set

however when I load resource P1 by resolving 0-A which also causes all the real Bs to be loaded the new Bs which replace the proxies get attached to their Cs but the Bs no longer contain there opposite link to their Cs ie I seem to lose the bidirectionality


sorry for the confusion I guess the rest of the replies aren't the answer

regards
gary
Quote:

>
> when I first load a C I also create a set of B proxy objects and each
> of these Bs has its opposite reference to its C set correctly (this is
> all done by setting keys on the proxy URIs)
So you create B's, add the to C's list of Bs, and set proxy URIs on
these Bs.
> however O and A are not created as they are on the wrong end of
> proxies and in different packages.
Packages make no difference in the story...
>
> however when I resolve A and its contained Bs by resolving the O-A
> reference a new A is created as the package P1
Again, I don't see that packages has any impact. When you resolve A,
that should involve loading a resource (unless it's already loaded),
find the "real" A in it, and replacing the reference to that real A.
A's relationship to Bs established at that point already...
> is loaded and each C loses its B proxies' which get replaced by real Bs.
It's not clear what causes that to happen. Resolving A should not cause
that to happen.
> However I don't seem to have them in the correct opposite relationship
> thus at the end of the process each C has a B but the B doesn't have
> a C.
My brain kind of hurts trying to map that to reality...
>
> So here are the questions
>
> 1. am I doing it all wrong Wink
Perhaps you're trying to contain the same object in two places.
> 2. if so what do i need to do
Not do that. Razz
> 3. if I am not doing it wrong what do i need to solve the problem? Is
> my resource reposnsible for setting the opposite link
No.
> and do i need to set it at a diferent time or reset it when I resolve
> the Bs (and if so where)?
You might be trying the impossible.
>
> many thanks for any help proffered
>
> regards
> gary

Re: problems with opposites in custom resource [message #490145 is a reply to message #490083] Wed, 07 October 2009 14:15 Go to previous message
gary s thompson is currently offline gary s thompsonFriend
Messages: 92
Registered: July 2009
Member
Hi Ed

I am sorry I appear to have wasted your time. The problem here appears to be (on further digging) that on disk one end of the two way link doesn't appear to be recording the opposite connection (this is not a format I designed). So depending on which way you resolve the two way link you get different results...

So the end result is that I think I have to go off and introspect the disk files for the resource set and build an opposites index for resources that have not been loaded....


regards
gary
Previous Topic:[CDO] Possibilities and constraints of using CDO
Next Topic:OCL constraints attached to metamodel?
Goto Forum:
  


Current Time: Tue Apr 23 11:29:22 GMT 2024

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

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

Back to the top