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 |
Izaak van Niekerk 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 #545201 is a reply to message #544930] |
Wed, 07 July 2010 07:09 |
Izaak van Niekerk 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 |
William Piers 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--
|
|
| | | | | |
[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 |
Vincent MAHE 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] 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 |
Vincent MAHE 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
|
|
| | |
Goto Forum:
Current Time: Wed Nov 13 18:52:59 GMT 2024
Powered by FUDForum. Page generated in 0.06030 seconds
|