Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] adding an element in a Set
[ATL] adding an element in a Set [message #33453] Mon, 23 April 2007 14:48 Go to next message
Eclipse UserFriend
Originally posted by: tristan.faure.c-s.fr

I've just already the called rule concepts and i have a problem

i manage a state machine and i want to create one state in an empty
collection.

I have this matching rule who works

rule Operation2Process {
from
o : UML!Operation
to
p : _IF!Process (
id <- o.name,
nbInstancesToStart <- '0'

and in my _IF!Process i have 0..* states but these states cannot be
generated with a matching rule so I tried to create a called rule newState
and i wanted to call it :

rule Operation2Process {
from
o : UML!Operation
to
p : _IF!Process (
id <- o.name,
nbInstancesToStart <- '0',
states <- thisModule.newState('test')
-- TODO Parameters
)
}
rule newState(sid : String) {
to
s : _IF!State (
id <- sid
)
}

but this don't work >_< and i have an ununderstable message error
message: ERROR: could not find operation including on Module having
supertypes: [OclAny]

someone could help me ???
Re: [ATL] adding an element in a Set [message #33487 is a reply to message #33453] Mon, 23 April 2007 15:19 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mikael.barbero.gmail.com

Hi Tristan,

Your are trying to set your states property which is multi-valued to a
single element. The binding (<-) on a multi-valued property can be see
like this:
if you have a <- SOMETHING, you can see it like a.including(SOMETHING)
(this is the reason why you got your error messages).

Try to do this :
states <- Sequence{thisModule.newState('test')}

But, as far as I can see your issues, you may used lazy rules instead of
called rules. Lazy rules are better than called one because they are
fully declarative. You can call it the same way as called rules.

Regards,
Mikael


Tristan FAURE wrote:
> I've just already the called rule concepts and i have a problem
>
> i manage a state machine and i want to create one state in an empty
> collection.
>
> I have this matching rule who works
>
> rule Operation2Process {
> from
> o : UML!Operation
> to
> p : _IF!Process (
> id <- o.name,
> nbInstancesToStart <- '0'
>
> and in my _IF!Process i have 0..* states but these states cannot be
> generated with a matching rule so I tried to create a called rule
> newState and i wanted to call it :
>
> rule Operation2Process {
> from
> o : UML!Operation
> to
> p : _IF!Process (
> id <- o.name,
> nbInstancesToStart <- '0',
> states <- thisModule.newState('test')
> -- TODO Parameters
> )
> }
> rule newState(sid : String) {
> to s : _IF!State (
> id <- sid
> )
> }
>
> but this don't work >_< and i have an ununderstable message error
> message: ERROR: could not find operation including on Module having
> supertypes: [OclAny]
>
> someone could help me ???
>
>
>
>
>



--
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] adding an element in a Set [message #33521 is a reply to message #33487] Mon, 23 April 2007 15:26 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: tristan.faure.c-s.fr

thank you for your answer i have tried using "Sequence" but I have the
same error

and what is lazy rules :o ????
Re: [ATL] adding an element in a Set [message #33555 is a reply to message #33521] Mon, 23 April 2007 15:44 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: mikael.barbero.gmail.com

Try to add a do section (for more information about this and lazy rules,
I suggest you read the wiki:
http://wiki.eclipse.org/index.php/ATL_Language_Troubleshoote r) like this:

rule newState(sid : String) {
to s : _IF!State (
id <- sid
)
do {
s;
}
}

Tristan FAURE wrote:
> thank you for your answer i have tried using "Sequence" but I have the
> same error
>
> and what is lazy rules :o ????
>



--
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] adding an element in a Set [message #33589 is a reply to message #33487] Mon, 23 April 2007 15:45 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: eric.vepa.gmail.com

Hi Tristan,

I thinks, you may add a "do" clause, to your called rule, which returns
the produced target model element :


rule newState(sid : String) {
to s : _IF!State (
id <- sid
)
do {
s;
}
}

Mikaël Barbero a écrit :
> Hi Tristan,
>
> Your are trying to set your states property which is multi-valued to a
> single element. The binding (<-) on a multi-valued property can be see
> like this:
> if you have a <- SOMETHING, you can see it like a.including(SOMETHING)
> (this is the reason why you got your error messages).
>
> Try to do this :
> states <- Sequence{thisModule.newState('test')}
>
> But, as far as I can see your issues, you may used lazy rules instead of
> called rules. Lazy rules are better than called one because they are
> fully declarative. You can call it the same way as called rules.
>
> Regards,
> Mikael
>
>
> Tristan FAURE wrote:
>> I've just already the called rule concepts and i have a problem
>>
>> i manage a state machine and i want to create one state in an empty
>> collection.
>>
>> I have this matching rule who works
>>
>> rule Operation2Process {
>> from
>> o : UML!Operation
>> to
>> p : _IF!Process (
>> id <- o.name,
>> nbInstancesToStart <- '0'
>>
>> and in my _IF!Process i have 0..* states but these states cannot be
>> generated with a matching rule so I tried to create a called rule
>> newState and i wanted to call it :
>>
>> rule Operation2Process {
>> from
>> o : UML!Operation
>> to
>> p : _IF!Process (
>> id <- o.name,
>> nbInstancesToStart <- '0',
>> states <- thisModule.newState('test')
>> -- TODO Parameters
>> )
>> }
>> rule newState(sid : String) {
>> to s : _IF!State (
>> id <- sid
>> )
>> }
>>
>> but this don't work >_< and i have an ununderstable message error
>> message: ERROR: could not find operation including on Module having
>> supertypes: [OclAny]
>>
>> someone could help me ???
>>
>>
>>
>>
>>
>
>
>


Éric Vépa
Re: [ATL] adding an element in a Set [message #33623 is a reply to message #33589] Tue, 24 April 2007 07:11 Go to previous message
Eclipse UserFriend
Originally posted by: tristan.faure.c-s.fr

Thank you so much !!!! IT WORKS !!!!
Previous Topic:New ATL use case: A Metamodel Independent Approach to Difference Representation
Next Topic:[ATL] problem with example in February 17th 2007 version of ATL
Goto Forum:
  


Current Time: Thu Apr 25 09:07:05 GMT 2024

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

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

Back to the top