Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [QVT Relations] How do I resolve target objects from source objects?
[QVT Relations] How do I resolve target objects from source objects? [message #643795] Wed, 08 December 2010 10:09 Go to next message
Tassilo Horn is currently offline Tassilo Horn
Messages: 93
Registered: July 2009
Member
Hi all,

I'm trying to do my first transformation using the Relations language.
I use mediniQVT, but my question is not related to the implementation.

My example is an extension of that Members2Persons transformation known
from the ATL tutorial. Now I have this relation:

top relation Members2Female {
checkonly domain fam member: families::Member {
-- How to set the husband? I can retrieve the corresponding source
-- Member with spouse(member), but how to resolve it to the target
-- Male?
husband = ???
};
enforce domain per female: persons::Female {};
when {
isFemale(member);
}
where {
Members2Person(member, female);
}
}

That relation successfully creates Femals for Members that can be
identified as such. But how do I set the husband reference of Female?

I have a query spouse(Member):Member, that given a Member returns the
Member that is its spouse. But how do I resolve the returned Member
into the Male that was created for it?

Thanks for pointers,
Tassilo
--
Dipl.-Inform. Tassilo Horn | Room: B015
University of Koblenz-Landau, Campus Koblenz | Phone: +49 (261) 287-2745
Institute for Software Technology | Mail: horn@uni-koblenz.de
Universitätsstr. 1, 56070 Koblenz, Germany |
Re: [QVT Relations] How do I resolve target objects from source objects? [message #643814 is a reply to message #643795] Wed, 08 December 2010 11:08 Go to previous message
Tassilo Horn is currently offline Tassilo Horn
Messages: 93
Registered: July 2009
Member
Hi again,

after fiddeling around, I've found a way to do what I mean:

--8<---------------cut here---------------start------------->8---
top relation Member2Male {
checkonly domain fam member: families::Member {};
enforce domain per male: persons::Male {};
when {
not isFemale(member);
}
where {
Member2Person(member, male);
}
}

top relation Member2Female {
hb : persons::Male;
checkonly domain fam member: families::Member {};
enforce domain per female: persons::Female {
husband = hb
};
when {
isFemale(member);
-- If that member has a spouse, then set the bidirectional
-- reference husband.
spouse(member).oclIsUndefined() or Member2Male(spouse(member), hb);
}
where {
Member2Person(member, female);
}
}

relation Member2Person {
fn : String;
g : persons::Genealogy;
fm : families::FamilyModel;
checkonly domain fam member: families::Member {
firstName = fn,
model = fm
};
-- How do I get rid of the warning that I instantiate an abstract class
-- here?
enforce domain per person: persons::Person {
fullName = fn + ' ' + family(member).lastName,
genealogy = g,
ageGroup = ageGroup(member),
address = a : persons::Address {
street = family(member).street,
town = family(member).town
}
};
where {
Families2Genealogy(fm, g);
}
}
--8<---------------cut here---------------end--------------->8---

Bye,
Tassilo
--
Dipl.-Inform. Tassilo Horn | Room: B015
University of Koblenz-Landau, Campus Koblenz | Phone: +49 (261) 287-2745
Institute for Software Technology | Mail: horn@uni-koblenz.de
Universitätsstr. 1, 56070 Koblenz, Germany |
Previous Topic:[ATL] output resource content changes once serialized and reloaded
Next Topic:Mapping - BPMN to BPEL with ATL
Goto Forum:
  


Current Time: Sun Sep 21 04:29:23 GMT 2014

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

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