[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.m2m] Re: [QVTO] Question about intermediate properties

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