[QVT] some questions from a QVT beginner [message #108316] |
Tue, 14 July 2009 15:22 |
Eclipse User |
|
|
|
Originally posted by: formatzeh.gmx.de
Today I made my first steps with QVT. I have a UML model containing some
packages containing usecases. Some packages have a stereotype (from my
profile) applied. Now I have some problems to solve. At first I want to
know how to debug an Operational QVT Interpreter-Run. In [] of Debugging
support is written.
Another thing is, how to apply a stereotype? I can check if stereotypes
are applied but I don't know how to apply them. I want to post my code
as well. Maybe you can give me some hints or tricks:
modeltype UML2 "strict" uses uml('http://www.eclipse.org/uml2/3.0.0/UML');
transformation conceptual2analysis(inout base:UML2);
main() {
base.rootObjects()[UML2::Model]-> map conceptualModel2analysisModel();
}
mapping inout UML2::Model::conceptualModel2analysisModel() {
self.ownedElement[UML2::Package]->map addAnalysisPackage(self);
}
query UML2::Package::isConceptualModel() : Boolean {
var st := self.getAppliedStereotype('MyProfile::ConceptualModel');
return not st.oclIsUndefined();
}
query UML2::UseCase::isUIConceptual() : Boolean {
var st := self.getAppliedStereotype('MyProfile::UIConceptual');
return not st.oclIsUndefined();
}
mapping UML2::Package::addAnalysisPackage(inout model : UML2::Model) :
UML2::Package
when {
self.isConceptualModel()
}
{
result.name := 'Analysis View';
result.ownedType := self.ownedElement[UML2::UseCase]->map usecase2class();
model.nestedPackage += result;
}
mapping UML2::UseCase::usecase2class() : UML2::Class
when{
self.isUIConceptual();
}
{
result.name := self.name;
}
Is it possible to get generated a Plugin by which you can invoke such a
transformation by right-clicking on a uml-file for example? I remember
that it is possible with Acceleo afaik.
best regards
Gilbert
[1] http://www.eclipse.org/m2m/qvto/doc/M2M-QVTO.pdf
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03782 seconds