Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Deleting a resource with containment reference to another resource
Deleting a resource with containment reference to another resource [message #503341] Fri, 11 December 2009 23:51 Go to next message
Stephen McCants is currently offline Stephen McCantsFriend
Messages: 92
Registered: July 2009
Member
Hello All,
I have an expectations question about EMF. I have a model that has Object A in it and Object A has
a containment reference to Object B. Now Object A is in Resource 1 and Object B is in Resource 2.
It was my understanding that if I delete Resource 1 (ObjectA.eResource().delete(null)) that Object B
should also be deleted. But this doesn't seem to be the case. After the delete, I'm expecting

ObjectB.eResource() == null

But it doesn't equal null.
Are my expectations wrong or am I doing something wrong?
Thanks in advance!

Sincerely,
Stephen McCants
Re: Deleting a resource with containment reference to another resource [message #503374 is a reply to message #503341] Sat, 12 December 2009 14:01 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Stephen,

Delete on a resource acts only on the resource itself and the object
contained by it. In this case I'd expect B to be unaffected other than
that it's container reference to Object A will have become a proxy.
You'll need to delete B separately.

Stephen McCants wrote:
> Hello All,
> I have an expectations question about EMF. I have a model that
> has Object A in it and Object A has a containment reference to Object
> B. Now Object A is in Resource 1 and Object B is in Resource 2. It
> was my understanding that if I delete Resource 1
> (ObjectA.eResource().delete(null)) that Object B should also be
> deleted. But this doesn't seem to be the case. After the delete, I'm
> expecting
>
> ObjectB.eResource() == null
>
> But it doesn't equal null.
> Are my expectations wrong or am I doing something wrong?
> Thanks in advance!
>
> Sincerely,
> Stephen McCants


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Deleting a resource with containment reference to another resource [message #503580 is a reply to message #503374] Mon, 14 December 2009 14:48 Go to previous messageGo to next message
Stephen McCants is currently offline Stephen McCantsFriend
Messages: 92
Registered: July 2009
Member
Ed,
Thank you for your quick reply. I'm not sure I understand the purpose of "containment" when it is
across different resources. It seems to me, that when spanning across different resources,
containment and non-containment are the same thing, with perhaps the exception on an e-opposite
setting on the "container" variable. Am I missing something here?
Thanks again.

Sincerely,
Stephen McCants

Ed Merks wrote:
> Stephen,
>
> Delete on a resource acts only on the resource itself and the object
> contained by it. In this case I'd expect B to be unaffected other than
> that it's container reference to Object A will have become a proxy.
> You'll need to delete B separately.
>
> Stephen McCants wrote:
>> Hello All,
>> I have an expectations question about EMF. I have a model that
>> has Object A in it and Object A has a containment reference to Object
>> B. Now Object A is in Resource 1 and Object B is in Resource 2. It
>> was my understanding that if I delete Resource 1
>> (ObjectA.eResource().delete(null)) that Object B should also be
>> deleted. But this doesn't seem to be the case. After the delete, I'm
>> expecting
>>
>> ObjectB.eResource() == null
>>
>> But it doesn't equal null.
>> Are my expectations wrong or am I doing something wrong?
>> Thanks in advance!
>>
>> Sincerely,
>> Stephen McCants
Re: Deleting a resource with containment reference to another resource [message #503982 is a reply to message #503580] Wed, 16 December 2009 17:12 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Stephen,

Comments below.

Stephen McCants wrote:
> Ed,
> Thank you for your quick reply. I'm not sure I understand the
> purpose of "containment" when it is across different resources. It
> seems to me, that when spanning across different resources,
> containment and non-containment are the same thing, with perhaps the
> exception on an e-opposite setting on the "container" variable. Am I
> missing something here?
They're much the same thing yes.
> Thanks again.
>
> Sincerely,
> Stephen McCants
>
> Ed Merks wrote:
>> Stephen,
>>
>> Delete on a resource acts only on the resource itself and the object
>> contained by it. In this case I'd expect B to be unaffected other
>> than that it's container reference to Object A will have become a
>> proxy. You'll need to delete B separately.
>>
>> Stephen McCants wrote:
>>> Hello All,
>>> I have an expectations question about EMF. I have a model that
>>> has Object A in it and Object A has a containment reference to
>>> Object B. Now Object A is in Resource 1 and Object B is in Resource
>>> 2. It was my understanding that if I delete Resource 1
>>> (ObjectA.eResource().delete(null)) that Object B should also be
>>> deleted. But this doesn't seem to be the case. After the delete,
>>> I'm expecting
>>>
>>> ObjectB.eResource() == null
>>>
>>> But it doesn't equal null.
>>> Are my expectations wrong or am I doing something wrong?
>>> Thanks in advance!
>>>
>>> Sincerely,
>>> Stephen McCants


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Deleting a resource with containment reference to another resource [message #504418 is a reply to message #503982] Fri, 18 December 2009 18:55 Go to previous messageGo to next message
Stephen McCants is currently offline Stephen McCantsFriend
Messages: 92
Registered: July 2009
Member
Hi Ed,
Okay. I find that confusing that containment and non-containment references across resources are
essentially the same thing. Wouldn't it be less confusing to forbid one or to alter one so they are
different? Of course, I have no idea what complications in the EMF code I'm asking for in order to
reduce possible confusion. Does it make any sense to try and differentiate these situations or at
least remove one of them?
Thanks for your time.

--Stephen

Ed Merks wrote:
> Stephen,
>
> Comments below.
>
> Stephen McCants wrote:
>> Ed,
>> Thank you for your quick reply. I'm not sure I understand the
>> purpose of "containment" when it is across different resources. It
>> seems to me, that when spanning across different resources,
>> containment and non-containment are the same thing, with perhaps the
>> exception on an e-opposite setting on the "container" variable. Am I
>> missing something here?
> They're much the same thing yes.
>> Thanks again.
>>
>> Sincerely,
>> Stephen McCants
>>
>> Ed Merks wrote:
>>> Stephen,
>>>
>>> Delete on a resource acts only on the resource itself and the object
>>> contained by it. In this case I'd expect B to be unaffected other
>>> than that it's container reference to Object A will have become a
>>> proxy. You'll need to delete B separately.
>>>
>>> Stephen McCants wrote:
>>>> Hello All,
>>>> I have an expectations question about EMF. I have a model that
>>>> has Object A in it and Object A has a containment reference to
>>>> Object B. Now Object A is in Resource 1 and Object B is in Resource
>>>> 2. It was my understanding that if I delete Resource 1
>>>> (ObjectA.eResource().delete(null)) that Object B should also be
>>>> deleted. But this doesn't seem to be the case. After the delete,
>>>> I'm expecting
>>>>
>>>> ObjectB.eResource() == null
>>>>
>>>> But it doesn't equal null.
>>>> Are my expectations wrong or am I doing something wrong?
>>>> Thanks in advance!
>>>>
>>>> Sincerely,
>>>> Stephen McCants
Re: Deleting a resource with containment reference to another resource [message #504442 is a reply to message #504418] Sat, 19 December 2009 10:57 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33140
Registered: July 2009
Senior Member
Stephen,

Comments below.

Stephen McCants wrote:
> Hi Ed,
> Okay. I find that confusing that containment and non-containment
> references across resources are essentially the same thing.
Originally Resource.contents and EObject.eContents were mutually
exclusive, i.e., Resource.contents was treated exactly like containment...
> Wouldn't it be less confusing to forbid one or to alter one so they
> are different?
But then along came people who complained that it must be possible to
decompose a large containment hierarchy across resource boundaries
otherwise they'd not be able to use EMF so we added support for
containment proxies and changed the behavior of containment references
for the case where EReference.resolveProxies is true. They didn't buy
the argument that they should just change such references to be
non-containment.
> Of course, I have no idea what complications in the EMF code I'm
> asking for in order to reduce possible confusion.
Of course you should realize you can never removed things from a
framework. You can only add things.
> Does it make any sense to try and differentiate these situations or at
> least remove one of them?
Only in an alternate universe where frameworks and APIs get smaller and
simpler over time. Probably in that universe time and entropy run backwards.
> Thanks for your time.
>
> --Stephen
>
> Ed Merks wrote:
>> Stephen,
>>
>> Comments below.
>>
>> Stephen McCants wrote:
>>> Ed,
>>> Thank you for your quick reply. I'm not sure I understand the
>>> purpose of "containment" when it is across different resources. It
>>> seems to me, that when spanning across different resources,
>>> containment and non-containment are the same thing, with perhaps the
>>> exception on an e-opposite setting on the "container" variable. Am
>>> I missing something here?
>> They're much the same thing yes.
>>> Thanks again.
>>>
>>> Sincerely,
>>> Stephen McCants
>>>
>>> Ed Merks wrote:
>>>> Stephen,
>>>>
>>>> Delete on a resource acts only on the resource itself and the
>>>> object contained by it. In this case I'd expect B to be unaffected
>>>> other than that it's container reference to Object A will have
>>>> become a proxy. You'll need to delete B separately.
>>>>
>>>> Stephen McCants wrote:
>>>>> Hello All,
>>>>> I have an expectations question about EMF. I have a model
>>>>> that has Object A in it and Object A has a containment reference
>>>>> to Object B. Now Object A is in Resource 1 and Object B is in
>>>>> Resource 2. It was my understanding that if I delete Resource 1
>>>>> (ObjectA.eResource().delete(null)) that Object B should also be
>>>>> deleted. But this doesn't seem to be the case. After the delete,
>>>>> I'm expecting
>>>>>
>>>>> ObjectB.eResource() == null
>>>>>
>>>>> But it doesn't equal null.
>>>>> Are my expectations wrong or am I doing something wrong?
>>>>> Thanks in advance!
>>>>>
>>>>> Sincerely,
>>>>> Stephen McCants
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:[EMF/Teneo/Hibernate] "transient" emf model
Next Topic:Re: [CDO] is it what I want ?
Goto Forum:
  


Current Time: Thu Apr 25 12:24:29 GMT 2024

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

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

Back to the top