does lazy rules from clause works? [message #987893] |
Wed, 28 November 2012 10:01  |
Eclipse User |
|
|
|
Hello to everyone,
I have a question about lazy rules, because the manual is quite synthetic about them.
I would like to know when the from clause is evaluated.
i.e. I make a call to a lazy rule in a matched rule in this way:
rule main {
from
m: UML!Model,
s: UML!Class ( m.name = 'model')
to
container1 : UML!Model
(
name<- 'graphModel',
packagedElement <- thisModule.host(s)
)
}
lazy rule host {
from
source : UML!Class (source.hasStereotype('lanprofile::Router'))
to
target : UML!Class
(
name <- 'nodo_router'
)
}
why the from clause in the lazy is not evaluated? (it was created target UML!Classes also for that source Classes that don't respect the condition in the round brackets) And, if this behaviour is correct, in which case the from clause make sense for lazy rules?
Thanks in advance,
Alessandro
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: does lazy rules from clause works? [message #988754 is a reply to message #988129] |
Sun, 02 December 2012 14:05  |
Eclipse User |
|
|
|
Op 28-11-12 18:03, Hugo Bruneliere schreef:
> Hello,
>
> The initial philosophy of lazy rules is to be able to specify explicitly on
> which elements you call them.
> Thus a lazy rule should not have a guard and the filtering should be made on
> the call, e.g.:
>
> packagedElement <- if s.hasStereotype('lanprofile::Router') then
> thisModule.host(s)
> else
> OclUndefined -- or somethin else...
> endif
>
> Hugo
The new EMFTVM research VM *does* evaluate guards on lazy rules, as well as
the input element types. EMFTVM also allows rule inheritance on lazy rules. In
EMFTVM, a lazy rule that does not match will return OclUndefined.
This opens the door for experimentation with virtual rule invocation, where
matching sub-rules of a lazy rule are automatically invoked. Note that this is
currently *not* (yet) implemented in EMFTVM, and invocation of a lazy rule
just invokes that rule and its super-rules.
Regards,
Dennis
|
|
|