Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » QVT-OML » [QVTo] How to mapp association between two classes
[QVTo] How to mapp association between two classes [message #1774446] Sat, 14 October 2017 20:09 Go to next message
Bosko Susnjar is currently offline Bosko SusnjarFriend
Messages: 4
Registered: May 2017
Junior Member
Hello. I have final exam on my Faculty and i need to create QVT plugin for mapping database schema from conceptual model into relationship model.

So - for start - I have created two classes:
https://i.imgur.com/G9V7PPV.png

And create this transformation code:
modeltype uml "strict" uses uml('http://www.eclipse.org/uml2/3.0.0/UML');

transformation transf(in srcModel:uml, out destModel: uml);

main() {
   srcModel.rootObjects()[Model] -> map Model2Model();   

}

mapping Model:: Model2Model() : Model {
	name := self.name;
	
	packagedElement += self.packagedElement[Class] -> map Class2Class();
	packagedElement += self.packagedElement[Association] -> map Association2Association();
} 

mapping Class:: Class2Class() : Class {
	name := self.name;
	visibility := self.visibility;
	
	ownedAttribute += self.ownedAttribute[Property] -> map Property2Property();
	ownedOperation += self.ownedOperation[Operation] -> map Operation2Operation();
}

mapping Property:: Property2Property() : Property {
	name := self.name;
	type := self.type;
	
	--lower := self.lower;
	--upper := self.upper;
}

mapping Operation:: Operation2Operation() : Operation {
	name := self.name;
	
	ownedParameter += self.ownedParameter[Parameter] -> map Parameter2Parameter();
}

mapping Parameter :: Parameter2Parameter() : Parameter {
	name := self.name;
	type := self.type;
}

mapping Association :: Association2Association() : Association {
	name := self.name;
	visibility := self.visibility;
	memberEnd := self.memberEnd;
	
	ownedEnd += self.ownedEnd[Property] -> Property2PropertyA();
}
mapping Property :: Property2PropertyA() : Property {
	type := self.type;
	
	association := self.association;
	lowerValue := self.lowerValue;
	upperValue := self.upperValue;	
} 


But, when i run transformation, i get this error:

Severity	Description	Element	Parent	Type
Error	The feature 'uml::Relationship::relatedElement' of 'RootElement::residence' with 0 values must have at least 1 values	<Association> residence	RootElement	EMF Problem
Error	The feature 'uml::Association::memberEnd' of 'RootElement::residence' with 0 values must have at least 2 values	<Association> residence	RootElement	EMF Problem
Error	The feature 'uml::Association::endType' of 'RootElement::residence' with 0 values must have at least 1 values	<Association> residence	RootElement	EMF Problem


My problem is how to mapp Association between those two classes?
I know that on * side i need to have one more attribute and foreign key operation but don't know how to write it.

Can someone help me, please?
Re: [QVTo] How to mapp association between two classes [message #1774447 is a reply to message #1774446] Sat, 14 October 2017 20:53 Go to previous message
Ed Willink is currently offline Ed WillinkFriend
Messages: 6002
Registered: July 2009
Senior Member
Hi

I'm sorry. This forum is unlikely to give you help on your exam problems.

Regards

Ed Willink
Previous Topic:How to trigger XMI transformation in programed java
Next Topic:Documentation for QVTO
Goto Forum:
  


Current Time: Fri Aug 17 02:03:00 GMT 2018

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

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

Back to the top