|
Re: [QVTo] Mapping 1 to many objects results in output object appearing as siblings [message #538025 is a reply to message #538010] |
Fri, 04 June 2010 14:18 |
Eclipse User |
|
|
|
Originally posted by: dhendriksREMOVE_THIS.tueREMOVE.THIS.nl
Hello C. Kopf,
> //Entry-point
> mapping AUTOSARGenIA::ARPackage::arpackage2module() : Module {
> -- ...
> declarations +=
> self.elements[SenderReceiverInterface]->forEach(SRInterface)
> {generateMessagePortTypes(SRInterface)->asOrderedSet()};
> -- ...
> }
If you create new objects and don't contain them anywhere in other
objects, they end up as top-level (root) objects in the output. So,
somehow your objects are not contained. Maybe change the above to this:
mapping AUTOSARGenIA::ARPackage::arpackage2module() : Module {
-- ...
self.elements[SenderReceiverInterface]->forEach(SRInterface)
{
declarations += generateMessagePortTypes(SRInterface)->asOrderedSet()
};
-- ...
I not sure this helps, but you can try it...
Dennis
C. Kopf wrote:
> Hello again everybody,
>
> When trying to transform one input object to many (e.g. two) output
> objects i came along the following problem:
>
> The output-objects are all placed as siblings to the first generated
> object.
>
> For mappings of a single object to a set of output-object Pieter
> mentioned this problem already here:
> http://www.eclipse.org/forums/index.php?t=msg&goto=51746 0&#msg_517460
>
> I also tried the work-around wich Pieter used, but the rsults are still
> the same.
>
> Here are more details:
>
>
>
> //Entry-point
> mapping AUTOSARGenIA::ARPackage::arpackage2module() : Module {
> -- ...
> declarations +=
> self.elements[SenderReceiverInterface]->forEach(SRInterface)
> {generateMessagePortTypes(SRInterface)->asOrderedSet()};
> -- ...
> }
>
> // the one2many transformation:
> query generateMessagePortTypes(in
> interface:AUTOSARSwcPorti::SenderReceiverInterface) : Set(MessagePortType){
> var resultPorts:Set(MessagePortType);
> resultPorts += interface.map
> senderReceiverInterface2messagePortType(true);
> resultPorts += interface.map
> senderReceiverInterface2messagePortType(false);
> return resultPorts;
> }
>
> mapping
> AUTOSARSwcPorti::SenderReceiverInterface::senderReceiverInte rface2messagePortType(in
> isProvided:Boolean) : MessagePortType{
> var direction:String;
> if (isProvided)
> then direction := "OUT"
> else direction := "IN"
> endif;
> name := self.shortName+direction;
> comSpec := self.dataElements.map
> dataElementProtoType2messageAndStreamComSpec()->asOrderedSet();
> }
>
>
> in the resulting model all MessagePortTypes occure as siblings on
> top-level instead of beeing children to their parent module. Same
> problem occured, as Pieter already mentioned, when directly using a
> mapping with signature:
>
> mapping
> AUTOSARSwcPorti::SenderReceiverInterface::senderReceiverInte rface2messagePortTypes
> : Set(MessagePortType)
>
> and also, when generating the MessagePorttypes directly inside the Query:
>
>
> query generateMessagePortTypes(in
> interface:AUTOSARSwcPorti::SenderReceiverInterface) : Set(MessagePortType){
> var resultPorts:Set(MessagePortType);
> resultPorts += object MessagePortType{name:=interface.shortName+"IN"};
> resultPorts += object MessagePortType{name:=interface.shortName+"OUT"};
> return resultPorts;
> }
>
>
>
>
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03401 seconds