Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [ATL] Identify last Element
icon5.gif  [ATL] Identify last Element [message #546360] Mon, 12 July 2010 14:43 Go to next message
Roger80  is currently offline Roger80 Friend
Messages: 79
Registered: May 2010
Member
Hi again

I am now working since morning and my progess is not as expected. Sad But I think that is normal in the beginning. Smile

My problem now, is that I want to evaluate the End event of the process. I thought I will do that in the following way:

All Event elements have an "id", this "id" is then used in the control flow for the attributes "source" and "target". So, I can identify the last event, when the "id" of the flow is not used in the "source" attribute of the "control flow" class. That's the theoretical part.

Now I tired it in the following way:

--Rule 9d helper: Create End Event --> Indicator: No source attribute from class Control flow is filled with the id of the last event.
helper context EPK!Event def: isEventEndEvent() : Boolean =
	if self.id = EPML2BPMN!ControlFlow.allInstances() -> collect(i | i.source) then
		true
	else
		false	--is End Event
	endif;


Please could you help me, it is important, as I have to do my master thesis and the time is running. Sad Thank you...

Cheers Roger
Re: [ATL] Identify last Element [message #546513 is a reply to message #546360] Tue, 13 July 2010 09:07 Go to previous messageGo to next message
Roger80  is currently offline Roger80 Friend
Messages: 79
Registered: May 2010
Member
Hello everybody....

Is there no help available, please could you help me. Should I provide more information? Thank you...
Re: [ATL] Identify last Element [message #546516 is a reply to message #546360] Tue, 13 July 2010 09:10 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
I don't know what you're trying to achieve but EPML2BPMN!ControlFlow.allInstances() -> collect(i | i.source) returns a Sequence with the sources of all the control flows of the model. So I doubt the test self.id = EPML2BPMN!ControlFlow.allInstances() -> collect(i | i.source) can ever be true.
Re: [ATL] Identify last Element [message #546527 is a reply to message #546360] Tue, 13 July 2010 09:42 Go to previous messageGo to next message
Roger80  is currently offline Roger80 Friend
Messages: 79
Registered: May 2010
Member
Ok, and when I have all the sources in the sequence, can I then check if the attribute "id" (self.id) of the event class is in this sequence?

If yes, the result should be false, otherwise true.
Re: [ATL] Identify last Element [message #546534 is a reply to message #546360] Tue, 13 July 2010 10:03 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
The sequence contains elements not ids.

What you probably want is :
if EPML2BPMN!ControlFlow.allInstances() -> collect(i | i.source)->excluding(OclUndefined)->collect(e | e.id)->includes(self.id)
Re: [ATL] Identify last Element [message #546556 is a reply to message #546534] Tue, 13 July 2010 11:16 Go to previous messageGo to next message
Roger80  is currently offline Roger80 Friend
Messages: 79
Registered: May 2010
Member
Thank you very much for your answer!
Can you explain me how I have to read that, what I understand:
1) Collect from allInstances of the ControlFlow class the source elements. So I have for example: sequence{1, 5, 12, 13, 19}.

2) Exclude all which are undefined elements in the sequence. What does it mean with "undefined"? In what kind undefined?

3) Then I collect the id's. My question here do I not have to give the class where the id is located? Because I just want the id from the class event.

4) And include the the id in the self.id???

Sorry, that I ask so dumb questions, but I really want to understand it!

Cheers Roger

[Updated on: Tue, 13 July 2010 11:35]

Report message to a moderator

Re: [ATL] Identify last Element [message #546563 is a reply to message #546556] Tue, 13 July 2010 11:41 Go to previous messageGo to next message
Sylvain EVEILLARD is currently offline Sylvain EVEILLARDFriend
Messages: 556
Registered: July 2009
Senior Member
Roger80
Can you explain me how I have to read that, what I understand:
1) Collect from allInstances of the ControlFlow class the source elements. So I have for example: sequence{1, 5, 12, 13, 19}.

I don't exactly know your meta-model but source is a reference to other elements right ? In that case you have a sequence of elements, not a sequence of Integers

Roger80

2) Exclude all which are undefined elements in the sequence. What does it mean with "undefined"? In what kind undefined?


Suppose you have a control flow without any source, if you collect all the sources, you'll get OclUndefined for this one. Then you can't do anything on OclUndefined and if you still do it will break so to be sure to not face the problem it's always more safe to handle that case like that.

Roger80

3) Then I collect the id's. My question here do I not have to give the class where the id is located? Because I just want the id from the class event.


Then you can filter the sequence of elements :
->select(e | e.oclIsTypeOf(MM!ClassEvent))

Roger80

4) And include the the id in the self.id???


Includes(s) on a a collection will return true if this collection contains s, false otherwise

Roger80

Sorry, that I ask so dumb questions, but I really want to understand it!


You should have a deep look at the ATL manuel, everything is explained there. Moreover it's really hard to answer those kind of questions without a good knowledge of the meta-models you're using.
Re: [ATL] Identify last Element [message #546565 is a reply to message #546556] Tue, 13 July 2010 11:25 Go to previous messageGo to next message
Vincent MAHE is currently offline Vincent MAHEFriend
Messages: 129
Registered: July 2009
Senior Member
Le 13/07/2010 13:16, Roger80 a écrit :
> Thank you very much for your answer!
> Can you explain me how I have to read that, what I understand:
> 1) Collect from allInstances of the ControlFlow class the source
> elements. So I have for example: sequence{1, 5, 12, 13, 19}.
>
> 2) Exclude all which are undefined elements in the sequence. What does
> it mean with "undefined"? In what kind undefined?

It means OclUndefined which is the equivalent for OCL of Java/C null or
void
>
> 3) Then I collect the id's. My question here do I not have to give the
> class where the id is located? Because I just want the id from the class
> event.
the AllInstances returns a set of ContorlFlow instances so it'is typed
and you can handle them as ControlFlow instances.
>
> 4) And include the the id in the self.id???
> Sorry, that I answer so dumb questions, but I really want to understand it!
it is a comparing of the Id of the current item you are working on
(self.id) with the set elements ids
>
> Cheers Roger
>


--
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
Re: [ATL] Identify last Element [message #547581 is a reply to message #546360] Mon, 19 July 2010 04:13 Go to previous messageGo to next message
Roger80  is currently offline Roger80 Friend
Messages: 79
Registered: May 2010
Member
Hi all

I made now some investigations and try now to start here from beginning with my explanations:


I am creating a helper, but I do not work.

I have the following code:


helper context EPK!Event def: isNotEndEvent() : Boolean =
if EPK!Arc.allInstances() -> collect(i | i.source)->includes(self.id) then true
else false
endif;



So, my result is always false.What is my idea behind the rule:

EPK!Arc.allInstances() -> collect(i | i.source)

I take the "source" attribute of all allInstances I have in my source model. As my "source" attributes are something like this "3", I expect as a result a sequence like { "3", "7", "10", "15","20"}
Remark: The source attribute is of type String. Is that correct?

->includes(self.id)

Now I want to check if this result sequence { "3", "7", "10", "15","20"} is an element of the (self.id).
So for every Event this rule is checked and the id are something like { "3"} then {"7"} then {"10"} then {"15"} then {"16"} then {"20"}

My expectation than is that for "3", "7", "10", "15","20" the check is true, but not for "16" as this element is not in the first result sequence. But it doesn't work! What is wrong. Please help me.

2) By the way, how can a I see what is in the sequences, is there a statement to give out the values in a sequence?

Please, please help...

Thank you very much for your help! Cheers Roger



Re: [ATL] Identify last Element [message #547614 is a reply to message #546360] Mon, 19 July 2010 07:27 Go to previous messageGo to next message
Roger80  is currently offline Roger80 Friend
Messages: 79
Registered: May 2010
Member
I know now, why it is not working, but I need more support from your side:

My results out of the following first part

EPK!Arc.allInstances() -> collect(i | i.source).debug();

is:
org.eclipse.m2m.atl.engine.vm.VMException
NativeOperation public static org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny.debug(org.eclipse.m2m.atl.engine.vm.StackFrame,org.eclipse.m2m.atl.engine.vm.nativelib.ASMOclAny,org.eclipse.m2m.atl.engine.vm.nativelib.ASMString)
	args = [Sequence {OclUndefined, OclUndefined, OclUndefined, OclUndefined, OclUndefined, OclUndefined, OclUndefined, OclUndefined, OclUndefined, OclUndefined, OclUndefined, OclUndefined, OclUndefined, OclUndefined, OclUndefined, OclUndefined, OclUndefined, OclUndefined, OclUndefined, OclUndefined, OclUndefined, OclUndefined}]



It looks like that OCL can not grap out the attribute "source". Is something wrong with my meta model? Can you please help me?

Cheers Roger

icon14.gif  Re: [ATL] Identify last Element [SOLVED] [message #547621 is a reply to message #546360] Mon, 19 July 2010 07:42 Go to previous message
Roger80  is currently offline Roger80 Friend
Messages: 79
Registered: May 2010
Member
I was able to solve it. It was really easy, as the Arc class didn't contain the source attribute. After I changed to the correct class everything worked fine. Smile

Cheers Roger
Previous Topic:[QVT-R] Problem with inheritance
Next Topic:[QVTO] Accessing a EFeatureMapEntry
Goto Forum:
  


Current Time: Tue Apr 13 03:52:34 GMT 2021

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

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

Back to the top