Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [QVTO] Question about intermediate properties
[QVTO] Question about intermediate properties [message #482107] Tue, 25 August 2009 12:08 Go to next message
Toñi  Reina is currently offline Toñi ReinaFriend
Messages: 209
Registered: July 2009
Senior Member
Hello everybody,

Although I have said in the subject the question is about intermediate
properties, I'm not sure if it has to do with them or with OrderedSet
assignments.

I have defined a intermediate property called nodesMainNav. This
property is an Ordered Set of Nodes.

In the transformation entry point I'm trying to fill in the
Ordered Set. For that, I executed a query named getMainNavigationArea,
that returns an Area, and as an Area is composed of a set of Nodes, I
use the relation nodes to extract all the nodes of the area. As it can
be seen in the piece of code I show below.


intermediate property siteMap::nodesMainNav : OrderedSet(siteMap::Node);


main() {

inModel.nodesMainNav := getMainNavigationArea().nodes;
log('1..Num nodos',inModel.nodesMainNav->size());
inModel.rootObjects()[siteMap::Sitemap]->map toWebSite();

}

My problem is that the log sentence that appears as '1..Num nodos' shows
the number of nodes in the OrderedSet is 0. However, I have written a
similar log sentence inside the getMainNavigationArea query, and the
result is that there are 8 nodes in the Area.

My question is: why does the OrderedSet seem to be without any nodes
outside the query? Is this related to the intermediate property or is
something related to the assignment?

Best regards,
Toñi
Re: [QVTO] Question about intermediate properties [message #482153 is a reply to message #482107] Tue, 25 August 2009 14:18 Go to previous messageGo to next message
Sergey Boyko is currently offline Sergey BoykoFriend
Messages: 171
Registered: July 2009
Senior Member
Hi Toñi ,

Some replies are in-lined, below

Regards,
Sergey

Toñi Reina Quintero wrote:
> Hello everybody,
>
> Although I have said in the subject the question is about
> intermediate properties, I'm not sure if it has to do with them or with
> OrderedSet assignments.
>
> I have defined a intermediate property called nodesMainNav. This
> property is an Ordered Set of Nodes.
>
> In the transformation entry point I'm trying to fill in the
> Ordered Set. For that, I executed a query named getMainNavigationArea,
> that returns an Area, and as an Area is composed of a set of Nodes, I
> use the relation nodes to extract all the nodes of the area. As it can
> be seen in the piece of code I show below.
>
>
> intermediate property siteMap::nodesMainNav : OrderedSet(siteMap::Node);
>
>
> main() {
>
> inModel.nodesMainNav := getMainNavigationArea().nodes;
> log('1..Num nodos',inModel.nodesMainNav->size());
> inModel.rootObjects()[siteMap::Sitemap]->map toWebSite();
>
> }

As far as I understand you've defined property 'nodesMainNav' on
modeltype 'siteMap'.
I presume that transformation your signature looks like:
transformation NewTransformation(in inModel : siteMap);

Actually it's not legal to define intermediate property on modeltypes.
Current qvto version (2.0.0) prohibits that.
In case you need global property you might define it like follows:
property nodesMainNav : OrderedSet(EClass) = OrderedSet{};

In case that doesn't help we'll go farther with the example code.
However I don't see any issues with assignment itself.

As I answered your posts in amalgam newsgroup I saw that you use old
1.0.1 version. I suggest you to start using 2.0.0 release.

>
> My problem is that the log sentence that appears as '1..Num nodos' shows
> the number of nodes in the OrderedSet is 0. However, I have written a
> similar log sentence inside the getMainNavigationArea query, and the
> result is that there are 8 nodes in the Area.
>
> My question is: why does the OrderedSet seem to be without any nodes
> outside the query? Is this related to the intermediate property or is
> something related to the assignment?
>
> Best regards,
> Toñi
Re: [QVTO] Question about intermediate properties [message #482175 is a reply to message #482153] Tue, 25 August 2009 15:06 Go to previous messageGo to next message
Sergey Boyko is currently offline Sergey BoykoFriend
Messages: 171
Registered: July 2009
Senior Member
Hi Toñi ,

I was wrong in telling that it's illegal to define intermediate property
on modeltypes. I've mixed it with transformation parameter.

I checked similar sample (with 2.0.0 qvto version) and it works:

modeltype ecore uses "http://www.eclipse.org/emf/2002/Ecore";
transformation NewTransformation(in inModel : ecore);
intermediate property ecore::nodesMainNav : OrderedSet(EClassifier);

main() {
inModel.nodesMainNav := getMainNavigationArea().eClassifiers;
log('1..Num nodos', inModel.nodesMainNav->size());
}
query getMainNavigationArea() : EPackage {
return inModel.rootObjects()![EPackage];
}



Sergey Boyko wrote:
> Hi Toñi ,
>
> Some replies are in-lined, below
>
> Regards,
> Sergey
>
> Toñi Reina Quintero wrote:
>> Hello everybody,
>>
>> Although I have said in the subject the question is about
>> intermediate properties, I'm not sure if it has to do with them or
>> with OrderedSet assignments.
>>
>> I have defined a intermediate property called nodesMainNav. This
>> property is an Ordered Set of Nodes.
>>
>> In the transformation entry point I'm trying to fill in the
>> Ordered Set. For that, I executed a query named getMainNavigationArea,
>> that returns an Area, and as an Area is composed of a set of Nodes, I
>> use the relation nodes to extract all the nodes of the area. As it can
>> be seen in the piece of code I show below.
>>
>>
>> intermediate property siteMap::nodesMainNav : OrderedSet(siteMap::Node);
>>
>>
>> main() {
>> inModel.nodesMainNav := getMainNavigationArea().nodes;
>> log('1..Num nodos',inModel.nodesMainNav->size());
>> inModel.rootObjects()[siteMap::Sitemap]->map toWebSite();
>> }
>
> As far as I understand you've defined property 'nodesMainNav' on
> modeltype 'siteMap'.
> I presume that transformation your signature looks like:
> transformation NewTransformation(in inModel : siteMap);
>
> Actually it's not legal to define intermediate property on modeltypes.
> Current qvto version (2.0.0) prohibits that.
> In case you need global property you might define it like follows:
> property nodesMainNav : OrderedSet(EClass) = OrderedSet{};
>
> In case that doesn't help we'll go farther with the example code.
> However I don't see any issues with assignment itself.
>
> As I answered your posts in amalgam newsgroup I saw that you use old
> 1.0.1 version. I suggest you to start using 2.0.0 release.
>
>>
>> My problem is that the log sentence that appears as '1..Num nodos'
>> shows the number of nodes in the OrderedSet is 0. However, I have
>> written a similar log sentence inside the getMainNavigationArea query,
>> and the result is that there are 8 nodes in the Area.
>>
>> My question is: why does the OrderedSet seem to be without any nodes
>> outside the query? Is this related to the intermediate property or is
>> something related to the assignment?
>>
>> Best regards,
>> Toñi
Re: [QVTO] Question about intermediate properties [message #482221 is a reply to message #482175] Tue, 25 August 2009 17:44 Go to previous message
Toñi  Reina is currently offline Toñi ReinaFriend
Messages: 209
Registered: July 2009
Senior Member
Hi Sergey,

I have just downloaded the new Eclipse Galileo and, as a consequence,
qvto 2.0.0. And I have no compilation problems, so as you have found
out, intermediate properties are legal with 2.0.0.

Furthermore, the same piece of code works perfectly with 2.0.0, so I
suppose the qvto 1.0.1 engine must have some implementation error that
have been solved in 2.0.0.

Thanks for all,
Toñi

Sergey Boyko escribió:
> Hi Toñi ,
>
> I was wrong in telling that it's illegal to define intermediate property
> on modeltypes. I've mixed it with transformation parameter.
>
> I checked similar sample (with 2.0.0 qvto version) and it works:
>
> modeltype ecore uses "http://www.eclipse.org/emf/2002/Ecore";
> transformation NewTransformation(in inModel : ecore);
> intermediate property ecore::nodesMainNav : OrderedSet(EClassifier);
>
> main() {
> inModel.nodesMainNav := getMainNavigationArea().eClassifiers;
> log('1..Num nodos', inModel.nodesMainNav->size());
> }
> query getMainNavigationArea() : EPackage {
> return inModel.rootObjects()![EPackage];
> }
>
>
>
> Sergey Boyko wrote:
>> Hi Toñi ,
>>
>> Some replies are in-lined, below
>>
>> Regards,
>> Sergey
>>
>> Toñi Reina Quintero wrote:
>>> Hello everybody,
>>>
>>> Although I have said in the subject the question is about
>>> intermediate properties, I'm not sure if it has to do with them or
>>> with OrderedSet assignments.
>>>
>>> I have defined a intermediate property called nodesMainNav. This
>>> property is an Ordered Set of Nodes.
>>>
>>> In the transformation entry point I'm trying to fill in the
>>> Ordered Set. For that, I executed a query named
>>> getMainNavigationArea, that returns an Area, and as an Area is
>>> composed of a set of Nodes, I use the relation nodes to extract all
>>> the nodes of the area. As it can be seen in the piece of code I show
>>> below.
>>>
>>>
>>> intermediate property siteMap::nodesMainNav : OrderedSet(siteMap::Node);
>>>
>>>
>>> main() {
>>> inModel.nodesMainNav := getMainNavigationArea().nodes;
>>> log('1..Num nodos',inModel.nodesMainNav->size());
>>> inModel.rootObjects()[siteMap::Sitemap]->map toWebSite();
>>> }
>>
>> As far as I understand you've defined property 'nodesMainNav' on
>> modeltype 'siteMap'.
>> I presume that transformation your signature looks like:
>> transformation NewTransformation(in inModel : siteMap);
>>
>> Actually it's not legal to define intermediate property on modeltypes.
>> Current qvto version (2.0.0) prohibits that.
>> In case you need global property you might define it like follows:
>> property nodesMainNav : OrderedSet(EClass) = OrderedSet{};
>>
>> In case that doesn't help we'll go farther with the example code.
>> However I don't see any issues with assignment itself.
>>
>> As I answered your posts in amalgam newsgroup I saw that you use old
>> 1.0.1 version. I suggest you to start using 2.0.0 release.
>>
>>>
>>> My problem is that the log sentence that appears as '1..Num nodos'
>>> shows the number of nodes in the OrderedSet is 0. However, I have
>>> written a similar log sentence inside the getMainNavigationArea
>>> query, and the result is that there are 8 nodes in the Area.
>>>
>>> My question is: why does the OrderedSet seem to be without any nodes
>>> outside the query? Is this related to the intermediate property or is
>>> something related to the assignment?
>>>
>>> Best regards,
>>> Toñi
Previous Topic:Syntax for Math.pow() funtion in ATL
Next Topic:[QVTO] Nullable enumerations
Goto Forum:
  


Current Time: Fri Apr 19 13:48:37 GMT 2024

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

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

Back to the top