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 09:09 Go to next message
Tom2000  is currently offline Tom2000
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 09:21 Go to previous message
Ed Willink is currently offline Ed Willink
Messages: 4032
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: Wed Aug 27 09:17:51 EDT 2014

Powered by FUDForum. Page generated in 0.02630 seconds