Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » QVT-OML » use of libraries
use of libraries [message #930706] Tue, 02 October 2012 15:02 Go to next message
Cuauhtemoc CastellanosFriend
Messages: 9
Registered: September 2012
Location: paris
Junior Member
Hello,

I'm trying to modularize my transformation code into sorted libraries.
Separating helpers and queries works but i can't separate a call to a mapping and its definition. When i do it, it tells me that it cannot find operation.
Is there a way to tell to the interpretor that it has to look into the library?

thanks,

Cuauhtemoc.
Re: use of libraries [message #930733 is a reply to message #930706] Tue, 02 October 2012 15:31 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

The OMG specification on the packaging of transformations is vague and I
have no idea what QVTo does.

You could try referencing as MyLibrary::MyTransformation

Regards

Ed Willink


On 02/10/2012 17:02, castellanoscuauhtemoc@xxxxxxxx cuauhtemoc wrote:
> Hello,
> I'm trying to modularize my transformation code into sorted libraries.
> Separating helpers and queries works but i can't separate a call to a
> mapping and its definition. When i do it, it tells me that it cannot
> find operation.
> Is there a way to tell to the interpretor that it has to look into the
> library?
>
> thanks,
> Cuauhtemoc.
>
Re: use of libraries [message #930804 is a reply to message #930733] Tue, 02 October 2012 16:56 Go to previous messageGo to next message
Fabio L. S. is currently offline Fabio L. S.Friend
Messages: 15
Registered: July 2010
Location: Brazil
Junior Member
Hi Cuauhtemoc;

For me, a simple "import" works fine. Here it is a small example based on the SimpleUML to RDB example (there are two packages, p1 and p2):

import p2.Map;

modeltype UML uses 'http://www.eclipse.org/qvt/1.0.0/Operational/examples/simpleuml';
modeltype RDB uses 'http://www.eclipse.org/qvt/1.0.0/Operational/examples/rdb';

transformation Simpleuml_To_Rdb(in uml : UML, out RDB);

main() {
	uml.rootObjects()[UML::Model]->map model2RDBModel();
}

mapping UML::Model::model2RDBModel() : RDB::Model {
	name := self.name;
	schemas := self.ownedElements[UML::Package]->asOrderedSet()->map package2schema();
}


library Map;

modeltype UML uses 'http://www.eclipse.org/qvt/1.0.0/Operational/examples/simpleuml';
modeltype RDB uses 'http://www.eclipse.org/qvt/1.0.0/Operational/examples/rdb';

mapping UML::Package::package2schema() : RDB::Schema 
{
	name := self.name;
}


Regards;


Fabio Levy Siqueira
Re: use of libraries [message #931756 is a reply to message #930804] Wed, 03 October 2012 13:45 Go to previous messageGo to next message
Cuauhtemoc CastellanosFriend
Messages: 9
Registered: September 2012
Location: paris
Junior Member
Thanks,
it works very well thank you!!
The error it was that i was trying to import transformation mapping, not librarry.
Do you know how to have an superimposition behaviour?
I know that it is not included in the standard but this feature is powerfull for maintainablity and evolability of transformation.
Otherwise i would make wrappers.

Thanks;
Re: use of libraries [message #931795 is a reply to message #931756] Wed, 03 October 2012 14:31 Go to previous messageGo to next message
Fabio L. S. is currently offline Fabio L. S.Friend
Messages: 15
Registered: July 2010
Location: Brazil
Junior Member
Sorry, I have no clue... I'm not familiar with the concept of superimposition. If you describe a concrete example, maybe someone can help.

Regards;


Fabio Levy Siqueira
Re: use of libraries [message #932595 is a reply to message #931795] Thu, 04 October 2012 08:53 Go to previous messageGo to next message
Cuauhtemoc CastellanosFriend
Messages: 9
Registered: September 2012
Location: paris
Junior Member
In fact, I'm trying to give to my transformation a wrapper pattern structure, that ease adding functionnalities to my transformation.
There are disjuncts mappings that decide which functionnality to use. The point is that each library has to be able to call the wrapper, but the wrapper import them and the wrapped functionnalities has to import the wrapper to call it. So I have some cyclic dependencies.
Superimposition allow to implement this kind of structure. I'm wondering if there is a way to implement it in separated libraries.
Re: use of libraries [message #932601 is a reply to message #932595] Thu, 04 October 2012 08:57 Go to previous messageGo to next message
Ed Willink is currently offline Ed WillinkFriend
Messages: 7655
Registered: July 2009
Senior Member
Hi

Cyclic dependencies are often challenging if not actually ill-formed.

Naively it would seem to me that you have a modularization problem if
your wrappers are not almost dependency-free.

Regards

Ed Willink


On 04/10/2012 10:53, C. Cuauhtemoc wrote:
> In fact, I'm trying to give to my transformation a wrapper pattern
> structure, that ease adding functionnalities to my transformation.
> There are disjuncts mappings that decide which functionnality to use.
> The point is that each library has to be able to call the wrapper, but
> the wrapper import them and the wrapped functionnalities has to import
> the wrapper to call it. So I have some cyclic dependencies.
> Superimposition allow to implement this kind of structure. I'm
> wondering if there is a way to implement it in separated libraries.
Re: use of libraries [message #932780 is a reply to message #932601] Thu, 04 October 2012 12:23 Go to previous messageGo to next message
Cuauhtemoc CastellanosFriend
Messages: 9
Registered: September 2012
Location: paris
Junior Member
Simply, I have a library A (the wrapper) which import library B (the wrapped), but library B needs to call the wrapper.
I didn't understand what a module realy is, and how to use it. "Its a unit containing a set of operations and types defined to operate on models", but is it a transformation, a library? It is not very clear to me.
If you can enlight on this point.
Thanks

Cuauhtemoc
Re: use of libraries [message #932912 is a reply to message #932780] Thu, 04 October 2012 15:06 Go to previous message
Fabio L. S. is currently offline Fabio L. S.Friend
Messages: 15
Registered: July 2010
Location: Brazil
Junior Member
Hi Cuauhtemoc;

Maybe I did not understand your question, but in the QVT specification a library and a transformation are modules (specializations of the "module" metaclass) (see page 78). I don't know why the "module" metaclass is not abstract, i.e., what is a module that is neither a library nor a transformation...

Regarding your problem, try to reorganize your libraries in order to avoid Library B calling Library A ("wrapped" calling the "wrapper"). As Ed commented, cyclic dependencies are often an indication of an inadequate organization (not cohesive enough). Ask yourself if it is really necessary. If it *really* is, a simple solution is to move the A's mappings & queries used by B to another Library (C, for example) and make A and B import it.

Regards;


Fabio Levy Siqueira
Previous Topic:Save Traces to a file during a standalone transformation run
Next Topic:[Announce] Eclipse QVT Operational 3.2.1 (Juno SR1) is now available
Goto Forum:
  


Current Time: Wed Apr 24 23:57:09 GMT 2024

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

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

Back to the top