Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
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 Go to next message
Marten Sijtema is currently offline Marten SijtemaFriend
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 #533798 is a reply to message #533506] Mon, 17 May 2010 07:23 Go to previous messageGo to next message
Vincent MAHE is currently offline Vincent MAHEFriend
Messages: 129
Registered: July 2009
Senior Member
Le 14/05/2010 12:24, Marten Sijtema a écrit :
> 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?

try OclUndefined. It is the equivalent of null in OCL
--
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] set something to null (or equivalent) [message #533805 is a reply to message #533798] Mon, 17 May 2010 07:45 Go to previous messageGo to next message
Marten Sijtema is currently offline Marten SijtemaFriend
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 #533845 is a reply to message #533506] Mon, 17 May 2010 09:32 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
Do you have superRule <- s.superRule in Rule2Rule ?
Re: [ATL] set something to null (or equivalent) [message #533849 is a reply to message #533845] Mon, 17 May 2010 09:38 Go to previous messageGo to next message
Marten Sijtema is currently offline Marten SijtemaFriend
Messages: 67
Registered: November 2009
Member
no, I checked the super rules for these things. Is it a bug? nowhere else in the code the s.superRule is bound.

My company: Sytematic, building business software from models.
Re: [ATL] set something to null (or equivalent) [message #533853 is a reply to message #533506] Mon, 17 May 2010 09:51 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
You're not in refining right ?
Re: [ATL] set something to null (or equivalent) [message #533867 is a reply to message #533853] Mon, 17 May 2010 10:37 Go to previous messageGo to next message
Marten Sijtema is currently offline Marten SijtemaFriend
Messages: 67
Registered: November 2009
Member
No. I even thought about that. Sorry for not mentioning.

Thus:
- Not refining
- Nowhere in inheritance stack there is a similar binding
- But it is initialized prematurely.

Still missing something?


My company: Sytematic, building business software from models.
Re: [ATL] set something to null (or equivalent) [message #533879 is a reply to message #533805] Mon, 17 May 2010 11:15 Go to previous messageGo to next message
Vincent MAHE is currently offline Vincent MAHEFriend
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] set something to null (or equivalent) [message #533880 is a reply to message #533879] Mon, 17 May 2010 11:27 Go to previous messageGo to next message
Marten Sijtema is currently offline Marten SijtemaFriend
Messages: 67
Registered: November 2009
Member
I tried it in both ways, ie. superrule with if-then-else statement as described above, and the normal way by overriding in the subrule, but it doesn't work.



My company: Sytematic, building business software from models.
Re: [ATL][SOLVED] set something to null (or equivalent) [message #533939 is a reply to message #533506] Mon, 17 May 2010 14:17 Go to previous message
Marten Sijtema is currently offline Marten SijtemaFriend
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.
Previous Topic: iterate
Next Topic:error message
Goto Forum:
  


Current Time: Thu Mar 28 17:58:39 GMT 2024

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

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

Back to the top