Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [Ecore] deep copying properties of Ecore elements without subcontents
[Ecore] deep copying properties of Ecore elements without subcontents [message #660277] Thu, 17 March 2011 16:15 Go to next message
leonard.krpan is currently offline leonard.krpanFriend
Messages: 20
Registered: March 2011
Junior Member
I'm processing an Ecore model where the resulting model is a subset of the original one, but should be an independet model without any references to the original one.

I'm using a TreeIterator to process model elements one at a time. If an element (EPackage, EClass, EAttribute or EReference) should be a part of the resulting model, I create a new appropriate Ecore class and then I need to set all the properties as in the original element. However, I do not want to set references such as subpackages, since at the moment that I'm processing this package I don't know which of it's subpackages will fulfill the processing conditions to be taken into the resulting model. So,

I just tried using EcoreUtil.copy and EcoreUtil.Copier.copy but they both have the effect of copying everything the package contains, which I don't want - I need the package alone, cut off from it's super and subpackages...

Is there a way to this other than stripping the copied package contents manually?
Re: [Ecore] deep copying properties of Ecore elements without subcontents [message #660291 is a reply to message #660277] Thu, 17 March 2011 16:37 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33136
Registered: July 2009
Senior Member
You could specialize copyContainment to ignore certain containment
references.

lk_muc wrote:
> I'm processing an Ecore model where the resulting model is a subset of
> the original one, but should be an independet model without any
> references to the original one.
>
> I'm using a TreeIterator to process model elements one at a time. If
> an element (EPackage, EClass, EAttribute or EReference) should be a
> part of the resulting model, I create a new appropriate Ecore class
> and then I need to set all the properties as in the original element.
> However, I do not want to set references such as subpackages, since at
> the moment that I'm processing this package I don't know which of it's
> subpackages will fulfill the processing conditions to be taken into
> the resulting model. So,
> I just tried using EcoreUtil.copy and EcoreUtil.Copier.copy but they
> both have the effect of copying everything the package contains, which
> I don't want - I need the package alone, cut off from it's super and
> subpackages...
>
> Is there a way to this other than stripping the copied package
> contents manually?


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Loading a resource with invalid non contained reference
Next Topic:[Ecore] Check class reference consistency in model
Goto Forum:
  


Current Time: Fri Apr 19 01:26:26 GMT 2024

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

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

Back to the top