Home » Archived » M2M (model-to-model transformation) » [ATL] set something to null (or equivalent)
() 1 Vote
[ATL] set something to null (or equivalent) [message #533506] |
Fri, 14 May 2010 10:24 |
Marten Sijtema Messages: 67 Registered: November 2009 |
Member |
|
|
Hello,
I want to do something like this:
to
a: outMM!A (
feature <- null
)
This is needed since I want to override the super rule's binding. So omitting the 'feature <- null' binding won't do the job.
Any ideas?
My company: Sytematic, building business software from models.
|
|
| |
Re: [ATL] set something to null (or equivalent) [message #533805 is a reply to message #533798] |
Mon, 17 May 2010 07:45 |
Marten Sijtema Messages: 67 Registered: November 2009 |
Member |
|
|
Thanks for the reply!
I got your hint from a colleague this morning, and tried it without success. So I tried something different. The strange thing is this.
Consider my situation (i'm building a higher order transformation of myExtendedATL-2-ATL):
rule MatchedRule2MatchedRule extends Rule2Rule {
from
s : fatl!MatchedRule
to
t : atl!MatchedRule (
inPattern <- s.inPattern,
children <- s.children, -- *** breakpoint here
superRule <- if s.oclIsTypeOf(fatl!DependentVariabilityRule) then
OclUndefined
else
s.superRule
endif,
isAbstract <- s.isAbstract,
isRefining <- s.isRefining,
isNoDefault <- s.isNoDefault
)
}
--this rule extends the one above
rule DependentVariabilityRule2LazyRule extends MatchedRule2MatchedRule {
from
s : fatl!DependentVariabilityRule
to
t : atl!LazyMatchedRule (
isUnique <- false,
inPattern <- s.inPattern,
isAbstract <- false,
isRefining <- false,
isNoDefault <- s.isNoDefault,
outPattern <- thisModule.getOutPattern(s),
name <- s.variantName
)
}
If i put a breakpoint in the line before the superRule binding, I would expect that the t.superRule is undefined at that point, correct?
Well, it isn't, it is initialized with s.superRule (even before the if-then-else statement)! Why is this the case? The sub rule does not bind it, so I don't see why it is initialized like this. After that, the if-statement is correct according to the debugger, but it does not unset the value.
Is this a bug or a feature from ATL? And is there a work-around? Appearantly, things get initialized without me wanting it to...
(the work-around would be 'unsetting' a binding, is there a way to unset a binding?)
My company: Sytematic, building business software from models.
[Updated on: Mon, 17 May 2010 07:59] Report message to a moderator
|
|
| | | | |
Re: [ATL] set something to null (or equivalent) [message #533879 is a reply to message #533805] |
Mon, 17 May 2010 11:15 |
Vincent MAHE Messages: 129 Registered: July 2009 |
Senior Member |
|
|
Le 17/05/2010 09:45, Marten Sijtema a écrit :
> Thanks for the reply!
>
> I got your hint from a colleague this morning, and tried it without
> success. So I tried something different. The strange thing is this.
>
> Consider my situation (i'm building a higher order transformation of
> myExtendedATL-2-ATL):
>
> rule MatchedRule2MatchedRule extends Rule2Rule {
> from
> s : fatl!MatchedRule
> to
> t : atl!MatchedRule (
> inPattern <- s.inPattern, children <- s.children, -- *** breakpoint here
> superRule <- if s.oclIsTypeOf(fatl!DependentVariabilityRule) then
> OclUndefined
> else
> s.superRule
> endif,
> isAbstract <- s.isAbstract,
> isRefining <- s.isRefining,
> isNoDefault <- s.isNoDefault
> )
> }
>
> --this rule extends the one above
> rule DependentVariabilityRule2LazyRule extends MatchedRule2MatchedRule {
> from
> s : fatl!DependentVariabilityRule to
> t : atl!LazyMatchedRule (
> isUnique <- false,
> inPattern <- s.inPattern,
> isAbstract <- false,
> isRefining <- false,
> isNoDefault <- s.isNoDefault,
> outPattern <- thisModule.getOutPattern(s), name <- s.variantName
> )
>
> }
>
>
> If i put a breakpoint in the line before the superRule binding, I would
> expect that the t.superRule is undefined at that point, correct?
>
> Well, it isn't, it is initialized with s.superRule (even before the
> if-then-else statement)! Why is this the case? The sub rule does not
> bind it, so I don't see why it is initialized like this. After that, the
> if-statement is correct according to the debugger, but it does not unset
> the value.
>
> Is this a bug or a feature from ATL? And is there a work-around?
> Appearantly, things get initialized without me wanting it to...
>
>
You may try an helper returning OclUndefined (in place of direct
OclUndefined)....
--
Cordialement
Vincent MAHÉ
Ingénieur Expert - Projet IDM++ - Équipe AtlanMod
École des Mines de Nantes
La Chantrerie - 4, rue Alfred Kastler
B.P. 20722 - F-44307 NANTES Cedex 3
Tel: (33)2 51 85 81 00
|
|
| |
Re: [ATL][SOLVED] set something to null (or equivalent) [message #533939 is a reply to message #533506] |
Mon, 17 May 2010 14:17 |
Marten Sijtema Messages: 67 Registered: November 2009 |
Member |
|
|
SOLVED!
Now I get what was going on.
A MatchedRule element has a property children. This is the EOpposite of a superRule property. If one of them is omitted, but the EOpposite version is still there, the link will still be made. Therefore, I had to outcomment 'children' attribute, like shown below. Sounds logical, but it costed me a few hours to find out.
rule MatchedRule2MatchedRule extends Rule2Rule {
from
s : fatl!MatchedRule
to
t : atl!MatchedRule (
inPattern <- s.inPattern,
--children <- s.children,
superRule <- s.superRule,
isAbstract <- s.isAbstract,
isRefining <- s.isRefining,
isNoDefault <- s.isNoDefault
)
}
There is a fair chance this introduced some other errors, but with a helper i could create some guards to fix this.
Thanks for all the quick replies today. Hopefully this could be some help for other people.
My company: Sytematic, building business software from models.
|
|
|
Goto Forum:
Current Time: Thu Mar 28 17:58:39 GMT 2024
Powered by FUDForum. Page generated in 0.04553 seconds
|