[ATL] adding an element in a Set [message #33453] |
Mon, 23 April 2007 14:48 |
Eclipse User |
|
|
|
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 |
Eclipse User |
|
|
|
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 #33589 is a reply to message #33487] |
Mon, 23 April 2007 15:45 |
Eclipse User |
|
|
|
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
|
|
|
|
Powered by
FUDForum. Page generated in 0.02285 seconds