Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] non deterministic behaivor
[ATL] non deterministic behaivor [message #47586] Tue, 19 June 2007 14:39 Go to next message
Eclipse UserFriend
Originally posted by: hein..fokus.fraunhofer

This is a multi-part message in MIME format.
--------------040301050401000801050405
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit

Hi all,

I've finished my first ATL transformation from a UML UseCase model to a
UML HighLevel model that contains additionally classes derived from
usecases. However, I'm getting a non deterministic behavior.
After several executions of the same transformation I'm getting a
different output model each time. More precisely the difference occurs
in the nestedClassifier association of the created Class from the
UseCase that includes other usecases ("buy a ticket" includes "pay a
ticket" and "deliver a ticket", the created Class "buy a ticket" should
nested the Classes "deliver a ticket" and "pay a ticket", but sometimes
the transformation provides such a model and sometimes it provides me
only one nested Class or non nested Classes.

The corresponding ATL rule is here, additionally I've attached the
source uml model and the whole atl transformation file.


rule UseCase{
from u1:UML2!UseCase
to u2:UML2!UseCase(
name<-u1.name,
--owner<-u1.owner,
include<-u1.include
),
usecaseclass1:UML2!Class (
name<-u1.name,
useCase<-u1,
nestedClassifier<- if u1.include->size()>0 then
UML2!Class.allInstances()->select(c |
u1.include->collect(i|i.addition.name)->includes(c.name) )
else Set{} endif
)
}


Thanks in advance for any help
Cheers,
Christian

--------------040301050401000801050405
Content-Type: text/plain;
name="UseCases2HighLevel.atl"
Content-Transfer-Encoding: 8bit
Content-Disposition: inline;
filename="UseCases2HighLevel.atl"

module UseCases2HighLevel; -- Module Template
create OUT : UML2 refining IN : UML2;


rule Model{
from m1:UML2!Model
to m2:UML2!Model(
name<-m1.name,
packagedElement<-m1.packagedElement

)--,
-- create new Class Package
--p1:UML2!Package(
--name<-'ClassPackage'
-- add all Classes to this Package
--packagedElement<-UML2!Class.allInstances()->union(UML2!Association.allInstances())
--nestingPackage<-m2

--)
do {
--m2.packagedElement<- m1.packagedElement->asSet()->append(Set{thisModule.createPackage(m1)});
thisModule.createPackage(m2);
}
}

rule createPackage(np:UML2!Package){
to c : UML2!Package
do{
--set attributes here
c.name<-'ClassPackage';
c.nestingPackage<-np;
c.packagedElement<-UML2!Class.allInstances()->union(UML2!Association.allInstances());
np.packagedElement<-Set{c};
}
}

rule Package{
from p1:UML2!Package(p1.oclIsTypeOf(UML2!Package) and (not (p1.oclIsTypeOf(UML2!Model))))
to p2:UML2!Package(
name<-p1.name,
packagedElement<-p1.packagedElement
)
}




rule Asscociation{
from a1:UML2!Association
to a2:UML2!Association(
name<-a1.name,
memberEnd<-a1.memberEnd,
ownedEnd<-a1.ownedEnd

),
a3:UML2!Association(
name<-a1.name+'source_target'
--ownedEnd<-a1.ownedEnd
--ownedEnd <- thisModule.resolveTemp(a1.ownedEnd, 'c1')
)
do { -- this do part is new
if (a1.ownedEnd->size()>0) {

a3.ownedEnd<-Set{
thisModule.resolveTemp(a1.ownedEnd->asSequence()->first(),'p3'),
thisModule.resolveTemp(a1.ownedEnd->asSequence()->last(),'p3')
};

--a1.ownedEnd->asSequence()->first().toString().println();
-- a3.ownedEnd <- thisModule.resolveTemp(a1.memberEnd->asSequence()->first(), 'p2');

--a3.ownedEnd <- thisModule.resolveTemp(
-- Class!Class->allInstances()->
-- select(c | c.name =
--
Re: [ATL] non deterministic behaivor [message #47624 is a reply to message #47586] Tue, 19 June 2007 17:07 Go to previous messageGo to next message
Frédéric Jouault is currently offline Frédéric JouaultFriend
Messages: 572
Registered: July 2009
Senior Member
Hello,

Could you please simplify your scenario (i.e., mainly the
transformation) to the smallest one exhibiting the problematic behavior?

This step helps a lot, but is best done by somebody knowing all the
details of the scenario ;-).

Thanks.


Regards,

Frédéric Jouault


Christian Hein wrote:
> Hi all,
>
> I've finished my first ATL transformation from a UML UseCase model to a
> UML HighLevel model that contains additionally classes derived from
> usecases. However, I'm getting a non deterministic behavior.
> After several executions of the same transformation I'm getting a
> different output model each time. More precisely the difference occurs
> in the nestedClassifier association of the created Class from the
> UseCase that includes other usecases ("buy a ticket" includes "pay a
> ticket" and "deliver a ticket", the created Class "buy a ticket" should
> nested the Classes "deliver a ticket" and "pay a ticket", but sometimes
> the transformation provides such a model and sometimes it provides me
> only one nested Class or non nested Classes.
>
> The corresponding ATL rule is here, additionally I've attached the
> source uml model and the whole atl transformation file.
>
>
> rule UseCase{
> from u1:UML2!UseCase
> to u2:UML2!UseCase(
> name<-u1.name,
> --owner<-u1.owner,
> include<-u1.include
> ),
> usecaseclass1:UML2!Class (
> name<-u1.name,
> useCase<-u1,
> nestedClassifier<- if u1.include->size()>0 then
> UML2!Class.allInstances()->select(c |
> u1.include->collect(i|i.addition.name)->includes(c.name) )
> else Set{} endif
> )
> }
>
>
> Thanks in advance for any help
> Cheers,
> Christian
>
>
> ------------------------------------------------------------ ------------
>
> module UseCases2HighLevel; -- Module Template
> create OUT : UML2 refining IN : UML2;
>
>
> rule Model{
> from m1:UML2!Model
> to m2:UML2!Model(
> name<-m1.name,
> packagedElement<-m1.packagedElement
>
> )--,
> -- create new Class Package
> --p1:UML2!Package(
> --name<-'ClassPackage'
> -- add all Classes to this Package
> --packagedElement<-UML2!Class.allInstances()->union(UML2!Association.allInstances())
> --nestingPackage<-m2
>
> --)
> do {
> --m2.packagedElement<- m1.packagedElement->asSet()->append(Set{thisModule.createPackage(m1)});
> thisModule.createPackage(m2);
> }
> }
>
> rule createPackage(np:UML2!Package){
> to c : UML2!Package
> do{
> --set attributes here
> c.name<-'ClassPackage';
> c.nestingPackage<-np;
> c.packagedElement<-UML2!Class.allInstances()->union(UML2!Association.allInstances());
> np.packagedElement<-Set{c};
> }
> }
>
> rule Package{
> from p1:UML2!Package(p1.oclIsTypeOf(UML2!Package) and (not (p1.oclIsTypeOf(UML2!Model))))
> to p2:UML2!Package(
> name<-p1.name,
> packagedElement<-p1.packagedElement
> )
> }
>
>
>
>
> rule Asscociation{
> from a1:UML2!Association
> to a2:UML2!Association(
> name<-a1.name,
> memberEnd<-a1.memberEnd,
> ownedEnd<-a1.ownedEnd
>
> ),
> a3:UML2!Association(
> name<-a1.name+'source_target'
> --ownedEnd<-a1.ownedEnd
> --ownedEnd <- thisModule.resolveTemp(a1.ownedEnd, 'c1')
> )
> do { -- this do part is new
> if (a1.ownedEnd->size()>0) {
>
> a3.ownedEnd<-Set{
> thisModule.resolveTemp(a1.ownedEnd->asSequence()->first(),'p3'),
> thisModule.resolveTemp(a1.ownedEnd->asSequence()->last(),'p3')
> };
>
> --a1.ownedEnd->asSequence()->first().toString().println();
> -- a3.ownedEnd <- thisModule.resolveTemp(a1.memberEnd->asSequence()->first(), 'p2');
>
> --a3.ownedEnd <- thisModule.resolveTemp(
> -- Class!Class->allInstances()->
> -- select(c | c.name =
> -- �NameOfTheClassCorrespondingToTheSearchedTable�)
> -- , 'c1');
> } else {
> a1.ownedEnd->size().toString().println();
> }
>
>
> }
> -- a3.ownedEnd <- thisModule.resolveTemp(a1.ownedEnd, 'c1');
> -- a3.memberEnd <- thisModule.resolveTemp(a1.memberEnd, 'c1');
> }
>
> rule Property{
> from p1:UML2!Property
> to p2:UML2!Property(
>
> name<-p1.name,
> type<-p1.type,
> upperValue<-p1.upperValue,
> lowerValue<-p1.lowerValue
> ),
> p3:UML2!Property(
> name<-p1.name,
> upperValue<-p1.upperValue,
> lowerValue<-p1.lowerValue
> )
> do {
> if (p1.type.oclIsTypeOf(UML2!Actor)) {
>
> thisModule.resolveTemp(p1.type,'actorclass1').toString().pri ntln();
> p3.type<-thisModule.resolveTemp(p1.type,'actorclass1');
> } else {
>
> thisModule.resolveTemp(p1.type,'usecaseclass1').toString().p rintln();
> p3.type<-thisModule.resolveTemp(p1.type,'usecaseclass1');
> }
> }
> }
>
> rule LiteralInteger{
> from l1:UML2!LiteralInteger
> to l2:UML2!LiteralInteger(
>
> value<-l1.value
> )
> }
>
> rule LiteralUnlimitedNatural{
> from l1:UML2!LiteralUnlimitedNatural
> to l2:UML2!LiteralUnlimitedNatural(
>
> value<-l1.value
> )
>
>
> }
>
> rule Include{
> from i1:UML2!Include
> to i2:UML2!Include(
> name<-i1.name,
> addition<-i1.addition
>
> ) ,
> a1:UML2!Association(name<-i1.name)
>
>
>
> }
>
> rule Actor{
> from actor1:UML2!Actor
> to actor2:UML2!Actor(
> name<-actor1.name,
> general<-actor1.general
> ),
> actorclass1:UML2!Class(
> name<-actor1.name,
> general<-if actor1.general->size()>0 then
> UML2!Class.allInstances()->select(x|x.name=actor1.general->first().name)
> else Set{} endif
> )
> }
>
> rule UseCase{
> from u1:UML2!UseCase
> to u2:UML2!UseCase(
> name<-u1.name,
> --owner<-u1.owner,
> include<-u1.include
> ),
> usecaseclass1:UML2!Class (
> name<-u1.name,
> useCase<-u1,
> nestedClassifier<- if u1.include->size()>0 then
> UML2!Class.allInstances()->select(c | u1.include->collect(i|i.addition.name)->includes(c.name) )
> else Set{} endif
> )
> }
>
>
>
>
> ------------------------------------------------------------ ------------
>
> <?xml version="1.0" encoding="ASCII"?>
> <uml:Model xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:uml="http://www.eclipse.org/uml2/2.0.0/UML" xmi:id="{20257490-18CA-4f87-BDE6-E69D03C0F923}" name="Model">
> <packagedElement xsi:type="uml:Package" xmi:id="{016E3AA9-FCB6-4bae-B227-63619281A08D}" name="UseCase">
> <packagedElement xsi:type="uml:Association" xmi:id="{1B6D6218-CC14-4549-B114-DC3194C3FF19}" name="Association7">
> <ownedEnd xmi:id="P:{BE09C181-4341-4a05-8C02-3F84EBFD23AC}" name="source" type="{BE09C181-4341-4a05-8C02-3F84EBFD23AC}">
> <upperValue xsi:type="uml:LiteralUnlimitedNatural" xmi:id="_-cXS4BsqEdyXSNchEVw7Pg" value="1"/>
> <lowerValue xsi:type="uml:LiteralInteger" xmi:id="_-chD4BsqEdyXSNchEVw7Pg" value="1"/>
> </ownedEnd>
> <ownedEnd xmi:id="P:{4782FF3E-D09F-4c23-877D-621FE620B46F}" name="target" type="{4782FF3E-D09F-4c23-877D-621FE620B46F}">
> <upperValue xsi:type="uml:LiteralUnlimitedNatural" xmi:id="_-chD4RsqEdyXSNchEVw7Pg" value="1"/>
> <lowerValue xsi:type="uml:LiteralInteger" xmi:id="_-chD4hsqEdyXSNchEVw7Pg" value="1"/>
> </ownedEnd>
> </packagedElement>
> <packagedElement xsi:type="uml:Association" xmi:id="{25CDA0B9-127F-4a45-BD22-3251C864249D}" name="Association8">
> <ownedEnd xmi:id="P:{BE09C181-4341-4a05-8C02-3F84EBFD23AC}" name="source" type="{BE09C181-4341-4a05-8C02-3F84EBFD23AC}">
> <upperValue xsi:type="uml:LiteralUnlimitedNatural" xmi:id="_-chD4xsqEdyXSNchEVw7Pg" value="1"/>
> <lowerValue xsi:type="uml:LiteralInteger" xmi:id="_-chD5BsqEdyXSNchEVw7Pg" value="1"/>
> </ownedEnd>
> <ownedEnd xmi:id="P:{A48DE74E-1C20-458b-A846-58894235F891}" name="target" type="{A48DE74E-1C20-458b-A846-58894235F891}">
> <upperValue xsi:type="uml:LiteralUnlimitedNatural" xmi:id="_-chD5RsqEdyXSNchEVw7Pg" value="1"/>
> <lowerValue xsi:type="uml:LiteralInteger" xmi:id="_-cqN0BsqEdyXSNchEVw7Pg" value="1"/>
> </ownedEnd>
> </packagedElement>
> <packagedElement xsi:type="uml:Association" xmi:id="{3902B3C5-DE64-4e74-9A98-6D70838E12E4}" name="Association9">
> <ownedEnd xmi:id="P:{BE09C181-4341-4a05-8C02-3F84EBFD23AC}" name="source" type="{BE09C181-4341-4a05-8C02-3F84EBFD23AC}">
> <upperValue xsi:type="uml:LiteralUnlimitedNatural" xmi:id="_-cqN0RsqEdyXSNchEVw7Pg" value="1"/>
> <lowerValue xsi:type="uml:LiteralInteger" xmi:id="_-cqN0hsqEdyXSNchEVw7Pg" value="1"/>
> </ownedEnd>
> <ownedEnd xmi:id="P:{540A7F91-9B4D-417c-9469-DA6F8F53D403}" name="target" type="{540A7F91-9B4D-417c-9469-DA6F8F53D403}">
> <upperValue xsi:type="uml:LiteralUnlimitedNatural" xmi:id="_-cqN0xsqEdyXSNchEVw7Pg" value="1"/>
> <lowerValue xsi:type="uml:LiteralInteger" xmi:id="_-cqN1BsqEdyXSNchEVw7Pg" value="1"/>
> </ownedEnd>
> </packagedElement>
> <packagedElement xsi:type="uml:Actor" xmi:id="{BE09C181-4341-4a05-8C02-3F84EBFD23AC}" name="customer">
> <generalization xmi:id="{2E8AFA2C-E5DE-4b2f-87E0-CDF3C13B156A}" general="{7D9D3859-C7AE-4b82-94F8-5E59DB099142}"/>
> </packagedElement>
> <packagedElement xsi:type="uml:Association" xmi:id="{AE34985C-E288-42a6-8341-696E0E89068A}" name="Association6">
> <ownedEnd xmi:id="P:{BD832C10-D31F-4592-B1A1-88B272F506CD}" name="source" type="{BD832C10-D31F-4592-B1A1-88B272F506CD}">
> <upperValue xsi:type="uml:LiteralUnlimitedNatural" xmi:id="_-dG5wBsqEdyXSNchEVw7Pg" value="1"/>
> <lowerValue xsi:type="uml:LiteralInteger" xmi:id="_-dG5wRsqEdyXSNchEVw7Pg" value="1"/>
> </ownedEnd>
> <ownedEnd xmi:id="P:{D8E69A5B-8CC7-4714-8EB7-1DF40F084F29}" name="target" type="{D8E69A5B-8CC7-4714-8EB7-1DF40F084F29}">
> <upperValue xsi:type="uml:LiteralUnlimitedNatural" xmi:id="_-dG5whsqEdyXSNchEVw7Pg" value="1"/>
> <lowerValue xsi:type="uml:LiteralInteger" xmi:id="_-dG5wxsqEdyXSNchEVw7Pg" value="1"/>
> </ownedEnd>
> </packagedElement>
> <packagedElement xsi:type="uml:Actor" xmi:id="{BD832C10-D31F-4592-B1A1-88B272F506CD}" name="stuff">
> <generalization xmi:id="{16661073-770E-4ef8-A307-72593B9B52C5}" general="{7D9D3859-C7AE-4b82-94F8-5E59DB099142}"/>
> </packagedElement>
> <packagedElement xsi:type="uml:Association" xmi:id="{F52C8A06-7AFF-4ec2-88C6-FABA56004392}" name="Association3">
> <ownedEnd xmi:id="P:{7D9D3859-C7AE-4b82-94F8-5E59DB099142}" name="source" type="{7D9D3859-C7AE-4b82-94F8-5E59DB099142}">
> <upperValue xsi:type="uml:LiteralUnlimitedNatural" xmi:id="_-dG5xBsqEdyXSNchEVw7Pg" value="1"/>
> <lowerValue xsi:type="uml:LiteralInteger" xmi:id="_-dG5xRsqEdyXSNchEVw7Pg" value="1"/>
> </ownedEnd>
> <ownedEnd xmi:id="P:{9A000CE4-A4C9-44c6-8186-9AF822866031}" name="target" type="{9A000CE4-A4C9-44c6-8186-9AF822866031}">
> <upperValue xsi:type="uml:LiteralUnlimitedNatural" xmi:id="_-dG5xhsqEdyXSNchEVw7Pg" value="1"/>
> <lowerValue xsi:type="uml:LiteralInteger" xmi:id="_-dG5xxsqEdyXSNchEVw7Pg" value="1"/>
> </ownedEnd>
> </packagedElement>
> <packagedElement xsi:type="uml:Association" xmi:id="{F8C97987-D7E3-4da6-B5CA-046D034E4C69}" name="Association5">
> <ownedEnd xmi:id="P:{7D9D3859-C7AE-4b82-94F8-5E59DB099142}" name="source" type="{7D9D3859-C7AE-4b82-94F8-5E59DB099142}">
> <upperValue xsi:type="uml:LiteralUnlimitedNatural" xmi:id="_-dG5yBsqEdyXSNchEVw7Pg" value="1"/>
> <lowerValue xsi:type="uml:LiteralInteger" xmi:id="_-dG5yRsqEdyXSNchEVw7Pg" value="1"/>
> </ownedEnd>
> <ownedEnd xmi:id="P:{610E9F75-AF6F-4d99-8D2B-9BE82C67BAFD}" name="target" type="{610E9F75-AF6F-4d99-8D2B-9BE82C67BAFD}">
> <upperValue xsi:type="uml:LiteralUnlimitedNatural" xmi:id="_-dG5yhsqEdyXSNchEVw7Pg" value="1"/>
> <lowerValue xsi:type="uml:LiteralInteger" xmi:id="_-dG5yxsqEdyXSNchEVw7Pg" value="1"/>
> </ownedEnd>
> </packagedElement>
> <packagedElement xsi:type="uml:Actor" xmi:id="{7D9D3859-C7AE-4b82-94F8-5E59DB099142}" name="User"/>
> <packagedElement xsi:type="uml:UseCase" xmi:id="{A48DE74E-1C20-458b-A846-58894235F891}" name="buy a ticket">
> <include xmi:id="{3B12F9D5-DF6D-4a39-8F5E-7DD577D548B1}" name="Include10" addition="{540A7F91-9B4D-417c-9469-DA6F8F53D403}"/>
> <include xmi:id="{15E681E8-754D-4faf-8E7D-0DCCF5DE8B69}" name="Include11" addition="{D8E69A5B-8CC7-4714-8EB7-1DF40F084F29}"/>
> </packagedElement>
> <packagedElement xsi:type="uml:UseCase" xmi:id="{D8E69A5B-8CC7-4714-8EB7-1DF40F084F29}" name="deliver a ticket"/>
> <packagedElement xsi:type="uml:UseCase" xmi:id="{9A000CE4-A4C9-44c6-8186-9AF822866031}" name="log in"/>
> <packagedElement xsi:type="uml:UseCase" xmi:id="{610E9F75-AF6F-4d99-8D2B-9BE82C67BAFD}" name="log out"/>
> <packagedElement xsi:type="uml:UseCase" xmi:id="{540A7F91-9B4D-417c-9469-DA6F8F53D403}" name="pay a ticket"/>
> <packagedElement xsi:type="uml:UseCase" xmi:id="{4782FF3E-D09F-4c23-877D-621FE620B46F}" name="reserve a ticket"/>
> </packagedElement>
> </uml:Model>
Re: [ATL] non deterministic behaivor [message #47739 is a reply to message #47586] Wed, 20 June 2007 06:13 Go to previous messageGo to next message
Dennis Wagelaar is currently offline Dennis WagelaarFriend
Messages: 147
Registered: July 2009
Senior Member
Christian Hein schreef:
> Hi all,
>
> I've finished my first ATL transformation from a UML UseCase model to a
> UML HighLevel model that contains additionally classes derived from
> usecases. However, I'm getting a non deterministic behavior.
> After several executions of the same transformation I'm getting a
> different output model each time. More precisely the difference occurs
> in the nestedClassifier association of the created Class from the
> UseCase that includes other usecases ("buy a ticket" includes "pay a
> ticket" and "deliver a ticket", the created Class "buy a ticket" should
> nested the Classes "deliver a ticket" and "pay a ticket", but sometimes
> the transformation provides such a model and sometimes it provides me
> only one nested Class or non nested Classes.
>
> The corresponding ATL rule is here, additionally I've attached the
> source uml model and the whole atl transformation file.
>
>
> rule UseCase{
> from u1:UML2!UseCase
> to u2:UML2!UseCase(
> name<-u1.name,
> --owner<-u1.owner,
> include<-u1.include
> ),
> usecaseclass1:UML2!Class (
> name<-u1.name,
> useCase<-u1,
> nestedClassifier<- if u1.include->size()>0 then
> UML2!Class.allInstances()->select(c |
> u1.include->collect(i|i.addition.name)->includes(c.name) )
> else Set{} endif
> )
> }
>
>
> Thanks in advance for any help
> Cheers,
> Christian


Hi Christian,

It looks like you're trying to navigate the target model using
UML2!Class.allInstances(). Since target elements are often created in
random order, you cannot rely on them. You should use resolveTemp() to
assign non-default mappings, such as the mapping from u1 to
usecaseclass1. The rule would look like this:

rule UseCase{
from u1:UML2!UseCase
to u2:UML2!UseCase(
name<-u1.name,
--owner<-u1.owner,
include<-u1.include
),
usecaseclass1:UML2!Class (
name<-u1.name,
useCase<-u1,
nestedClassifier<- u1.include
->collect(i|thisModule
->resolveTemp(i.addition, 'usecaseclass1')
)
}

This will give you the classes to which the included use case are
mapped. Note that you again cannot navigate from the class you resolved,
since it may not have been initialised.

Regards,
Dennis
Re: [ATL] non deterministic behaivor [message #47922 is a reply to message #47739] Thu, 21 June 2007 10:53 Go to previous messageGo to next message
Frédéric Jouault is currently offline Frédéric JouaultFriend
Messages: 572
Registered: July 2009
Senior Member
Hello,

Thank you Dennis for discovering the issue.


> It looks like you're trying to navigate the target model using
> UML2!Class.allInstances(). Since target elements are often created in
> random order, you cannot rely on them. You should use resolveTemp() to
> assign non-default mappings, such as the mapping from u1 to
> usecaseclass1. The rule would look like this:

I would not say that you cannot navigate the target model *because*
target elements are often created in random order.

Instead, I would say that navigating the target model is prohibited by
ATL semantics. Therefore, the ATL engine can create elements in whatever
order makes more sense for it.

I know this may seem like a detail, but I believe it is important to
note that this is a design decision, which brings interesting
properties, not a bug ;-).


Best regards,

Frédéric Jouault

Dennis Wagelaar wrote:
> Christian Hein schreef:
>> Hi all,
>>
>> I've finished my first ATL transformation from a UML UseCase model to
>> a UML HighLevel model that contains additionally classes derived from
>> usecases. However, I'm getting a non deterministic behavior.
>> After several executions of the same transformation I'm getting a
>> different output model each time. More precisely the difference occurs
>> in the nestedClassifier association of the created Class from the
>> UseCase that includes other usecases ("buy a ticket" includes "pay a
>> ticket" and "deliver a ticket", the created Class "buy a ticket"
>> should nested the Classes "deliver a ticket" and "pay a ticket", but
>> sometimes the transformation provides such a model and sometimes it
>> provides me only one nested Class or non nested Classes.
>>
>> The corresponding ATL rule is here, additionally I've attached the
>> source uml model and the whole atl transformation file.
>>
>>
>> rule UseCase{
>> from u1:UML2!UseCase
>> to u2:UML2!UseCase(
>> name<-u1.name,
>> --owner<-u1.owner,
>> include<-u1.include
>> ),
>> usecaseclass1:UML2!Class (
>> name<-u1.name,
>> useCase<-u1,
>> nestedClassifier<- if u1.include->size()>0 then
>> UML2!Class.allInstances()->select(c |
>> u1.include->collect(i|i.addition.name)->includes(c.name) )
>> else Set{} endif
>> )
>> }
>>
>>
>> Thanks in advance for any help
>> Cheers,
>> Christian
>
>
> Hi Christian,
>
> It looks like you're trying to navigate the target model using
> UML2!Class.allInstances(). Since target elements are often created in
> random order, you cannot rely on them. You should use resolveTemp() to
> assign non-default mappings, such as the mapping from u1 to
> usecaseclass1. The rule would look like this:
>
> rule UseCase{
> from u1:UML2!UseCase
> to u2:UML2!UseCase(
> name<-u1.name,
> --owner<-u1.owner,
> include<-u1.include
> ),
> usecaseclass1:UML2!Class (
> name<-u1.name,
> useCase<-u1,
> nestedClassifier<- u1.include
> ->collect(i|thisModule
> ->resolveTemp(i.addition, 'usecaseclass1')
> )
> }
>
> This will give you the classes to which the included use case are
> mapped. Note that you again cannot navigate from the class you resolved,
> since it may not have been initialised.
>
> Regards,
> Dennis
Re: [ATL] non deterministic behaivor [message #48072 is a reply to message #47922] Thu, 21 June 2007 13:51 Go to previous messageGo to next message
Dennis Wagelaar is currently offline Dennis WagelaarFriend
Messages: 147
Registered: July 2009
Senior Member
Frédéric Jouault schreef:
> Hello,
>
> Thank you Dennis for discovering the issue.
>
>
> > It looks like you're trying to navigate the target model using
> > UML2!Class.allInstances(). Since target elements are often created in
> > random order, you cannot rely on them. You should use resolveTemp() to
> > assign non-default mappings, such as the mapping from u1 to
> > usecaseclass1. The rule would look like this:
>
> I would not say that you cannot navigate the target model *because*
> target elements are often created in random order.
>
> Instead, I would say that navigating the target model is prohibited by
> ATL semantics. Therefore, the ATL engine can create elements in whatever
> order makes more sense for it.
>
> I know this may seem like a detail, but I believe it is important to
> note that this is a design decision, which brings interesting
> properties, not a bug ;-).

That leaves one open issue: UML2!Class.allInstances() should *not*
return any elements from a target model...

Dennis

>
>
> Best regards,
>
> Frédéric Jouault
>
> Dennis Wagelaar wrote:
>> Christian Hein schreef:
>>> Hi all,
>>>
>>> I've finished my first ATL transformation from a UML UseCase model to
>>> a UML HighLevel model that contains additionally classes derived from
>>> usecases. However, I'm getting a non deterministic behavior.
>>> After several executions of the same transformation I'm getting a
>>> different output model each time. More precisely the difference
>>> occurs in the nestedClassifier association of the created Class from
>>> the UseCase that includes other usecases ("buy a ticket" includes
>>> "pay a ticket" and "deliver a ticket", the created Class "buy a
>>> ticket" should nested the Classes "deliver a ticket" and "pay a
>>> ticket", but sometimes the transformation provides such a model and
>>> sometimes it provides me only one nested Class or non nested Classes.
>>>
>>> The corresponding ATL rule is here, additionally I've attached the
>>> source uml model and the whole atl transformation file.
>>>
>>>
>>> rule UseCase{
>>> from u1:UML2!UseCase
>>> to u2:UML2!UseCase(
>>> name<-u1.name,
>>> --owner<-u1.owner,
>>> include<-u1.include
>>> ),
>>> usecaseclass1:UML2!Class (
>>> name<-u1.name,
>>> useCase<-u1,
>>> nestedClassifier<- if u1.include->size()>0 then
>>> UML2!Class.allInstances()->select(c |
>>> u1.include->collect(i|i.addition.name)->includes(c.name) )
>>> else Set{} endif
>>> )
>>> }
>>>
>>>
>>> Thanks in advance for any help
>>> Cheers,
>>> Christian
>>
>>
>> Hi Christian,
>>
>> It looks like you're trying to navigate the target model using
>> UML2!Class.allInstances(). Since target elements are often created in
>> random order, you cannot rely on them. You should use resolveTemp() to
>> assign non-default mappings, such as the mapping from u1 to
>> usecaseclass1. The rule would look like this:
>>
>> rule UseCase{
>> from u1:UML2!UseCase
>> to u2:UML2!UseCase(
>> name<-u1.name,
>> --owner<-u1.owner,
>> include<-u1.include
>> ),
>> usecaseclass1:UML2!Class (
>> name<-u1.name,
>> useCase<-u1,
>> nestedClassifier<- u1.include
>> ->collect(i|thisModule
>> ->resolveTemp(i.addition, 'usecaseclass1')
>> )
>> }
>>
>> This will give you the classes to which the included use case are
>> mapped. Note that you again cannot navigate from the class you
>> resolved, since it may not have been initialised.
>>
>> Regards,
>> Dennis
Re: [ATL] non deterministic behaivor [message #48102 is a reply to message #48072] Thu, 21 June 2007 15:31 Go to previous message
Frédéric Jouault is currently offline Frédéric JouaultFriend
Messages: 572
Registered: July 2009
Senior Member
Hello,


>> Thank you Dennis for discovering the issue.
>>
>>
>> > It looks like you're trying to navigate the target model using
>> > UML2!Class.allInstances(). Since target elements are often created in
>> > random order, you cannot rely on them. You should use
resolveTemp() to
>> > assign non-default mappings, such as the mapping from u1 to
>> > usecaseclass1. The rule would look like this:
>>
>> I would not say that you cannot navigate the target model *because*
>> target elements are often created in random order.
>>
>> Instead, I would say that navigating the target model is prohibited by
>> ATL semantics. Therefore, the ATL engine can create elements in
>> whatever order makes more sense for it.
>>
>> I know this may seem like a detail, but I believe it is important to
>> note that this is a design decision, which brings interesting
>> properties, not a bug ;-).
>
> That leaves one open issue: UML2!Class.allInstances() should *not*
> return any elements from a target model...

I totally agree with that.

AFAIK there is no open bug on this issue (yet?), but this is a planned
improvement. You can see this in the list of VM parameters, in which
there is "allowTargetNavigation" commented out (until it is implemented,
of course) ;-):

http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.m2m/org .eclipse.m2m.atl/plugins/org.eclipse.m2m.atl.adt.debug/src/o rg/eclipse/m2m/atl/adt/launching/AtlLauncherTools.java?revis ion=1.6&root=Modeling_Project&view=markup

The reasons why this option needs to be implemented rather than simply
disabling target model navigation are:
- firstly, that some already written transformations may depend on
target model navigation, and we do not want to completely break them,
- secondly, that the ATL VM can be used with other languages than ATL,
which may not all have this restriction on target model navigation.


Regards,

Frédéric Jouault

M2M Project Lead
Previous Topic:Where to get source code of ATL?
Next Topic:[ATL] How to?The enhaced Family2Person case [java objects transformation]
Goto Forum:
  


Current Time: Sat Nov 09 02:04:37 GMT 2024

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

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

Back to the top