Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] How to call a called rule.
[ATL] How to call a called rule. [message #70844] Tue, 08 January 2008 16:10 Go to next message
Mikai Yang is currently offline Mikai YangFriend
Messages: 149
Registered: July 2009
Senior Member
Hi,
I tried to call a called rule without entrypoint marked in the
imperative section, but error always occurred. Actually, I don't know syntax
about how to call a called rule. If you have idea about that, please inform
me. Strangely, in the ALT Manual, there is no such syntax. I hope the author
can add it later on. Thanks.
Michael.
Re: [ATL] How to call a called rule. [message #70864 is a reply to message #70844] Tue, 08 January 2008 16:15 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mikael.barbero.gmail.com

Hi,

Can you give us an excerpt of your transformation? Especially your
called rule and where you tried to call it. Also, what kind of error do
you have?

Regards,
Mikael

Michael wrote:
> Hi,
> I tried to call a called rule without entrypoint marked in the
> imperative section, but error always occurred. Actually, I don't know syntax
> about how to call a called rule. If you have idea about that, please inform
> me. Strangely, in the ALT Manual, there is no such syntax. I hope the author
> can add it later on. Thanks.
> Michael.
>
>



--
Mikaël Barbero - PhD Candidate
ATLAS Group (INRIA & LINA) - University of Nantes
2, rue de la Houssinière
44322 Nantes Cedex 3 - France
tel. +33 2 51 12 58 08 /\ cell.+33 6 07 63 19 00
email: Mikael.Barbero@{gmail.com, univ-nantes.fr}
http://www.sciences.univ-nantes.fr/lina/atl/
Re: [ATL] How to call a called rule. [message #70884 is a reply to message #70864] Tue, 08 January 2008 16:18 Go to previous messageGo to next message
Mikai Yang is currently offline Mikai YangFriend
Messages: 149
Registered: July 2009
Senior Member
Hi,
here is the excerpt:

------------------------------------------------
module A2B; -- Module Template
create bperson : B from aperson : A;

rule APerson2BPerson {
from
ap:A!APerson
to
bp:B!BPerson(

)
do{
NewName(ap.name); -- call the rule.
}
}

rule NewName(name:String){ -- a called rule
to
bn:B!BName(
value<-name
)
}
----------------------------------------------
Thanks.

Michael.








"Mika
Re: [ATL] How to call a called rule. [message #70904 is a reply to message #70884] Tue, 08 January 2008 16:41 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mikael.barbero.gmail.com

You should prefix the call by "thisModule.":
thisModule.NewName(ap.name)

Hope this helps.

Regards,
Mikael

Michael wrote:
> Hi,
> here is the excerpt:
>
> ------------------------------------------------
> module A2B; -- Module Template
> create bperson : B from aperson : A;
>
> rule APerson2BPerson {
> from
> ap:A!APerson
> to
> bp:B!BPerson(
>
> )
> do{
> NewName(ap.name); -- call the rule.
> }
> }
>
> rule NewName(name:String){ -- a called rule
> to
> bn:B!BName(
> value<-name
> )
> }
> ----------------------------------------------
> Thanks.
>
> Michael.
>
>
>
>
>
>
>
>
> "Mikaël Barbero" <mikael.barbero@gmail.com> wrote in message
> news:fm07je$aq4$1@build.eclipse.org...
>> Hi,
>>
>> Can you give us an excerpt of your transformation? Especially your called
>> rule and where you tried to call it. Also, what kind of error do you have?
>>
>> Regards,
>> Mikael
>>
>> Michael wrote:
>>> Hi,
>>> I tried to call a called rule without entrypoint marked in the
>>> imperative section, but error always occurred. Actually, I don't know
>>> syntax about how to call a called rule. If you have idea about that,
>>> please inform me. Strangely, in the ALT Manual, there is no such syntax.
>>> I hope the author can add it later on. Thanks.
>>> Michael.
>>
>>
>> --
>> Mikaël Barbero - PhD Candidate
>> ATLAS Group (INRIA & LINA) - University of Nantes
>> 2, rue de la Houssinière
>> 44322 Nantes Cedex 3 - France
>> tel. +33 2 51 12 58 08 /\ cell.+33 6 07 63 19 00
>> email: Mikael.Barbero@{gmail.com, univ-nantes.fr}
>> http://www.sciences.univ-nantes.fr/lina/atl/
>
>



--
Mikaël Barbero - PhD Candidate
ATLAS Group (INRIA & LINA) - University of Nantes
2, rue de la Houssinière
44322 Nantes Cedex 3 - France
tel. +33 2 51 12 58 08 /\ cell.+33 6 07 63 19 00
email: Mikael.Barbero@{gmail.com, univ-nantes.fr}
http://www.sciences.univ-nantes.fr/lina/atl/
Re: [ATL] How to call a called rule. [message #70924 is a reply to message #70904] Tue, 08 January 2008 17:36 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mikael.barbero.gmail.com

You should better call the called rule in the "to" part of your
APerson2BPerson rule:

rule APerson2BPerson {
from
ap:A!APerson
to
bp:B!BPerson(
name <- thisModule.NewName(ap.name)
)
}

but then you should better do this (and do not use called rules):

rule APerson2BPerson {
from
ap:A!APerson
to
bp:B!BPerson(
name <- bpname
),
bpname : B!BName (
name <- ap.name
)
}

Regards,
Mikael

On Jan 8, 2008 5:59 PM, Yang, Mikai <my25@hw.ac.uk> wrote:
> Hi,
> Thanks for your help. I have solved the problem .Now the
following rules work, however, I come up with another problems. In the
imperative section, I call the called rules to assign the newly
generated 'Name' to reference of source element. And I looked into the
generated .xmi file. The name is successfully generated, but, there is
no relationship between the two generated model element. I don't know
why. Do you have any idea about this?
> Bye the way, the source metamodel is simple: APerson with an
attribute 'name' . The target metamodel is also simple, BPerson with a
one-way reference to Bname, which has an attribute 'value' .
> The generated .xmi file is as follows:
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <xmi:XMI xmi:version="2.0"
xmlns:xmi="http://www.omg.org/XMI"
xmlns:TargetModel="http://www.macs.hw.ac.uk/my25">
> <TargetModel:BPerson/>
> <TargetModel:BName value="Michael"/>
> </xmi:XMI>
> Thank you again.
> Michael.
>
>
> module A2B; -- Module Template
> create bperson : B from aperson : A;
>
> rule APerson2BPerson {
> from
> ap:A!APerson
>
> to
> bp:B!BPerson(
>
> )
> do{
> bp.name <- thisModule.NewName(ap.name);
> }
>
> }
>
> rule NewName(n:String){ -- a called rule
> to
> bn:B!BName(
> value<-n
> )
> }

Mikaël Barbero wrote:
> You should prefix the call by "thisModule.":
> thisModule.NewName(ap.name)
>
> Hope this helps.
>
> Regards,
> Mikael
>
> Michael wrote:
>> Hi,
>> here is the excerpt:
>>
>> ------------------------------------------------
>> module A2B; -- Module Template
>> create bperson : B from aperson : A;
>>
>> rule APerson2BPerson {
>> from
>> ap:A!APerson
>> to
>> bp:B!BPerson(
>>
>> )
>> do{
>> NewName(ap.name); -- call the rule.
>> }
>> }
>>
>> rule NewName(name:String){ -- a called rule
>> to
>> bn:B!BName(
>> value<-name
>> )
>> }
>> ----------------------------------------------
>> Thanks.
>>
>> Michael.
>>
>>
>>
>>
>>
>>
>>
>>
>> "Mikaël Barbero" <mikael.barbero@gmail.com> wrote in message
>> news:fm07je$aq4$1@build.eclipse.org...
>>> Hi,
>>>
>>> Can you give us an excerpt of your transformation? Especially your
>>> called rule and where you tried to call it. Also, what kind of error
>>> do you have?
>>>
>>> Regards,
>>> Mikael
>>>
>>> Michael wrote:
>>>> Hi,
>>>> I tried to call a called rule without entrypoint marked in the
>>>> imperative section, but error always occurred. Actually, I don't
>>>> know syntax about how to call a called rule. If you have idea about
>>>> that, please inform me. Strangely, in the ALT Manual, there is no
>>>> such syntax. I hope the author can add it later on. Thanks.
>>>> Michael.
>>>
>>>
>>> --
>>> Mikaël Barbero - PhD Candidate
>>> ATLAS Group (INRIA & LINA) - University of Nantes
>>> 2, rue de la Houssinière
>>> 44322 Nantes Cedex 3 - France
>>> tel. +33 2 51 12 58 08 /\ cell.+33 6 07 63 19 00
>>> email: Mikael.Barbero@{gmail.com, univ-nantes.fr}
>>> http://www.sciences.univ-nantes.fr/lina/atl/
>>
>>
>
>
>



--
Mikaël Barbero - PhD Candidate
ATLAS Group (INRIA & LINA) - University of Nantes
2, rue de la Houssinière
44322 Nantes Cedex 3 - France
tel. +33 2 51 12 58 08 /\ cell.+33 6 07 63 19 00
email: Mikael.Barbero@{gmail.com, univ-nantes.fr}
http://www.sciences.univ-nantes.fr/lina/atl/
Re: [ATL] How to call a called rule. [message #70944 is a reply to message #70924] Tue, 08 January 2008 18:15 Go to previous messageGo to next message
Mikai Yang is currently offline Mikai YangFriend
Messages: 149
Registered: July 2009
Senior Member
Thank you very much. The problem is gone. I got the following output.
However, the generated file has specified the metamodel location. And each
time I have to manually add the metamodel location. It is not convenient. Do
you know how to automatically generate the metamodel location?

<?xml version="1.0" encoding="ISO-8859-1"?>
<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
xmlns:TargetModel="http://www.macs.hw.ac.uk/my25">
<TargetModel:BPerson name="/1"/>
<TargetModel:BName value="Michael"/>
</xmi:XMI>
Thanks.
Best regards.
Michael.

"Mika
Re: [ATL] How to call a called rule. [message #70963 is a reply to message #70944] Wed, 09 January 2008 10:06 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mikael.barbero.gmail.com

I don't think I understand your problem very well. Do you mean that the
xmlns:TargetModel="http://www.macs.hw.ac.uk/my25" is not defined
automatically in the output of the transformation and that you have set
it by hand? Can you paste here what you have as an output and what you
expected? Thanks.

Mikael

Michael wrote:
> Thank you very much. The problem is gone. I got the following output.
> However, the generated file has specified the metamodel location. And each
> time I have to manually add the metamodel location. It is not convenient. Do
> you know how to automatically generate the metamodel location?
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
> xmlns:TargetModel="http://www.macs.hw.ac.uk/my25">
> <TargetModel:BPerson name="/1"/>
> <TargetModel:BName value="Michael"/>
> </xmi:XMI>
> Thanks.
> Best regards.
> Michael.
>
> "Mikaël Barbero" <mikael.barbero@gmail.com> wrote in message
> news:fm0cb7$19t$1@build.eclipse.org...
>> You should better call the called rule in the "to" part of your
>> APerson2BPerson rule:
>>
>> rule APerson2BPerson {
>> from
>> ap:A!APerson
>> to
>> bp:B!BPerson(
>> name <- thisModule.NewName(ap.name)
>> )
>> }
>>
>> but then you should better do this (and do not use called rules):
>>
>> rule APerson2BPerson {
>> from
>> ap:A!APerson
>> to
>> bp:B!BPerson(
>> name <- bpname
>> ),
>> bpname : B!BName (
>> name <- ap.name
>> )
>> }
>>
>> Regards,
>> Mikael
>>
>> On Jan 8, 2008 5:59 PM, Yang, Mikai <my25@hw.ac.uk> wrote:
>>> Hi,
>>> Thanks for your help. I have solved the problem .Now the
>> following rules work, however, I come up with another problems. In the
>> imperative section, I call the called rules to assign the newly generated
>> 'Name' to reference of source element. And I looked into the generated
>> .xmi file. The name is successfully generated, but, there is no
>> relationship between the two generated model element. I don't know why. Do
>> you have any idea about this?
>>> Bye the way, the source metamodel is simple: APerson with an
>> attribute 'name' . The target metamodel is also simple, BPerson with a
>> one-way reference to Bname, which has an attribute 'value' .
>>> The generated .xmi file is as follows:
>>> <?xml version="1.0" encoding="ISO-8859-1"?>
>>> <xmi:XMI xmi:version="2.0"
>> xmlns:xmi="http://www.omg.org/XMI"
>> xmlns:TargetModel="http://www.macs.hw.ac.uk/my25">
>>> <TargetModel:BPerson/>
>>> <TargetModel:BName value="Michael"/>
>>> </xmi:XMI>
>>> Thank you again.
>>> Michael.
>>>
>>>
>>> module A2B; -- Module Template
>>> create bperson : B from aperson : A;
>>>
>>> rule APerson2BPerson {
>>> from
>>> ap:A!APerson
>>>
>>> to
>>> bp:B!BPerson(
>>>
>>> )
>>> do{
>>> bp.name <- thisModule.NewName(ap.name);
>>> }
>>>
>>> }
>>>
>>> rule NewName(n:String){ -- a called rule
>>> to
>>> bn:B!BName(
>>> value<-n
>>> )
>>> }
>> Mikaël Barbero wrote:
>>> You should prefix the call by "thisModule.":
>>> thisModule.NewName(ap.name)
>>>
>>> Hope this helps.
>>>
>>> Regards,
>>> Mikael
>>>
>>> Michael wrote:
>>>> Hi,
>>>> here is the excerpt:
>>>>
>>>> ------------------------------------------------
>>>> module A2B; -- Module Template
>>>> create bperson : B from aperson : A;
>>>>
>>>> rule APerson2BPerson {
>>>> from
>>>> ap:A!APerson
>>>> to
>>>> bp:B!BPerson(
>>>>
>>>> )
>>>> do{
>>>> NewName(ap.name); -- call the rule.
>>>> }
>>>> }
>>>>
>>>> rule NewName(name:String){ -- a called rule
>>>> to
>>>> bn:B!BName(
>>>> value<-name
>>>> )
>>>> }
>>>> ----------------------------------------------
>>>> Thanks.
>>>>
>>>> Michael.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> "Mikaël Barbero" <mikael.barbero@gmail.com> wrote in message
>>>> news:fm07je$aq4$1@build.eclipse.org...
>>>>> Hi,
>>>>>
>>>>> Can you give us an excerpt of your transformation? Especially your
>>>>> called rule and where you tried to call it. Also, what kind of error do
>>>>> you have?
>>>>>
>>>>> Regards,
>>>>> Mikael
>>>>>
>>>>> Michael wrote:
>>>>>> Hi,
>>>>>> I tried to call a called rule without entrypoint marked in the
>>>>>> imperative section, but error always occurred. Actually, I don't know
>>>>>> syntax about how to call a called rule. If you have idea about that,
>>>>>> please inform me. Strangely, in the ALT Manual, there is no such
>>>>>> syntax. I hope the author can add it later on. Thanks.
>>>>>> Michael.
>>>>>
>>>>> --
>>>>> Mikaël Barbero - PhD Candidate
>>>>> ATLAS Group (INRIA & LINA) - University of Nantes
>>>>> 2, rue de la Houssinière
>>>>> 44322 Nantes Cedex 3 - France
>>>>> tel. +33 2 51 12 58 08 /\ cell.+33 6 07 63 19 00
>>>>> email: Mikael.Barbero@{gmail.com, univ-nantes.fr}
>>>>> http://www.sciences.univ-nantes.fr/lina/atl/
>>>>
>>>
>>>
>>
>>
>> --
>> Mikaël Barbero - PhD Candidate
>> ATLAS Group (INRIA & LINA) - University of Nantes
>> 2, rue de la Houssinière
>> 44322 Nantes Cedex 3 - France
>> tel. +33 2 51 12 58 08 /\ cell.+33 6 07 63 19 00
>> email: Mikael.Barbero@{gmail.com, univ-nantes.fr}
>> http://www.sciences.univ-nantes.fr/lina/atl/
>
>



--
Mikaël Barbero - PhD Candidate
ATLAS Group (INRIA & LINA) - University of Nantes
2, rue de la Houssinière
44322 Nantes Cedex 3 - France
tel. +33 2 51 12 58 08 /\ cell.+33 6 07 63 19 00
email: Mikael.Barbero@{gmail.com, univ-nantes.fr}
http://www.sciences.univ-nantes.fr/lina/atl/
Re: [ATL] How to call a called rule. [message #71025 is a reply to message #70963] Wed, 09 January 2008 11:52 Go to previous messageGo to next message
Mikai Yang is currently offline Mikai YangFriend
Messages: 149
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.

------=_NextPart_000_0087_01C852B6.1226FE50
Content-Type: text/plain;
charset="ISO-8859-1"
Content-Transfer-Encoding: quoted-printable

Hi,=20
The output is like:=20
<?xml version=3D"1.0" encoding=3D"ISO-8859-1"?>
<xmi:XMI xmi:version=3D"2.0" =
xmlns:xmi=3D"http://www.omg.org/XMI" =
xmlns:TargetModel=3D"http://www.macs.hw.ac.uk/my25">
<TargetModel:BPerson name=3D"/1"/>
<TargetModel:BName value=3D"Michael"/>
</xmi:XMI>
I cannot use Sample Reflective Ecore Model Editor to edit this =
model because error occurs, and have to use text editor to open it. If =
I mannually modify this output to the following. See the bold words, =
then I can use the Sample Reflective Ecore Model Editor to open it. I =
put the metamodels in a different folder, say metamodels.=20
=20
<?xml version=3D"1.0" encoding=3D"ISO-8859-1"?>
<xmi:XMI xmi:version=3D"2.0" =
xmlns:xmi=3D"http://www.omg.org/XMI" =
xmlns:TargetModel=3D"http://www.macs.hw.ac.uk/my25" =
xsi:schemaLocation=3D"http://www.macs.hw.ac.uk/my25 =
.../metamodels/B.ecore" >
<TargetModel:BPerson name=3D"/1"/>
<TargetModel:BName value=3D"Michael"/>
</xmi:XMI>

Thanks.=20


Michael.=20



=20
"Mika=EBl Barbero" <mikael.barbero@gmail.com> wrote in message =
news:fm26bb$up2$1@build.eclipse.org...
>I don't think I understand your problem very well. Do you mean that the =

> xmlns:TargetModel=3D"http://www.macs.hw.ac.uk/my25" is not defined=20
> automatically in the output of the transformation and that you have =
set=20
> it by hand? Can you paste here what you have as an output and what you =

> expected? Thanks.
>=20
> Mikael
>=20
> Michael wrote:
>> Thank you very much. The problem is gone. I got the following output. =

>> However, the generated file has specified the metamodel location. And =
each=20
>> time I have to manually add the metamodel location. It is not =
convenient. Do=20
>> you know how to automatically generate the metamodel location?
>>=20
>> <?xml version=3D"1.0" encoding=3D"ISO-8859-1"?>
>> <xmi:XMI xmi:version=3D"2.0" xmlns:xmi=3D"http://www.omg.org/XMI" =

>> xmlns:TargetModel=3D"http://www.macs.hw.ac.uk/my25">
>> <TargetModel:BPerson name=3D"/1"/>
>> <TargetModel:BName value=3D"Michael"/>
>> </xmi:XMI>
>> Thanks.
>> Best regards.
>> Michael.
>>=20
>> "Mika=EBl Barbero" <mikael.barbero@gmail.com> wrote in message=20
>> news:fm0cb7$19t$1@build.eclipse.org...
>>> You should better call the called rule in the "to" part of your=20
>>> APerson2BPerson rule:
>>>
>>> rule APerson2BPerson {
>>> from
>>> ap:A!APerson
>>> to
>>> bp:B!BPerson(
>>> name <- thisModule.NewName(ap.name)
>>> )
>>> }
>>>
>>> but then you should better do this (and do not use called rules):
>>>
>>> rule APerson2BPerson {
>>> from
>>> ap:A!APerson
>>> to
>>> bp:B!BPerson(
>>> name <- bpname
>>> ),
>>> bpname : B!BName (
>>> name <- ap.name
>>> )
>>> }
>>>
>>> Regards,
>>> Mikael
>>>
>>> On Jan 8, 2008 5:59 PM, Yang, Mikai <my25@hw.ac.uk> wrote:
>>>> Hi,
>>>> Thanks for your help. I have solved the problem .Now the
>>> following rules work, however, I come up with another problems. In =
the=20
>>> imperative section, I call the called rules to assign the newly =
generated=20
>>> 'Name' to reference of source element. And I looked into the =
generated=20
>>> .xmi file. The name is successfully generated, but, there is no=20
>>> relationship between the two generated model element. I don't know =
why. Do=20
>>> you have any idea about this?
>>>> Bye the way, the source metamodel is simple: APerson with an
>>> attribute 'name' . The target metamodel is also simple, BPerson with =
a=20
>>> one-way reference to Bname, which has an attribute 'value' .
>>>> The generated .xmi file is as follows:
>>>> <?xml version=3D"1.0" encoding=3D"ISO-8859-1"?>
>>>> <xmi:XMI xmi:version=3D"2.0"
>>> xmlns:xmi=3D"http://www.omg.org/XMI"=20
>>> xmlns:TargetModel=3D"http://www.macs.hw.ac.uk/my25">
>>>> <TargetModel:BPerson/>
>>>> <TargetModel:BName value=3D"Michael"/>
>>>> </xmi:XMI>
>>>> Thank you again.
>>>> Michael.
>>>>
>>>>
>>>> module A2B; -- Module Template
>>>> create bperson : B from aperson : A;
>>>>
>>>> rule APerson2BPerson {
>>>> from
>>>> ap:A!APerson
>>>>
>>>> to
>>>> bp:B!BPerson(
>>>>
>>>> )
>>>> do{
>>>> bp.name <- thisModule.NewName(ap.name);
>>>> }
>>>>
>>>> }
>>>>
>>>> rule NewName(n:String){ -- a called rule
>>>> to
>>>> bn:B!BName(
>>>> value<-n
>>>> )
>>>> }
>>> Mika=EBl Barbero wrote:
>>>> You should prefix the call by "thisModule.":
>>>> thisModule.NewName(ap.name)
>>>>
>>>> Hope this helps.
>>>>
>>>> Regards,
>>>> Mikael
>>>>
>>>> Michael wrote:
>>>>> Hi,
>>>>> here is the excerpt:
>>>>>
>>>>> ------------------------------------------------
>>>>> module A2B; -- Module Template
>>>>> create bperson : B from aperson : A;
>>>>>
>>>>> rule APerson2BPerson {
>>>>> from
>>>>> ap:A!APerson
>>>>> to
>>>>> bp:B!BPerson(
>>>>>
>>>>> )
>>>>> do{
>>>>> NewName(ap.name); -- call the rule.
>>>>> }
>>>>> }
>>>>>
>>>>> rule NewName(name:String){ -- a called rule
>>>>> to
>>>>> bn:B!BName(
>>>>> value<-name
>>>>> )
>>>>> }
>>>>> ----------------------------------------------
>>>>> Thanks.
>>>>>
>>>>> Michael.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> "Mika=EBl Barbero" <mikael.barbero@gmail.com> wrote in message=20
>>>>> news:fm07je$aq4$1@build.eclipse.org...
>>>>>> Hi,
>>>>>>
>>>>>> Can you give us an excerpt of your transformation? Especially =
your=20
>>>>>> called rule and where you tried to call it. Also, what kind of =
error do=20
>>>>>> you have?
>>>>>>
>>>>>> Regards,
>>>>>> Mikael
>>>>>>
>>>>>> Michael wrote:
>>>>>>> Hi,
>>>>>>> I tried to call a called rule without entrypoint marked in =
the=20
>>>>>>> imperative section, but error always occurred. Actually, I don't =
know=20
>>>>>>> syntax about how to call a called rule. If you have idea about =
that,=20
>>>>>>> please inform me. Strangely, in the ALT Manual, there is no such =

>>>>>>> syntax. I hope the author can add it later on. Thanks.
>>>>>>> Michael.
>>>>>>
>>>>>> --=20
>>>>>> Mika=EBl Barbero - PhD Candidate
>>>>>> ATLAS Group (INRIA & LINA) - University of Nantes
>>>>>> 2, rue de la Houssini=E8re
>>>>>> 44322 Nantes Cedex 3 - France
>>>>>> tel. +33 2 51 12 58 08 /\ cell.+33 6 07 63 19 00
>>>>>> email: Mikael.Barbero@{gmail.com, univ-nantes.fr}
>>>>>> http://www.sciences.univ-nantes.fr/lina/atl/
>>>>>
>>>>
>>>>
>>>
>>>
>>> --=20
>>> Mika=EBl Barbero - PhD Candidate
>>> ATLAS Group (INRIA & LINA) - University of Nantes
>>> 2, rue de la Houssini=E8re
>>> 44322 Nantes Cedex 3 - France
>>> tel. +33 2 51 12 58 08 /\ cell.+33 6 07 63 19 00
>>> email: Mikael.Barbero@{gmail.com, univ-nantes.fr}
>>> http://www.sciences.univ-nantes.fr/lina/atl/=20
>>=20
>>=20
>=20
>=20
>=20
> --=20
> Mika=EBl Barbero - PhD Candidate
> ATLAS Group (INRIA & LINA) - University of Nantes
> 2, rue de la Houssini=E8re
> 44322 Nantes Cedex 3 - France
> tel. +33 2 51 12 58 08 /\ cell.+33 6 07 63 19 00
> email: Mikael.Barbero@{gmail.com, univ-nantes.fr}
> http://www.sciences.univ-nantes.fr/lina/atl/
------=_NextPart_000_0087_01C852B6.1226FE50
Content-Type: text/html;
charset="ISO-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2900.3243" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>Hi, </FONT></DIV>
<DIV><FONT face=3DArial =
size=3D2> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;=20
The output is like: </FONT></DIV>
<DIV><FONT face=3DArial=20
size=3D2> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;&nbsp;&nbsp;=20
&lt;?xml version=3D"1.0"=20
encoding=3D"ISO-8859-1"?&gt;<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;=
&nbsp;=20
&lt;xmi:XMI xmi:version=3D"2.0" xmlns:xmi=3D"</FONT><A=20
href=3D"http://www.omg.org/XMI"><FONT face=3DArial=20
size=3D2>http://www.omg.org/XMI</FONT></A><FONT face=3DArial size=3D2>"=20
xmlns:TargetModel=3D"</FONT><A =
href=3D"http://www.macs.hw.ac.uk/my25"><FONT=20
face=3DArial size=3D2>http://www.macs.hw.ac.uk/my25</FONT></A><FONT =
face=3DArial=20
size=3D2>"&gt;<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
&lt;TargetModel:BPerson=20
name=3D"/1"/&gt;<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;&nbsp;=20
&nbsp;&lt;TargetModel:BName=20
value=3D"Michael"/&gt;<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
&lt;/xmi:XMI&gt;</FONT></DIV>
<DIV><FONT face=3DArial size=3D2> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; I =
cannot use=20
Sample Reflective Ecore Model Editor to edit this model because error =
occurs,=20
and have to use text editor to open it. &nbsp;If I mannually modify this =
output=20
to the following. See the bold words, then&nbsp;I can use&nbsp;the =
Sample=20
Reflective Ecore Model Editor to open it.&nbsp;I put&nbsp; the =
metamodels=20
in&nbsp;a different folder,&nbsp;say metamodels.&nbsp;</FONT></DIV>
<DIV><FONT face=3DArial =
size=3D2> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </FONT><FONT=20
face=3DArial size=3D2>&nbsp;&nbsp;</FONT></DIV>
<DIV><FONT face=3DArial=20
size=3D2> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;=20
&lt;?xml version=3D"1.0"=20
encoding=3D"ISO-8859-1"?&gt;<BR> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;&nbsp;=20
&lt;xmi:XMI xmi:version=3D"2.0" xmlns:xmi=3D"</FONT><A=20
href=3D"http://www.omg.org/XMI"><FONT face=3DArial=20
size=3D2>http://www.omg.org/XMI</FONT></A><FONT face=3DArial size=3D2>"=20
xmlns:TargetModel=3D"</FONT><A =
href=3D"http://www.macs.hw.ac.uk/my25"><FONT=20
face=3DArial size=3D2>http://www.macs.hw.ac.uk/my25</FONT></A><FONT =
face=3DArial=20
size=3D2>"&nbsp;<STRONG>xsi:schemaLocation=3D"</STRONG ></FONT><A=20
href=3D"http://www.macs.hw.ac.uk/my25"><FONT face=3DArial=20
size=3D2><STRONG>http://www.macs.hw.ac.uk/my25</STRONG></FONT></A><FONT =
face=3DArial=20
size=3D2><STRONG> ../metamodels/B.ecore"</STRONG> &gt;<BR>&nbsp;=20
&lt;TargetModel:BPerson name=3D"/1"/&gt;<BR>&nbsp; &lt;TargetModel:BName =

value=3D"Michael"/&gt;<BR>&lt;/xmi:XMI&gt;</FONT ></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Thanks.=20
</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Michael. </DIV>
<DIV><BR></DIV></FONT>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial=20
size=3D2> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;&nbsp;&nbsp; </FONT></DI=
V>
<DIV><FONT face=3DArial size=3D2>"Mika=EBl Barbero" &lt;</FONT><A=20
href=3D"mailto:mikael.barbero@gmail.com"><FONT face=3DArial=20
size=3D2>mikael.barbero@gmail.com</FONT></A><FONT face=3DArial =
size=3D2>&gt; wrote in=20
message </FONT><A href=3D"news:fm26bb$up2$1@build.eclipse.org"><FONT =
face=3DArial=20
size=3D2>news:fm26bb$up2$1@build.eclipse.org</FONT></A><FONT =
face=3DArial=20
size=3D2>...</FONT></DIV><FONT face=3DArial size=3D2>&gt;I don't think I =
understand=20
your problem very well. Do you mean that the <BR>&gt;=20
xmlns:TargetModel=3D"</FONT><A =
href=3D"http://www.macs.hw.ac.uk/my25"><FONT=20
face=3DArial size=3D2>http://www.macs.hw.ac.uk/my25</FONT></A><FONT =
face=3DArial=20
size=3D2>" is not defined <BR>&gt; automatically in the output of the=20
transformation and that you have set <BR>&gt; it by hand? Can you paste =
here=20
what you have as an output and what you <BR>&gt; expected? =
Thanks.<BR>&gt;=20
<BR>&gt; Mikael<BR>&gt; <BR>&gt; Michael wrote:<BR>&gt;&gt; Thank you =
very much.=20
The problem is gone. I got the following output. <BR>&gt;&gt; However, =
the=20
generated file has specified the metamodel location. And each =
<BR>&gt;&gt; time=20
I have to manually add the metamodel location. It is not convenient. Do=20
<BR>&gt;&gt; you know how to automatically generate the metamodel=20
location?<BR>&gt;&gt; <BR> &gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;& ;nbsp; =
&lt;?xml=20
version=3D"1.0" =
encoding=3D"ISO-8859-1"?&gt;<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
&lt;xmi:XMI xmi:version=3D"2.0" xmlns:xmi=3D"</FONT><A=20
href=3D"http://www.omg.org/XMI"><FONT face=3DArial=20
size=3D2>http://www.omg.org/XMI</FONT></A><FONT face=3DArial size=3D2>" =
<BR>&gt;&gt;=20
xmlns:TargetModel=3D"</FONT><A =
href=3D"http://www.macs.hw.ac.uk/my25"><FONT=20
face=3DArial size=3D2>http://www.macs.hw.ac.uk/my25</FONT></A><FONT =
face=3DArial=20
size=3D2>"&gt;<BR> &gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;& ;nbsp;&nbsp;=20
&lt;TargetModel:BPerson=20
name=3D"/1"/&gt;<BR> &gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;& ;nbsp;&nbsp;=20
&lt;TargetModel:BName =
value=3D"Michael"/&gt;<BR>&gt;&gt;&nbsp;&nbsp;&nbsp;&nbsp;=20
&lt;/xmi:XMI&gt;<BR>&gt;&gt; Thanks.<BR>&gt;&gt; Best =
regards.<BR>&gt;&gt;=20
Michael.<BR>&gt;&gt; <BR>&gt;&gt; "Mika=EBl Barbero" &lt;</FONT><A=20
href=3D"mailto:mikael.barbero@gmail.com"><FONT face=3DArial=20
size=3D2>mikael.barbero@gmail.com</FONT></A><FONT face=3DArial =
size=3D2>&gt; wrote in=20
message <BR>&gt;&gt; </FONT><A =
href=3D"news:fm0cb7$19t$1@build.eclipse.org"><FONT=20
face=3DArial =
size=3D2>news:fm0cb7$19t$1@build.eclipse.org</FONT></A><FONT =
face=3DArial=20
size=3D2>...<BR>&gt;&gt;&gt; You should better call the called rule in =
the "to"=20
part of your <BR>&gt;&gt;&gt; APerson2BPerson=20
rule:<BR>&gt;&gt;&gt;<BR>&gt;&gt;&gt; rule APerson2BPerson=20
{<BR> &gt;&gt;&gt;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;=20
from<BR> &gt;&gt;&gt;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;=20
ap:A!APerson<BR> &gt;&gt;&gt;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;=20
to<BR> &gt;&gt;&gt;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;=20
bp:B!BPerson(<BR> &gt;&gt;&gt;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
name &lt;-=20
thisModule.NewName(ap.name)<BR> &gt;&gt;&gt;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;=20
)<BR>&gt;&gt;&gt; }<BR>&gt;&gt;&gt;<BR>&gt;&gt;&gt; but then you should =
better=20
do this (and do not use called rules):<BR>&gt;&gt;&gt;<BR>&gt;&gt;&gt; =
rule=20
APerson2BPerson =
{<BR> &gt;&gt;&gt;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;=20
from<BR> &gt;&gt;&gt;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp=
;&nbsp;=20
ap:A!APerson<BR> &gt;&gt;&gt;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;=20
to<BR> &gt;&gt;&gt;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;=20
bp:B!BPerson(<BR> &gt;&gt;&gt;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
name &lt;-=20
bpname<BR> &gt;&gt;&gt;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;=20
),<BR> &gt;&gt;&gt;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
bpname=20
: B!BName=20
(<BR> &gt;&gt;&gt;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n =
bsp;&nbsp;&nbsp;&nbsp;=20
name &lt;-=20
ap.name<BR> &gt;&gt;&gt;&nbsp;&nbsp;&nbsp;&n bsp;&nbsp;&nbsp;&nbsp;&nbsp;&n=
bsp;=20
)<BR>&gt;&gt;&gt; }<BR>&gt;&gt;&gt;<BR>&gt;&gt;&gt; =
Regards,<BR>&gt;&gt;&gt;=20
Mikael<BR>&gt;&gt;&gt;<BR>&gt;&gt;&gt; On Jan 8, 2008 5:59 PM, Yang, =
Mikai=20
&lt;</FONT><A href=3D"mailto:my25@hw.ac.uk"><FONT face=3DArial=20
size=3D2>my25@hw.ac.uk</FONT></A><FONT face=3DArial size=3D2>&gt;=20
wrote:<BR>&gt;&gt;&gt;&gt;=20
Hi,<BR> &gt;&gt;&gt;&gt;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;&nbsp; Thanks for =
your=20
help. I have solved the problem .Now the<BR>&gt;&gt;&gt; following rules =
work,=20
however, I come up with another problems.&nbsp; In the <BR>&gt;&gt;&gt;=20
imperative section, I call the called rules to assign the newly =
generated=20
<BR>&gt;&gt;&gt; 'Name' to reference of source element. And I looked =
into the=20
generated <BR>&gt;&gt;&gt; .xmi file. The name is successfully =
generated, but,=20
there is no <BR>&gt;&gt;&gt; relationship between the two generated =
model=20
element. I don't know why. Do <BR>&gt;&gt;&gt; you have any idea about=20
this?<BR> &gt;&gt;&gt;&gt;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp; Bye the way, the =
source=20
metamodel is simple: APerson with an<BR>&gt;&gt;&gt; attribute 'name' . =
The=20
target metamodel is also simple, BPerson with a <BR>&gt;&gt;&gt; one-way =

reference to Bname, which has an attribute 'value'=20
..<BR> &gt;&gt;&gt;&gt;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp; The generated .xmi =
file is=20
as=20
follows:<BR> &gt;&gt;&gt;&gt;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;=20
&lt;?xml version=3D"1.0"=20
encoding=3D"ISO-8859-1"?&gt;<BR> &gt;&gt;&gt;&gt;&nbsp;&nbsp;&nbs p;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& n=
bsp;=20
&lt;xmi:XMI xmi:version=3D"2.0"<BR>&gt;&gt;&gt; xmlns:xmi=3D"</FONT><A=20
href=3D"http://www.omg.org/XMI"><FONT face=3DArial=20
size=3D2>http://www.omg.org/XMI</FONT></A><FONT face=3DArial size=3D2>"=20
<BR>&gt;&gt;&gt; xmlns:TargetModel=3D"</FONT><A=20
href=3D"http://www.macs.hw.ac.uk/my25"><FONT face=3DArial=20
size=3D2>http://www.macs.hw.ac.uk/my25</FONT></A><FONT face=3DArial=20
size=3D2>"&gt;<BR> &gt;&gt;&gt;&gt;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb sp;&nbsp;&nbsp;&nbsp;&nbsp;=20
&lt;TargetModel:BPerson/&gt;<BR> &gt;&gt;&gt;&gt;&nbsp;&nbsp;&nbs p;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
&lt;TargetModel:BName=20
value=3D"Michael"/&gt;<BR> &gt;&gt;&gt;&gt;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
&lt;/xmi:XMI&gt;<BR> &gt;&gt;&gt;&gt;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp; Thank =
you=20
again.<BR>&gt;&gt;&gt;&gt;=20
Michael.<BR>&gt;&gt;&gt;&gt;<BR>&gt;&gt;&gt;&gt; <BR>&gt;&gt;&gt;&gt; =
module A2B;=20
-- Module Template<BR>&gt;&gt;&gt;&gt; create bperson : B from aperson : =

A;<BR>&gt;&gt;&gt;&gt;<BR>&gt;&gt;&gt;&gt; rule APerson2BPerson=20
{<BR> &gt;&gt;&gt;&gt;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
from<BR> &gt;&gt;&gt;&gt;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&=
nbsp;&nbsp;&nbsp;=20
ap:A!APerson<BR>&gt;&gt;&gt;&gt;<BR> &gt;&gt;&gt;&gt;&nbsp;&nbsp;&nbs p;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;=20
to<BR> &gt;&gt;&gt;&gt;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;=20
bp:B!BPerson(<BR>&gt;&gt;&gt;&gt;<BR> &gt;&gt;&gt;&gt;&nbsp;&nbsp;&nbs p;&n=
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n bsp;=20
)<BR> &gt;&gt;&gt;&gt;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;=20
do{<BR> &gt;&gt;&gt;&gt;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
bp.name=20
&lt;-=20
thisModule.NewName(ap.name);<BR> &gt;&gt;&gt;&gt;&nbsp;&nbsp;&nbs p;&nbsp;&=
nbsp;=20
}<BR>&gt;&gt;&gt;&gt;<BR>&gt;&gt;&gt;&gt;=20
}<BR>&gt;&gt;&gt;&gt;<BR>&gt;&gt;&gt;&gt;&nbsp; rule =
NewName(n:String){&nbsp; --=20
a called=20
rule<BR> &gt;&gt;&gt;&gt;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =

to<BR> &gt;&gt;&gt;&gt;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;=20
bn:B!BName(<BR> &gt;&gt;&gt;&gt;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;=20
value&lt;-n<BR> &gt;&gt;&gt;&gt;&nbsp;&nbsp;&nbs p;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
)<BR>&gt;&gt;&gt;&gt; }<BR>&gt;&gt;&gt; Mika=EBl Barbero=20
wrote:<BR>&gt;&gt;&gt;&gt; You should prefix the call by=20
"thisModule.":<BR>&gt;&gt;&gt;&gt;=20
thisModule.NewName(ap.name)<BR>&gt;&gt;&gt;&gt; <BR>&gt;&gt;&gt;&gt; Hope =
this=20
helps.<BR>&gt;&gt;&gt;&gt;<BR>&gt;&gt;&gt;&gt; =
Regards,<BR>&gt;&gt;&gt;&gt;=20
Mikael<BR>&gt;&gt;&gt;&gt;<BR>&gt;&gt;&gt;&gt; Michael=20
wrote:<BR>&gt;&gt;&gt;&gt;&gt;=20
Hi,<BR> &gt;&gt;&gt;&gt;&gt;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; here is the=20
excerpt:<BR>&gt;&gt;&gt;&gt;&gt;<BR>&gt;&gt;&gt;&gt;&gt;=20
------------------------------------------------<BR>&gt;&gt;&gt;&gt;&gt;&=
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;& nbsp;&nbsp;=20
module A2B; -- Module Template<BR>&gt;&gt;&gt;&gt;&gt; create bperson : =
B from=20
aperson : A;<BR>&gt;&gt;&gt;&gt;&gt;<BR>&gt;&gt;&gt;&gt;&gt; rule=20
APerson2BPerson {<BR>&gt;&gt;&gt;&gt;&gt;&nbsp;=20
from<BR> &gt;&gt;&gt;&gt;&gt;&nbsp;&nbsp; &nbsp;&nbsp;=20
ap:A!APerson<BR>&gt;&gt;&gt;&gt;&gt;&nbsp;=20
to<BR> &gt;&gt;&gt;&gt;&gt;&nbsp;&nbsp; &nbsp;&nbsp;=20
bp:B!BPerson(<BR>&gt;&gt;&gt;&gt;&gt;<BR > &gt;&gt;&gt;&gt;&gt;&nbsp;&nbsp; =
&nbsp;=20
)<BR> &gt;&gt;&gt;&gt;&gt;&nbsp;&nbsp; &nbsp;&nbsp;=20
do{<BR> &gt;&gt;&gt;&gt;&gt;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;=20
NewName(ap.name);&nbsp;&nbsp;&nbsp;&nbsp; -- call the=20
rule.<BR> &gt;&gt;&gt;&gt;&gt;&nbsp;&nbsp; &nbsp;&nbsp; =
}<BR>&gt;&gt;&gt;&gt;&gt;=20
}<BR>&gt;&gt;&gt;&gt;&gt;<BR>&gt;&gt;&gt;&gt;&gt; rule=20
NewName(name:String){&nbsp; -- a called =
rule<BR>&gt;&gt;&gt;&gt;&gt;&nbsp;=20
to<BR> &gt;&gt;&gt;&gt;&gt;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;=20
bn:B!BName(<BR> &gt;&gt;&gt;&gt;&gt;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;=20
value&lt;-name<BR> &gt;&gt;&gt;&gt;&gt;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;=20
)<BR>&gt;&gt;&gt;&gt;&gt; }<BR>&gt;&gt;&gt;&gt;&gt;=20
----------------------------------------------<BR>&gt;&gt;&gt;&gt;&gt;&nb=
sp;=20
Thanks.<BR>&gt;&gt;&gt;&gt;&gt;<BR>&gt;&gt;&gt;&gt;&gt;=20
Michael.<BR>&gt;&gt;&gt;&gt;&gt;<BR>&gt;&gt;&gt;&gt;&gt; <BR>&gt;&gt;&gt;&=
gt;&gt;<BR>&gt;&gt;&gt;&gt;&gt;<BR >&gt;&gt;&gt;&gt;&gt;<BR>&gt;&gt;&gt;&g=
t;&gt;<BR>&gt;&gt;&gt;&gt;&gt;<BR >&gt;&gt;&gt;&gt;&gt;<BR>&gt;&gt;&gt;&gt=
;&gt;=20
"Mika=EBl Barbero" &lt;</FONT><A =
href=3D"mailto:mikael.barbero@gmail.com"><FONT=20
face=3DArial size=3D2>mikael.barbero@gmail.com</FONT></A><FONT =
face=3DArial=20
size=3D2>&gt; wrote in message <BR>&gt;&gt;&gt;&gt;&gt; </FONT><A=20
href=3D"news:fm07je$aq4$1@build.eclipse.org"><FONT face=3DArial=20
size=3D2>news:fm07je$aq4$1@build.eclipse.org</FONT></A><FONT =
face=3DArial=20
size=3D2>...<BR>&gt;&gt;&gt;&gt;&gt;&gt;=20
Hi,<BR>&gt;&gt;&gt;&gt;&gt;&gt;<BR >&gt;&gt;&gt;&gt;&gt;&gt; Can you give =
us an=20
excerpt of your transformation? Especially your =
<BR>&gt;&gt;&gt;&gt;&gt;&gt;=20
called rule and where you tried to call it. Also, what kind of error do=20
<BR>&gt;&gt;&gt;&gt;&gt;&gt; you=20
have?<BR>&gt;&gt;&gt;&gt;&gt;&gt;<BR >&gt;&gt;&gt;&gt;&gt;&gt;=20
Regards,<BR>&gt;&gt;&gt;&gt;&gt;&gt;=20
Mikael<BR>&gt;&gt;&gt;&gt;&gt;&gt; <BR>&gt;&gt;&gt;&gt;&gt;&gt; Michael=20
wrote:<BR>&gt;&gt;&gt;&gt;&gt;&gt;&gt;=20
Hi,<BR> &gt;&gt;&gt;&gt;&gt;&gt;&gt;& ;nbsp;&nbsp;&nbsp;&nbsp; I tried to =
call a=20
called rule without entrypoint marked in the =
<BR>&gt;&gt;&gt;&gt;&gt;&gt;&gt;=20
imperative section, but error always occurred. Actually, I don't know=20
<BR>&gt;&gt;&gt;&gt;&gt;&gt;&gt; syntax about how to call a called rule. =
If you=20
have idea about that, <BR>&gt;&gt;&gt;&gt;&gt;&gt;&gt; please inform me. =

Strangely, in the ALT Manual, there is no such =
<BR>&gt;&gt;&gt;&gt;&gt;&gt;&gt;=20
syntax. I hope the author can add it later on.=20
Thanks.<BR>&gt;&gt;&gt;&gt;&gt;&gt;&gt;=20
Michael.<BR>&gt;&gt;&gt;&gt;&gt;&gt; <BR>&gt;&gt;&gt;&gt;&gt;&gt; --=20
<BR>&gt;&gt;&gt;&gt;&gt;&gt; Mika=EBl Barbero - PhD=20
Candidate<BR>&gt;&gt;&gt;&gt;&gt;&gt; ATLAS Group (INRIA &amp; LINA) -=20
University of Nantes<BR>&gt;&gt;&gt;&gt;&gt;&gt; 2, rue de la=20
Houssini=E8re<BR>&gt;&gt;&gt;&gt;&gt;&gt; 44322 Nantes Cedex 3 -=20
France<BR>&gt;&gt;&gt;&gt;&gt;&gt; tel. +33 2 51 12 58 08 /\ cell.+33 6 =
07 63 19=20
00<BR>&gt;&gt;&gt;&gt;&gt;&gt; email: </FONT><A=20
href=3D"mailto:Mikael.Barbero@{gmail.com"><FONT face=3DArial=20
size=3D2>Mikael.Barbero@{gmail.com</FONT></A><FONT face=3DArial =
size=3D2>,=20
univ-nantes.fr}<BR>&gt;&gt;&gt;&gt;&gt;&gt; </FONT><A=20
href=3D"http://www.sciences.univ-nantes.fr/lina/atl/"><FONT face=3DArial =

size=3D2>http://www.sciences.univ-nantes.fr/lina/atl/</FONT></A><BR><FONT=
=20
face=3DArial=20
size=3D2>&gt;&gt;&gt;&gt;&gt;<BR>&gt;&gt;&gt;&gt; <BR>&gt;&gt;&gt;&gt;<BR>=
&gt;&gt;&gt;<BR>&gt;&gt;&gt;<BR>&gt;&gt;&gt;=20
-- <BR>&gt;&gt;&gt; Mika=EBl Barbero - PhD Candidate<BR>&gt;&gt;&gt; =
ATLAS Group=20
(INRIA &amp; LINA) - University of Nantes<BR>&gt;&gt;&gt; 2, rue de la=20
Houssini=E8re<BR>&gt;&gt;&gt; 44322 Nantes Cedex 3 - =
France<BR>&gt;&gt;&gt; tel.=20
+33 2 51 12 58 08 /\ cell.+33 6 07 63 19 00<BR>&gt;&gt;&gt; email: =
</FONT><A=20
href=3D"mailto:Mikael.Barbero@{gmail.com"><FONT face=3DArial=20
size=3D2>Mikael.Barbero@{gmail.com</FONT></A><FONT face=3DArial =
size=3D2>,=20
univ-nantes.fr}<BR>&gt;&gt;&gt; </FONT><A=20
href=3D"http://www.sciences.univ-nantes.fr/lina/atl/"><FONT face=3DArial =

size=3D2>http://www.sciences.univ-nantes.fr/lina/atl/</FONT></A><FONT =
face=3DArial=20
size=3D2> <BR>&gt;&gt; <BR>&gt;&gt; <BR>&gt; <BR>&gt; <BR>&gt; <BR>&gt; =
--=20
<BR>&gt; Mika=EBl Barbero - PhD Candidate<BR>&gt; ATLAS Group (INRIA =
&amp; LINA) -=20
University of Nantes<BR>&gt; 2, rue de la Houssini=E8re<BR>&gt; 44322 =
Nantes Cedex=20
3 - France<BR>&gt; tel. +33 2 51 12 58 08 /\ cell.+33 6 07 63 19 =
00<BR>&gt;=20
email: </FONT><A href=3D"mailto:Mikael.Barbero@{gmail.com"><FONT =
face=3DArial=20
size=3D2>Mikael.Barbero@{gmail.com</FONT></A><FONT face=3DArial =
size=3D2>,=20
univ-nantes.fr}<BR>&gt; </FONT><A=20
href=3D"http://www.sciences.univ-nantes.fr/lina/atl/"><FONT face=3DArial =

size=3D2>http://www.sciences.univ-nantes.fr/lina/atl/</FONT></A></BODY></=
HTML>

------=_NextPart_000_0087_01C852B6.1226FE50--
Re: [ATL] How to call a called rule. [message #71047 is a reply to message #71025] Wed, 09 January 2008 12:21 Go to previous message
Eclipse UserFriend
Originally posted by: mikael.barbero.gmail.com

Hi,

The schemaLocation is an option to pass to the save() method of a
resource and ATL does not specify it by default. You should add it
manually as you do or modify some source code of ATL.
Another solution is to register your metamodel in the EMF registry.
There is an contextual action that is provided by the AM3 project
(http://www.eclipse.org/gmt/am3/). You can right click on a .ecore file
and select "Register metamodel". Then you will be able to use the ecore
reflective editor to edit your model. Don't forget to re-register your
metamodel each time you modify it.

Hope this helps.

Best regards,
Mikael

Michael wrote:
> Hi,
> The output is like:
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <xmi:XMI xmi:version="2.0"
> xmlns:xmi="http://www.omg.org/XMI"
> xmlns:TargetModel="http://www.macs.hw.ac.uk/my25">
> <TargetModel:BPerson name="/1"/>
> <TargetModel:BName value="Michael"/>
> </xmi:XMI>
> I cannot use Sample Reflective Ecore Model Editor to edit this
> model because error occurs, and have to use text editor to open it. If
> I mannually modify this output to the following. See the bold words,
> then I can use the Sample Reflective Ecore Model Editor to open it. I
> put the metamodels in a different folder, say metamodels.
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <xmi:XMI xmi:version="2.0"
> xmlns:xmi="http://www.omg.org/XMI"
> xmlns:TargetModel="http://www.macs.hw.ac.uk/my25" *xsi:schemaLocation="**http://www.macs.hw.ac.uk/my25**
> ../metamodels/B.ecore"* >
> <TargetModel:BPerson name="/1"/>
> <TargetModel:BName value="Michael"/>
> </xmi:XMI>
>
> Thanks.
>
>
> Michael.
>
>
>
> "Mikaël Barbero" <mikael.barbero@gmail.com
> <mailto:mikael.barbero@gmail.com>> wrote in message
> news:fm26bb$up2$1@build.eclipse.org...
> >I don't think I understand your problem very well. Do you mean that the
> > xmlns:TargetModel="http://www.macs.hw.ac.uk/my25" is not defined
> > automatically in the output of the transformation and that you have set
> > it by hand? Can you paste here what you have as an output and what you
> > expected? Thanks.
> >
> > Mikael
> >
> > Michael wrote:
> >> Thank you very much. The problem is gone. I got the following output.
> >> However, the generated file has specified the metamodel location.
> And each
> >> time I have to manually add the metamodel location. It is not
> convenient. Do
> >> you know how to automatically generate the metamodel location?
> >>
> >> <?xml version="1.0" encoding="ISO-8859-1"?>
> >> <xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI"
> >> xmlns:TargetModel="http://www.macs.hw.ac.uk/my25">
> >> <TargetModel:BPerson name="/1"/>
> >> <TargetModel:BName value="Michael"/>
> >> </xmi:XMI>
> >> Thanks.
> >> Best regards.
> >> Michael.
> >>
> >> "Mikaël Barbero" <mikael.barbero@gmail.com
> <mailto:mikael.barbero@gmail.com>> wrote in message
> >> news:fm0cb7$19t$1@build.eclipse.org...
> >>> You should better call the called rule in the "to" part of your
> >>> APerson2BPerson rule:
> >>>
> >>> rule APerson2BPerson {
> >>> from
> >>> ap:A!APerson
> >>> to
> >>> bp:B!BPerson(
> >>> name <- thisModule.NewName(ap.name)
> >>> )
> >>> }
> >>>
> >>> but then you should better do this (and do not use called rules):
> >>>
> >>> rule APerson2BPerson {
> >>> from
> >>> ap:A!APerson
> >>> to
> >>> bp:B!BPerson(
> >>> name <- bpname
> >>> ),
> >>> bpname : B!BName (
> >>> name <- ap.name
> >>> )
> >>> }
> >>>
> >>> Regards,
> >>> Mikael
> >>>
> >>> On Jan 8, 2008 5:59 PM, Yang, Mikai <my25@hw.ac.uk
> <mailto:my25@hw.ac.uk>> wrote:
> >>>> Hi,
> >>>> Thanks for your help. I have solved the problem .Now the
> >>> following rules work, however, I come up with another problems. In
> the
> >>> imperative section, I call the called rules to assign the newly
> generated
> >>> 'Name' to reference of source element. And I looked into the generated
> >>> .xmi file. The name is successfully generated, but, there is no
> >>> relationship between the two generated model element. I don't know
> why. Do
> >>> you have any idea about this?
> >>>> Bye the way, the source metamodel is simple: APerson with an
> >>> attribute 'name' . The target metamodel is also simple, BPerson with a
> >>> one-way reference to Bname, which has an attribute 'value' .
> >>>> The generated .xmi file is as follows:
> >>>> <?xml version="1.0" encoding="ISO-8859-1"?>
> >>>> <xmi:XMI xmi:version="2.0"
> >>> xmlns:xmi="http://www.omg.org/XMI"
> >>> xmlns:TargetModel="http://www.macs.hw.ac.uk/my25">
> >>>> <TargetModel:BPerson/>
> >>>> <TargetModel:BName value="Michael"/>
> >>>> </xmi:XMI>
> >>>> Thank you again.
> >>>> Michael.
> >>>>
> >>>>
> >>>> module A2B; -- Module Template
> >>>> create bperson : B from aperson : A;
> >>>>
> >>>> rule APerson2BPerson {
> >>>> from
> >>>> ap:A!APerson
> >>>>
> >>>> to
> >>>> bp:B!BPerson(
> >>>>
> >>>> )
> >>>> do{
> >>>> bp.name <- thisModule.NewName(ap.name);
> >>>> }
> >>>>
> >>>> }
> >>>>
> >>>> rule NewName(n:String){ -- a called rule
> >>>> to
> >>>> bn:B!BName(
> >>>> value<-n
> >>>> )
> >>>> }
> >>> Mikaël Barbero wrote:
> >>>> You should prefix the call by "thisModule.":
> >>>> thisModule.NewName(ap.name)
> >>>>
> >>>> Hope this helps.
> >>>>
> >>>> Regards,
> >>>> Mikael
> >>>>
> >>>> Michael wrote:
> >>>>> Hi,
> >>>>> here is the excerpt:
> >>>>>
> >>>>> ------------------------------------------------
> >>>>> module A2B; -- Module Template
> >>>>> create bperson : B from aperson : A;
> >>>>>
> >>>>> rule APerson2BPerson {
> >>>>> from
> >>>>> ap:A!APerson
> >>>>> to
> >>>>> bp:B!BPerson(
> >>>>>
> >>>>> )
> >>>>> do{
> >>>>> NewName(ap.name); -- call the rule.
> >>>>> }
> >>>>> }
> >>>>>
> >>>>> rule NewName(name:String){ -- a called rule
> >>>>> to
> >>>>> bn:B!BName(
> >>>>> value<-name
> >>>>> )
> >>>>> }
> >>>>> ----------------------------------------------
> >>>>> Thanks.
> >>>>>
> >>>>> Michael.
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>>
> >>>>> "Mikaël Barbero" <mikael.barbero@gmail.com
> <mailto:mikael.barbero@gmail.com>> wrote in message
> >>>>> news:fm07je$aq4$1@build.eclipse.org...
> >>>>>> Hi,
> >>>>>>
> >>>>>> Can you give us an excerpt of your transformation? Especially your
> >>>>>> called rule and where you tried to call it. Also, what kind of
> error do
> >>>>>> you have?
> >>>>>>
> >>>>>> Regards,
> >>>>>> Mikael
> >>>>>>
> >>>>>> Michael wrote:
> >>>>>>> Hi,
> >>>>>>> I tried to call a called rule without entrypoint marked in the
> >>>>>>> imperative section, but error always occurred. Actually, I
> don't know
> >>>>>>> syntax about how to call a called rule. If you have idea about
> that,
> >>>>>>> please inform me. Strangely, in the ALT Manual, there is no such
> >>>>>>> syntax. I hope the author can add it later on. Thanks.
> >>>>>>> Michael.
> >>>>>>
> >>>>>> --
> >>>>>> Mikaël Barbero - PhD Candidate
> >>>>>> ATLAS Group (INRIA & LINA) - University of Nantes
> >>>>>> 2, rue de la Houssinière
> >>>>>> 44322 Nantes Cedex 3 - France
> >>>>>> tel. +33 2 51 12 58 08 /\ cell.+33 6 07 63 19 00
> >>>>>> email: Mikael.Barbero@{gmail.com
> <mailto:Mikael.Barbero@{gmail.com>, univ-nantes.fr}
> >>>>>> http://www.sciences.univ-nantes.fr/lina/atl/
> >>>>>
> >>>>
> >>>>
> >>>
> >>>
> >>> --
> >>> Mikaël Barbero - PhD Candidate
> >>> ATLAS Group (INRIA & LINA) - University of Nantes
> >>> 2, rue de la Houssinière
> >>> 44322 Nantes Cedex 3 - France
> >>> tel. +33 2 51 12 58 08 /\ cell.+33 6 07 63 19 00
> >>> email: Mikael.Barbero@{gmail.com
> <mailto:Mikael.Barbero@{gmail.com>, univ-nantes.fr}
> >>> http://www.sciences.univ-nantes.fr/lina/atl/
> >>
> >>
> >
> >
> >
> > --
> > Mikaël Barbero - PhD Candidate
> > ATLAS Group (INRIA & LINA) - University of Nantes
> > 2, rue de la Houssinière
> > 44322 Nantes Cedex 3 - France
> > tel. +33 2 51 12 58 08 /\ cell.+33 6 07 63 19 00
> > email: Mikael.Barbero@{gmail.com <mailto:Mikael.Barbero@{gmail.com>,
> univ-nantes.fr}
> > http://www.sciences.univ-nantes.fr/lina/atl/



--
Mikaël Barbero - PhD Candidate
ATLAS Group (INRIA & LINA) - University of Nantes
2, rue de la Houssinière
44322 Nantes Cedex 3 - France
tel. +33 2 51 12 58 08 /\ cell.+33 6 07 63 19 00
email: Mikael.Barbero@{gmail.com, univ-nantes.fr}
http://www.sciences.univ-nantes.fr/lina/atl/
Previous Topic:[ATL] Renaming an ASMModel instance from java
Next Topic:[ATL] atl launcher via command line
Goto Forum:
  


Current Time: Tue Apr 23 09:26:57 GMT 2024

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

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

Back to the top