Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » [QVTo] How to mapp association between two classes
[QVTo] How to mapp association between two classes [message #1774440] Sat, 14 October 2017 13:05 Go to next message
Bosko Susnjar is currently offline Bosko SusnjarFriend
Messages: 6
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?

[Updated on: Sat, 14 October 2017 13:06]

Report message to a moderator

Re: [QVTo] How to mapp association between two classes [message #1774442 is a reply to message #1774440] Sat, 14 October 2017 14:22 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
The project's contact page has a link to their forum: https://projects.eclipse.org/projects/modeling.mmt.qvt-oml/contact

Ed Merks
Professional Support: https://www.macromodeling.com/
Re: [QVTo] How to mapp association between two classes [message #1774445 is a reply to message #1774442] Sat, 14 October 2017 20:09 Go to previous message
Bosko Susnjar is currently offline Bosko SusnjarFriend
Messages: 6
Registered: May 2017
Junior Member
Ok, thank you.

You can move this topic to closed.
Previous Topic:how to set eclipse (python) to connect ROS
Next Topic:Hello and I Read the Bullet Points/Getting Eclipse to Work on Debian Stretch!
Goto Forum:
  


Current Time: Fri Apr 26 17:48:35 GMT 2024

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

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

Back to the top