Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » QVTO iteration() operation, acc returns nothing
QVTO iteration() operation, acc returns nothing [message #690952] Thu, 30 June 2011 13:09 Go to next message
Tom2000  is currently offline Tom2000 Friend
Messages: 6
Registered: May 2011
Junior Member
Hi,

in the specification 2.0 i red that acc is the accumulation object and returns the things you want, so i tried one example but nothing happened. The aim is to iterate over two lists and save duplicat values in a third list.
var str : List(String) := List{"A","B","C"};
var st : List(String) := List{"A","B","D"};
var temp : Sequence(String) := Sequence{};

		str -> forEach(i){
		   temp = st -> iterate(it : String;
				acc : Sequence(String) = Sequence{"Z"} | 
				if(i.equalsIgnoreCase(it))then {
					acc += it; //acc gives nothing back
					acc  -> including(it); // its empty
					//temp += it; //only direkt access works
				}endif	);				
                };

Additional Question: could i use QVT List type in javaBlackboxLibrary directly or only OCL Types?

Thank you.
Re: QVTO iteration() operation, acc returns nothing [message #690962 is a reply to message #690952] Thu, 30 June 2011 13:21 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Your example is a very uncomfortable mix of OCL and QVT. I would be
surprised if it is valid. I recommend pure OCL for OCL constructs e.g.

.... iterate(it : String; acc : Sequence(String) = Sequence{"Z"} | if
i.equalsIgnoreCase(it)) then acc->including(it) else acc endif) ...

Regards

Ed Willink

>
> in the specification 2.0 i red that acc is the accumulation object and
> returns the things you want, so i tried one example but nothing
> happened. The aim is to iterate over two lists and save duplicat
> values in a third list.
>
> var str : List(String) := List{"A","B","C"};
> var st : List(String) := List{"A","B","D"};
> var temp : Sequence(String) := Sequence{};
>
> str -> forEach(i){
> temp = st -> iterate(it : String;
> acc : Sequence(String) = Sequence{"Z"} |
> if(i.equalsIgnoreCase(it))then {
> acc += it; //acc gives nothing back
> acc -> including(it); // its empty
> //temp += it; //only direkt access works
> }endif );
> };
>
> Additional Question: could i use QVT List type in javaBlackboxLibrary
> directly or only OCL Types?
>
> Thank you.
Previous Topic:[QVTO] Black-box problem with XML
Next Topic:After i Inject the XML using the AM3, the created model or XMI does not conform the XMI model
Goto Forum:
  


Current Time: Thu Apr 25 19:24:11 GMT 2024

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

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

Back to the top