Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 314443 - Provide support for 'object' imperative collect expression shorthand
Summary: Provide support for 'object' imperative collect expression shorthand
Status: RESOLVED FIXED
Alias: None
Product: QVTo
Classification: Modeling
Component: Engine (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4.0   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-26 07:57 EDT by Siegfried Nolte CLA
Modified: 2014-05-23 02:18 EDT (History)
1 user (show)

See Also:


Attachments
The change is made to QVTOParser.gi (2.40 KB, patch)
2013-07-23 15:38 EDT, Alex Paperno CLA
serg.boyko2011: iplog+
Details | Diff
A unit test for the patch (4.19 KB, application/octet-stream)
2013-07-23 15:38 EDT, Alex Paperno CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Siegfried Nolte CLA 2010-05-26 07:57:26 EDT
Build Identifier: 20090619-0625


mapping Class::transformClasses( ) : Class
{ 	
   name := self.name; 

-- this inline mapping does not work (taken from the spec, p51 below), 
-- it delivers nothing
   ownedAttribute := self.ownedAttribute->object (p) Property 
   {
      name := p.name;
   };

-- this OCL solution does 
   ownedAttribute := self.ownedAttribute->collect( p | object Property 
   {
      name := p.name;
   } ); 
}

The metamodel is UML, the model is a simple Class diagram. 

Reproducible: Always
Comment 1 Sergey Boyko CLA 2010-05-26 18:05:36 EDT
(In reply to comment #0)
Hi Siegfried,

> 
> mapping Class::transformClasses( ) : Class
> {     
>    name := self.name; 
> 
> -- this inline mapping does not work (taken from the spec, p51 below), 
> -- it delivers nothing
>    ownedAttribute := self.ownedAttribute->object (p) Property 
>    {
>       name := p.name;
>    };

According to QVT Specification, Section "8.2.1.24 ObjectExp" (page 87) such notation is just shorthand for xcollect() call:

When an object expression is the body of an imperative collect expression (see xcollect in ImperativeLoopExp),
the reference to the collect construct may be skipped and the arrow symbol applies on the object keyword.

list->object(x) X{… } // shorthand for list->xcollect(x) object X{ … }

And this shorthand is not yet supported by QVTo. That is why you'll get 'token "object" is invalid' syntax error for the mentioned inline mapping call.

> 
> -- this OCL solution does 
>    ownedAttribute := self.ownedAttribute->collect( p | object Property 
>    {
>       name := p.name;
>    } ); 
> }
> 
> The metamodel is UML, the model is a simple Class diagram. 
> 
> Reproducible: Always
Comment 2 Sergey Boyko CLA 2010-05-26 18:07:17 EDT
I would rather rename this CR to something like "Provide support for 'object' imperative collect expression shorthand".
Comment 3 Alex Paperno CLA 2013-07-23 15:38:20 EDT
Created attachment 233729 [details]
The change is made to QVTOParser.gi
Comment 4 Alex Paperno CLA 2013-07-23 15:38:36 EDT
Created attachment 233730 [details]
A unit test for the patch
Comment 5 Sergey Boyko CLA 2013-07-23 18:16:21 EDT
Comment on attachment 233729 [details]
The change is made to QVTOParser.gi

Good extension to QVTo parse. Junit test covers all proposed changes to grammar.
Comment 6 Sergey Boyko CLA 2013-07-23 18:16:59 EDT
Pushed to master.

Commit ID: 602d96ac0533d7fc86b6904bc797afcbf82f6790