Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] BPMN2BPEL-sample, helper-functions not clear
[ATL] BPMN2BPEL-sample, helper-functions not clear [message #556212] Tue, 31 August 2010 11:28 Go to next message
Alexey is currently offline AlexeyFriend
Messages: 61
Registered: January 2010
Member
Hello!
Below are helpers from BPMN2BPEL - transformation sample, form the section "XML2BPMN". Could someone please explain in short, what these 4 helpers

getAttrVal, getSon, getName and getNodeType

exactly do?

Thank you very much!

Alexey



helper context XML!Element def: getAttrVal(name : String) : String = let a : Sequence(XML!Attribute) = self.children->select(c |
 		c.oclIsTypeOf(XML!Attribute) and c.name = name) in
 	if a.isEmpty() then
 		''
 	else
 		a.first().value
 	endif;

helper context XML!Element def: getSon(name : String) : Sequence(XML!Element) =
	self.children->select(c | c.name = name);

helper context XML!Element def: getName: String =
	self.children->select(c | c.oclIsTypeOf(XML!Element) and c.name = 'name')->first().children
		->select(d | d.oclIsTypeOf(XML!Element) and d.name = 'text')->first().children
			->select(e | e.oclIsKindOf(XML!Text))->first().value;
--
--
--	
helper def: getNodeType(type : String) : BPMN!NodeType =
	if (type='MessageEvent')
		then #MessageEvent
		else if (type='StartEvent')
			then #StartEvent
			else if (type='TimerEvent')
				then #TimerEvent
				else if (type='XOR-Join')
					then #XORJoin 
					else if (type='EBXOR-Join')
						then #EBXORJoin
						else if (type='AND-Join')
							then #ANDJoin
							else if (type='AND-Split')
								then #ANDSplit
								else if (type='EndEvent')
									then #EndEvent
									else if (type='XOR-Split')
										then #XORSplit
										else #EBXORSplit
									endif
								endif
							endif
						endif	
					endif
				endif
			endif
		endif
	endif;
Re: [ATL] BPMN2BPEL-sample, helper-functions not clear [message #556238 is a reply to message #556212] Tue, 31 August 2010 12:18 Go to previous message
Vincent MAHE is currently offline Vincent MAHEFriend
Messages: 129
Registered: July 2009
Senior Member
Le 31/08/2010 13:28, Alexey a écrit :
> Hello!
> Below are helpers from BPMN2BPEL - transformation sample, form the
> section "XML2BPMN". Could someone please explain in short, what these 4
> helpers
> getAttrVal, getSon, getName and getNodeType
> exactly do?

Most of them are factorized code ie centralize some operations that
could be needed in more than one place in the transformation.

ATL is a declarative language, which implies functional writing of
operations. Trying to understand what those simple helpers do could be a
good exercise if you are not comfortable with functional languages :-)

As ATL is one of them, you need to be easier with this way to code (and
think) if yout have to work with. So it may be not a help to you to
translate them in procedural equivalent....

> Thank you very much!
>
> Alexey
>
>
>
>
> helper context XML!Element def: getAttrVal(name : String) : String = let
> a : Sequence(XML!Attribute) = self.children->select(c |
> c.oclIsTypeOf(XML!Attribute) and c.name = name) in
> if a.isEmpty() then
> ''
> else
> a.first().value
> endif;
>
> helper context XML!Element def: getSon(name : String) :
> Sequence(XML!Element) =
> self.children->select(c | c.name = name);
>
> helper context XML!Element def: getName: String =
> self.children->select(c | c.oclIsTypeOf(XML!Element) and c.name =
> 'name')->first().children
> ->select(d | d.oclIsTypeOf(XML!Element) and d.name =
> 'text')->first().children
> ->select(e | e.oclIsKindOf(XML!Text))->first().value;
> --
> --
> --
> helper def: getNodeType(type : String) : BPMN!NodeType =
> if (type='MessageEvent')
> then #MessageEvent
> else if (type='StartEvent')
> then #StartEvent
> else if (type='TimerEvent')
> then #TimerEvent
> else if (type='XOR-Join')
> then #XORJoin else if (type='EBXOR-Join')
> then #EBXORJoin
> else if (type='AND-Join')
> then #ANDJoin
> else if (type='AND-Split')
> then #ANDSplit
> else if (type='EndEvent')
> then #EndEvent
> else if (type='XOR-Split')
> then #XORSplit
> else #EBXORSplit
> endif
> endif
> endif
> endif
> endif
> endif
> endif
> endif
> endif;
>


--
Cordialement

Vincent MAHÉ

Ingénieur Expert - Projet IDM++ - Équipe AtlanMod
École des Mines de Nantes
La Chantrerie - 4, rue Alfred Kastler
B.P. 20722 - F-44307 NANTES Cedex 3
Tel: (33)2 51 85 81 00
Previous Topic:[QVTo] Executing transformation on dynamic input model
Next Topic:[ATL] ATL power for transformations
Goto Forum:
  


Current Time: Tue Apr 16 06:28:59 GMT 2024

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

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

Back to the top