Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] containment references cannot span across models.
[ATL] containment references cannot span across models. [message #544319] Fri, 02 July 2010 10:58 Go to next message
Izaak van Niekerk is currently offline Izaak van NiekerkFriend
Messages: 35
Registered: June 2010
Member
I'm getting the following error when trying to run my ATL transformation:

"Cannot set feature... to value... , containment references cannot span across models".

Has somebody seen this before or do you have any suggestions of what I can do to fix this?

I've searched the web and apparently it's a containment error:

CONTAINMENT_ERROR=Cannot set feature {1} to value {0}, containment references cannot span across models

This is a "simple" transformation between two .ecore models. A version 1 to version 2 transformation is required. As these models were generated by EMF, then surely the containment references would be supported by ATL. Or am I mistaken?

In essence one class A references another class B that is not in the same package.

How do I go about solving this?

[Updated on: Mon, 05 July 2010 19:44]

Report message to a moderator

Re: [ATL] containment references cannot span across models. [message #544930 is a reply to message #544319] Tue, 06 July 2010 06:42 Go to previous messageGo to next message
William Piers is currently offline William PiersFriend
Messages: 302
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------040403070909050907080307
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

Hello,

I think there is a mistake into the transformation: you are trying to
set a containment reference between two elements which are not inside of
the same EMF Resource. This can't be possible as it is a containment.

If that was not what you were trying to achieve, check that the
contained element is correctly copied, maybe ATL tries to make the
output model directly contain an element of the input model.

Best regards,

William

Le 02/07/2010 12:58, Izaak a écrit :
> I'm getting the following error when trying to run my ATL transformation.
> Has somebody seen this before or do you have any suggestions of what I
> can do to fix this?
>
>

--------------040403070909050907080307
Content-Type: text/x-vcard; charset=utf-8;
name="william_piers.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="william_piers.vcf"

YmVnaW46dmNhcmQNCmZuOldpbGxpYW0gUGllcnMNCm46UGllcnM7V2lsbGlh bQ0Kb3JnOk9i
ZW8NCmFkcjoyIHJ1ZSBSb2JlcnQgU2NodW1hbm47O2xvdCAyNDtOQU5URVM7 OzQ0NDA4O0Zy
YW5jZQ0KZW1haWw7aW50ZXJuZXQ6d2lsbGlhbS5waWVyc0BvYmVvLmZyDQp0 aXRsZTpNREEg
Q29uc3VsdGFudA0KdGVsO3dvcms6KzMzICgwKTIgNTEgMTMgNTAgNTMNCnVy bDpodHRwOi8v
d3d3Lm9iZW8uZnINCnZlcnNpb246Mi4xDQplbmQ6dmNhcmQNCg0K
--------------040403070909050907080307--
Re: [ATL] containment references cannot span across models. [message #545201 is a reply to message #544930] Wed, 07 July 2010 07:09 Go to previous messageGo to next message
Izaak van Niekerk is currently offline Izaak van NiekerkFriend
Messages: 35
Registered: June 2010
Member
The ATL is the following:

-- @path PMWV1=/PMWv01-to-PMWv02/metamodels/PMWV1.ecore
-- @path PMWV2=/PMWv01-to-PMWv02/metamodels/PMWV2.ecore

module PMWV12PMWV2;
create OUT : PMWV2 from IN : PMWV1;


--- GENERATED:
rule PartCatalogue_2_PartCatalogue {
from
v_left : PMWV1!PartCatalogue
to
v_right : PMWV2!PartCatalogue (
objectRef <- Set {v_left.objectRef},
part <- Set {v_left.part},
concept <- v_left.concept,
navigationPath <- Set {v_left.navigationPath},
criteria <- Set {v_left.criteria}
)
}

PartCatalogue is in the package Catalogue, and part for instance is in the package ProductModelWorkbench.Parts.

The ecore model for Version 1 and Version 2 is the same for PartCatalogue, part, concept etc. Containment is set to "true" for the part, criteria and concept relationships. I've tried setting them to "false", but it made no difference.

Re: [ATL] containment references cannot span across models. [message #545215 is a reply to message #545201] Wed, 07 July 2010 08:04 Go to previous messageGo to next message
William Piers is currently offline William PiersFriend
Messages: 302
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------050002000100030606010905
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

Hello

Is it the only rule in your transformation? If so, the problem here is
that you need a rule for copying each type of your metamodel.
Without that, elements like Concept won't be copied into the output
metamodel. So ATL will try to refer those in the source model, what
isn't possible because
- a containment link cannot span across models (target to source here)
- Concept in the source metamodel is not the same than Concept in the
target metamodel

So you have to define the copy of other types from source metamodel to
target metamodel.

regards,

William

Le 07/07/2010 09:09, Izaak a écrit :
> The ATL is the following:
>
> -- @path PMWV1=/PMWv01-to-PMWv02/metamodels/PMWV1.ecore
> -- @path PMWV2=/PMWv01-to-PMWv02/metamodels/PMWV2.ecore
>
> module PMWV12PMWV2;
> create OUT : PMWV2 from IN : PMWV1;
>
>
> --- GENERATED:
> rule PartCatalogue_2_PartCatalogue {
> from
> v_left : PMWV1!PartCatalogue
> to
> v_right : PMWV2!PartCatalogue (
> objectRef <- Set {v_left.objectRef},
> part <- Set {v_left.part},
> concept <- v_left.concept,
> navigationPath <- Set {v_left.navigationPath},
> criteria <- Set {v_left.criteria}
> )
> }
>
> PartCatalogue is in the package Catalogue, and part for instance is in
> the package ProductModelWorkbench.Parts.
>
> The ecore model for Version 1 and Version 2 is the same for
> PartCatalogue, part, concept etc. Containment is set to "true" for the
> part, criteria and concept relationships. I've tried setting them to
> "false", but it made no difference.
>
>

--------------050002000100030606010905
Content-Type: text/x-vcard; charset=utf-8;
name="william_piers.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="william_piers.vcf"

YmVnaW46dmNhcmQNCmZuOldpbGxpYW0gUGllcnMNCm46UGllcnM7V2lsbGlh bQ0Kb3JnOk9i
ZW8NCmFkcjoyIHJ1ZSBSb2JlcnQgU2NodW1hbm47O2xvdCAyNDtOQU5URVM7 OzQ0NDA4O0Zy
YW5jZQ0KZW1haWw7aW50ZXJuZXQ6d2lsbGlhbS5waWVyc0BvYmVvLmZyDQp0 aXRsZTpNREEg
Q29uc3VsdGFudA0KdGVsO3dvcms6KzMzICgwKTIgNTEgMTMgNTAgNTMNCnVy bDpodHRwOi8v
d3d3Lm9iZW8uZnINCnZlcnNpb246Mi4xDQplbmQ6dmNhcmQNCg0K
--------------050002000100030606010905--
Re: [ATL] containment references cannot span across models. [message #545226 is a reply to message #545215] Wed, 07 July 2010 09:19 Go to previous messageGo to next message
Izaak van Niekerk is currently offline Izaak van NiekerkFriend
Messages: 35
Registered: June 2010
Member
I've changed the ATL transformation to the following:

-- @path PMWV1=/PMWv01-to-PMWv02/metamodels/PMWV1.ecore
-- @path PMWV2=/PMWv01-to-PMWv02/metamodels/PMWV2.ecore

module PMWV12PMWV2;
create OUT : PMWV2 from IN : PMWV1;


--- GENERATED:
rule PartCatalogue_2_PartCatalogue29 {
from
v_left : PMWV1!PartCatalogue
to
v_right : PMWV2!PartCatalogue (
objectRef <- Set {v_left.objectRef},
part <- Set {v_left.part}
-- concept <- v_left.concept,
-- navigationPath <- Set {v_left.navigationPath},
-- criteria <- Set {v_left.criteria}
)
}

rule Part_2_Part {
from
v_left : PMWV1!Part
to
v_right : PMWV2!Part (
name <- v_left.name
)
}

But now I'm getting the exception:
Caused by: java.lang.IllegalArgumentException: The class 'Part' is not a valid classifier

Although Part definitely exists on both V1 and V2 with attribute name. I commented out the other attributes, just so as to get one working at least.
Re: [ATL] containment references cannot span across models. [message #545235 is a reply to message #544319] Wed, 07 July 2010 09:37 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
Are you sure it isn't an abstract EClass ?
Re: [ATL] containment references cannot span across models. [message #545242 is a reply to message #545235] Wed, 07 July 2010 09:52 Go to previous messageGo to next message
Izaak van Niekerk is currently offline Izaak van NiekerkFriend
Messages: 35
Registered: June 2010
Member
Yes, it is an abstract EClass. I've changed it to an abstract rule, but still getting the same error: The class 'Part' is not a valid classifier.

abstract rule Part_2_Part52 {
from
v_left : PMWV1!Part
to
v_right : PMWV2!Part (
name <- v_left.name,
---lifeCycleState <- v_left.lifeCycleState, -- Feature is not changeable
supportingDocumentLocation <- v_left.supportingDocumentLocation,
source <- v_left.source,
owningConcept <- v_left.owningConcept
)
}

Re: [ATL] containment references cannot span across models. [message #545281 is a reply to message #545242] Wed, 07 July 2010 11:04 Go to previous messageGo to next message
William Piers is currently offline William PiersFriend
Messages: 302
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------060406020801070609000108
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

You don't have to create rules for abstract classes, only for
non-abstract ones (e.g. descendants of Part).
Make sure the case of the "Part" element is correct.


Le 07/07/2010 11:52, Izaak a écrit :
> Yes, it is an abstract EClass. I've changed it to an abstract rule, but
> still getting the same error: The class 'Part' is not a valid classifier.
>
> abstract rule Part_2_Part52 {
> from
> v_left : PMWV1!Part
> to
> v_right : PMWV2!Part (
> name <- v_left.name,
> ---lifeCycleState <- v_left.lifeCycleState, -- Feature is not changeable
> supportingDocumentLocation <- v_left.supportingDocumentLocation,
> source <- v_left.source,
> owningConcept <- v_left.owningConcept
> )
> }
>
>

--------------060406020801070609000108
Content-Type: text/x-vcard; charset=utf-8;
name="william_piers.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="william_piers.vcf"

YmVnaW46dmNhcmQNCmZuOldpbGxpYW0gUGllcnMNCm46UGllcnM7V2lsbGlh bQ0Kb3JnOk9i
ZW8NCmFkcjoyIHJ1ZSBSb2JlcnQgU2NodW1hbm47O2xvdCAyNDtOQU5URVM7 OzQ0NDA4O0Zy
YW5jZQ0KZW1haWw7aW50ZXJuZXQ6d2lsbGlhbS5waWVyc0BvYmVvLmZyDQp0 aXRsZTpNREEg
Q29uc3VsdGFudA0KdGVsO3dvcms6KzMzICgwKTIgNTEgMTMgNTAgNTMNCnVy bDpodHRwOi8v
d3d3Lm9iZW8uZnINCnZlcnNpb246Mi4xDQplbmQ6dmNhcmQNCg0K
--------------060406020801070609000108--
Re: [ATL] containment references cannot span across models. [message #545283 is a reply to message #545281] Wed, 07 July 2010 11:19 Go to previous messageGo to next message
Izaak van Niekerk is currently offline Izaak van NiekerkFriend
Messages: 35
Registered: June 2010
Member
Does that mean only the "PartCatalogue" rule is required then?

Part extends ModellingArtefact (that is a non-abstract class), so do I only require a rule for ModellingArtefact? In version 2, ModellingArtefact extends CategorizableObject though (ie. ModellingArtefact(non-abstract) (v1) maps to ModellingArtefact(abstract)(v2). How would I create this rule then? Do I need this rule for the PartCatalogue to work?

Sorry William what do you mean with:
"Make sure the case of the "Part" element is correct."?
[ATL] Abstract classes vs abstract rules [Was: containment references cannot span across models.] [message #545286 is a reply to message #545281] Wed, 07 July 2010 11:25 Go to previous messageGo to next message
Vincent MAHE is currently offline Vincent MAHEFriend
Messages: 129
Registered: July 2009
Senior Member
Le 07/07/2010 13:04, William Piers a écrit :
> You don't have to create rules for abstract classes, only for
> non-abstract ones (e.g. descendants of Part).
> Make sure the case of the "Part" element is correct.
>
It is not possible to target abstract classes (ie which are abstract in
the OUT metamodel) in an ATL rule.

You may have an abstract classe as source (from the IN metamodel) BUT:
- the target class(es) must be concrete (ie you can instanciate them)
- all sub-classes in the IN model are processed by this rule

Another case is the use of rule inheritancy:
- you write a (possibly abstract) rule on the IN most generic class in
order to factorize code
- you write rules for sub-classes, extending the generic rule, in
order to add transformation code specific to each sub-class

>
> Le 07/07/2010 11:52, Izaak a écrit :
>> Yes, it is an abstract EClass. I've changed it to an abstract rule, but

ATL cannot instanciate target classes which are not instanciable (as
they are tagged as 'abstract' in the OUT metamodel).
Declaring a rule as 'abstract' has no concerns about classes but is for
rules inheritancy inside an ATL transformation.

>> still getting the same error: The class 'Part' is not a valid classifier.
>>
>> abstract rule Part_2_Part52 {
>> from
>> v_left : PMWV1!Part
>> to
>> v_right : PMWV2!Part (
>> name <- v_left.name,
>> ---lifeCycleState <- v_left.lifeCycleState, -- Feature is not changeable
>> supportingDocumentLocation <- v_left.supportingDocumentLocation,
>> source <- v_left.source,
>> owningConcept <- v_left.owningConcept
>> )
>> }
>>
>>


--
Cordialement

Vincent MAHÉ

Ingénieur Expert - Projet IDM++ - Équipe AtlanMod
École des Mines de Nantes
La Chantrerie - 4, rue Alfred Kastler
B.P. 20722 - F-44307 NANTES Cedex 3
Tel: (33)2 51 85 81 00
Re: [ATL] containment references cannot span across models. [message #545287 is a reply to message #544319] Wed, 07 July 2010 11:26 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
The names are case sensitive, meaning that PART != Part

So you have to use the exact same names as the metamodel
Re: [ATL] containment references cannot span across models. [message #545303 is a reply to message #545287] Wed, 07 July 2010 11:56 Go to previous messageGo to next message
Izaak van Niekerk is currently offline Izaak van NiekerkFriend
Messages: 35
Registered: June 2010
Member
Thanks Sylvain, I checked and it seems like I AM using the right case. part (all small case for the attribute) and Part (for the class name). So surely that can not be the reason.
Re: [ATL] Abstract classes vs abstract rules [Was: containment references cannot span across models. [message #545307 is a reply to message #545286] Wed, 07 July 2010 12:05 Go to previous messageGo to next message
Izaak van Niekerk is currently offline Izaak van NiekerkFriend
Messages: 35
Registered: June 2010
Member
Vincent, you're basically saying that the "abstract" rule does not fulfill the same role as the "abstract" class. The latter is saying the rule in ATL can be extended. I get this now, thank you.

But I'm not sure if I understand the rest of your reply. Are you saying that I can not do a mapping from say ModellingArtefact (non-abstract) to ModellingArtefact(abstract)? What if this is the requirement? How do I then handle this?

And before we go off on the wrong track. I'm still not able to do the very simple PartCatalogue rule. What is the reason that I'm getting the "containment reference cannot span across models" error?

What is the bare minimum that I can set in my ATL file just to get at least the "part" transformed from the one model to the other?







Re: [ATL] Abstract classes vs abstract rules [Was: containment references cannot span across models. [message #545319 is a reply to message #545307] Wed, 07 July 2010 12:42 Go to previous messageGo to next message
Vincent MAHE is currently offline Vincent MAHEFriend
Messages: 129
Registered: July 2009
Senior Member
Le 07/07/2010 14:05, Izaak a écrit :
> Vincent, you're basically saying that the "abstract" rule does not
> fulfill the same role as the "abstract" class. The latter is saying the
> rule in ATL can be extended. I get this now, thank you.
>
> But I'm not sure if I understand the rest of your reply. Are you saying
> that I can not do a mapping from say (non-abstract) to
> ModellingArtefact(abstract)? What if this is the requirement? How do I
> then handle this?

I suppose that if your "new version" metamodel considers as abstract,
it is because this class has been split in some sub-classes (the
abstract enforces the use of inheriting classes, as I understand it).
So you have to write ATL ruleS which take as input a subset of IN
ModellingArtefact and generate the corresponding OUT class instance.

ie if new metamodel is like:
ModellingArtifact <|- MAOne, MATwo, MAThree
you have to write rules:

rule ModelingArtifact2MAOne {
from src : INmm!ModelingArtiofact(<<condition to subset One>>)
to tgt : OUTmm!MAOne (
....
)

rule ModelingArtifact2MATwo {
from src : INmm!ModelingArtiofact(<<condition to subset Two>>)
to tgt : OUTmm!MATwo (
....
)

rule ModelingArtifact2MAThree {
from src : INmm!ModelingArtiofact(<<condition to subset Three>>)
to tgt : OUTmm!MAThree (
....
)

> And before we go off on the wrong track. I'm still not able to do the
> very simple PartCatalogue rule. What is the reason that I'm getting the
> "containment reference cannot span across models" error?
>
> What is the bare minimum that I can set in my ATL file just to get at
> least the "part" transformed from the one model to the other?

As the target Part is also abstract (if I remenber), the same solution
occurs.
--
Cordialement

Vincent MAHÉ

Ingénieur Expert - Projet IDM++ - Équipe AtlanMod
École des Mines de Nantes
La Chantrerie - 4, rue Alfred Kastler
B.P. 20722 - F-44307 NANTES Cedex 3
Tel: (33)2 51 85 81 00
Re: [ATL] containment references cannot span across models. [message #545354 is a reply to message #544930] Wed, 07 July 2010 13:29 Go to previous messageGo to next message
Esteban Dugueperoux is currently offline Esteban DugueperouxFriend
Messages: 472
Registered: July 2009
Senior Member
Hello William,

Do you say that cross resource containment isn't allowed with EMF?
Because this
http://wiki.eclipse.org/EMF/FAQ#How_can_I_split_containment_ references_across_multiple_resources_to_support_cross_resour ce_containment.3F
seems say that's possible in EMF, or is it an ATL constraint to not
allow cross resource containment?

Best Regards.

On 06/07/2010 08:42, William Piers wrote:
> Hello,
>
> I think there is a mistake into the transformation: you are trying to
> set a containment reference between two elements which are not inside of
> the same EMF Resource. This can't be possible as it is a containment.
>
> If that was not what you were trying to achieve, check that the
> contained element is correctly copied, maybe ATL tries to make the
> output model directly contain an element of the input model.
>
> Best regards,
>
> William
>
> Le 02/07/2010 12:58, Izaak a écrit :
>> I'm getting the following error when trying to run my ATL transformation.
>> Has somebody seen this before or do you have any suggestions of what I
>> can do to fix this?
>>
>>
Re: [ATL] Abstract classes vs abstract rules [Was: containment references cannot span across models. [message #545796 is a reply to message #545319] Fri, 09 July 2010 08:09 Go to previous message
Izaak van Niekerk is currently offline Izaak van NiekerkFriend
Messages: 35
Registered: June 2010
Member
Vincent, after a couple of days struggling trying to understand what you and William is trying to say to me, I actually got it working last night (the penny dropped).

I created the rules for all the classes that extend Part and this ensured the successful transformation of the contained reference.

Thank you so much for all your advice and helping me.
Previous Topic:[ATL] announce of a Java DSL for ATL transformations execution.
Next Topic: [ATL] Run ATL
Goto Forum:
  


Current Time: Wed Nov 13 18:52:59 GMT 2024

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

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

Back to the top