Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » Helper returns a sequence or set
Helper returns a sequence or set [message #699779] Fri, 22 July 2011 09:45 Go to next message
Fy Za is currently offline Fy ZaFriend
Messages: 245
Registered: March 2010
Senior Member
I define an helper that returns a Sequence a an element: helper ............... : Sequence(MM!FiacreProcessName),

but the problem that is not is the best form, so the returned form is like this :

<port="//@declarations.1/@transition.7/@processID.0/@fiacre_process_name //@declarations.1/@transition.7/@processID.1/@fiacre_process_name"/>

but I'd have the result like this
<port="//@declarations.1/@transition.7/@processID.0/@fiacre_process_name/>
<port="//@declarations.1/@transition.7/@processID.1/@fiacre_process_name"/>

this is the rule
rule FiacreLabelType2FiacreLabelType {
	from
		fiacre_label_type_ins : InstancieMetaModel!FiacreLabelType(fiacre_label_type_ins.oclIsTypeOf(InstancieMetaModel!FiacreLabelType))
	to
		fiacre_label_type_lie : LieMetaModel!FiacreLabelType(
			name <- fiacre_label_type_ins.name,
			ports <- thisModule.getPort(fiacre_label_type_ins.name)
		)
}


ports is a reference 0..*

and this is the helper
helper def : getPort(labelName : String) : Set(InstancieMetaModel!FiacreProcessName) =
	let alltransitions : Sequence(InstancieMetaModel!Transition) = 
		InstancieMetaModel!Transition.allInstances().asSequence() in
	alltransitions->iterate(t; y : InstancieMetaModel!Transition = alltransitions->first() |
					if t.label.name = labelName
					then 
						t
					else
						y
					endif
	).processID->collect(e|e.fiacre_process_name)
	;


please help me
thanks

[Updated on: Fri, 22 July 2011 09:50]

Report message to a moderator

Re: Helper returns a sequence or set [message #699883 is a reply to message #699779] Fri, 22 July 2011 14:25 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
What you show doesn't even look like well formed XML. With extended
meta data annotations in your model, you can direct a feature to be
serialized as an element rather than an attribute.


On 22/07/2011 2:45 AM, ZALILA Faiez wrote:
> I define an helper that returns a Sequence a an element: helper
> ............... : Sequence(MM!FiacreProcessName),
>
> but the problem that is not is the best form, so the returned form is
> like this :
>
> <port="//@declarations.1/@transition.7/@processID.0/@fiacre_process_name
> //@declarations.1/@transition.7/@processID.1/@fiacre_process_name"/>
>
> but I'd have the result like this
> <port="//@declarations.1/@transition.7/@processID.0/@fiacre_process_name/>
>
> <port="//@declarations.1/@transition.7/@processID.1/@fiacre_process_name"/>
>
>
> please help me
> thanks


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:[ATL] Using own model implementation instances instead of DynamicEObjImpl as in/output
Next Topic:[QVTo] Debugging in a second eclipse instance
Goto Forum:
  


Current Time: Fri Apr 26 05:24:23 GMT 2024

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

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

Back to the top