Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community Forums[ATL] containment references cannot span across models.
https://www.eclipse.org/forums/index.php/mv/msg/171194/544319/#msg_544319
"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?]]>Izaak van Niekerk2010-07-02T10:58:18-00:00Re: [ATL] containment references cannot span across models.
https://www.eclipse.org/forums/index.php/mv/msg/171194/544930/#msg_544930
--------------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?
>
>
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.
]]>Izaak van Niekerk2010-07-07T07:09:30-00:00Re: [ATL] containment references cannot span across models.
https://www.eclipse.org/forums/index.php/mv/msg/171194/545215/#msg_545215
--------------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.
>
>
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.]]>Izaak van Niekerk2010-07-07T09:19:08-00:00Re: [ATL] containment references cannot span across models.
https://www.eclipse.org/forums/index.php/mv/msg/171194/545235/#msg_545235
Sylvain EVEILLARD2010-07-07T09:37:59-00:00Re: [ATL] containment references cannot span across models.
https://www.eclipse.org/forums/index.php/mv/msg/171194/545242/#msg_545242
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
)
}
]]>Izaak van Niekerk2010-07-07T09:52:13-00:00Re: [ATL] containment references cannot span across models.
https://www.eclipse.org/forums/index.php/mv/msg/171194/545281/#msg_545281
--------------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
> )
> }
>
>
YmVnaW46dmNhcmQNCmZuOldpbGxpYW0gUGllcnMNCm46UGllcnM7V2lsbGlh bQ0Kb3JnOk9i
ZW8NCmFkcjoyIHJ1ZSBSb2JlcnQgU2NodW1hbm47O2xvdCAyNDtOQU5URVM7 OzQ0NDA4O0Zy
YW5jZQ0KZW1haWw7aW50ZXJuZXQ6d2lsbGlhbS5waWVyc0BvYmVvLmZyDQp0 aXRsZTpNREEg
Q29uc3VsdGFudA0KdGVsO3dvcms6KzMzICgwKTIgNTEgMTMgNTAgNTMNCnVy bDpodHRwOi8v
d3d3Lm9iZW8uZnINCnZlcnNpb246Mi4xDQplbmQ6dmNhcmQNCg0K
--------------060406020801070609000108--]]>William Piers2010-07-07T11:04:00-00:00Re: [ATL] containment references cannot span across models.
https://www.eclipse.org/forums/index.php/mv/msg/171194/545283/#msg_545283
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."?]]>Izaak van Niekerk2010-07-07T11:19:41-00:00[ATL] Abstract classes vs abstract rules [Was: containment references cannot span across models.]
https://www.eclipse.org/forums/index.php/mv/msg/171194/545286/#msg_545286
> 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]]>Vincent MAHE2010-07-07T11:25:04-00:00Re: [ATL] containment references cannot span across models.
https://www.eclipse.org/forums/index.php/mv/msg/171194/545287/#msg_545287
So you have to use the exact same names as the metamodel]]>Sylvain EVEILLARD2010-07-07T11:26:19-00:00Re: [ATL] containment references cannot span across models.
https://www.eclipse.org/forums/index.php/mv/msg/171194/545303/#msg_545303
Izaak van Niekerk2010-07-07T11:56:08-00:00Re: [ATL] Abstract classes vs abstract rules [Was: containment references cannot span across models.
https://www.eclipse.org/forums/index.php/mv/msg/171194/545307/#msg_545307
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?
]]>Izaak van Niekerk2010-07-07T12:05:06-00:00Re: [ATL] Abstract classes vs abstract rules [Was: containment references cannot span across models.
https://www.eclipse.org/forums/index.php/mv/msg/171194/545319/#msg_545319
> 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]]>Vincent MAHE2010-07-07T12:42:05-00:00Re: [ATL] containment references cannot span across models.
https://www.eclipse.org/forums/index.php/mv/msg/171194/545354/#msg_545354
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?
>>
>>]]>Esteban Dugueperoux2010-07-07T13:29:35-00:00Re: [ATL] Abstract classes vs abstract rules [Was: containment references cannot span across models.
https://www.eclipse.org/forums/index.php/mv/msg/171194/545796/#msg_545796
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. ]]>Izaak van Niekerk2010-07-09T08:09:42-00:00