Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » do some process in the nomatch block of EPL
do some process in the nomatch block of EPL [message #1386348] Mon, 16 June 2014 19:44 Go to next message
Mahsa P is currently offline Mahsa PFriend
Messages: 115
Registered: July 2013
Senior Member
Hi
I have one pattern in EPL. it's schema likes this:

pattern nameOfPattern
declaration roles
{
match: condition

onmatch{}

nomatch()
}


I want to do some same processes in the both of onmatch and nomatch cases. But when I call my function for doing these processes in nomatch block, such as: nomatch(a.func()),
my pattern is blocked in nomatch phase and isn't done for other remained elements in match condition! I don't get any errors, just running the my pattern is finished after one time of doing nomatch block.

can you help me my friends? What are your suggestions?

[Updated on: Mon, 16 June 2014 19:48]

Report message to a moderator

Re: do some process in the nomatch block of EPL [message #1386489 is a reply to message #1386348] Tue, 17 June 2014 19:59 Go to previous messageGo to next message
abdush mohd is currently offline abdush mohdFriend
Messages: 35
Registered: April 2014
Member
Hi Mahsa,

I am currently learning and working with EPL too though not an expert Smile.
If you mean that the program ends after running once for the matching pattern (while there are more matched elements), have you tried to check the "Repeat while matches are found" option in the run configuration?

Regards
Abdu
Re: do some process in the nomatch block of EPL [message #1386497 is a reply to message #1386489] Tue, 17 June 2014 20:52 Go to previous messageGo to next message
Mahsa P is currently offline Mahsa PFriend
Messages: 115
Registered: July 2013
Senior Member
Hi Abdush,
I'm very grateful to you:)
I think that you are correct, My problem originates from stopping the process after running the match block for matched roles times. I've used .launch file but according to your suggestion, I checked "Repeat while matches are found" in run configuration. In this case I get an error on my meta-model while I've added it!
for example, I have such statement in pre condition :
var sources:= Class.allInstances();
that Class is one element in UML.ecore. I hadn't any problem with this statement before, but when I use run configuration, I get:
Undefined variable, type or model: 'Class'
can I add one tag in .launch file for Repeat property?
However,I check this again and try change .epl for omitting the errors!
Thank you:)

Re: do some process in the nomatch block of EPL [message #1386578 is a reply to message #1386497] Wed, 18 June 2014 11:18 Go to previous messageGo to next message
abdush mohd is currently offline abdush mohdFriend
Messages: 35
Registered: April 2014
Member
Hi Mahsa,

For the .launch file, in fact if you opt to save from the run configuration you will get these tags:
<booleanAttribute key="repeatWhileMatchesFound" value="true"/>
<intAttribute key="maxLoops" value="-1"/>

I'm not sure about the error you get, maybe it's from the model and metamodel files/URI settings.
I am working with BPMN Ecore metamodel and sometimes I get similar error if a use an ECore file instead of the registered one, something that I still didn't get why.

Regards
Abdu
Re: do some process in the nomatch block of EPL [message #1386630 is a reply to message #1386578] Wed, 18 June 2014 20:31 Go to previous messageGo to next message
Mahsa P is currently offline Mahsa PFriend
Messages: 115
Registered: July 2013
Senior Member
Hi abdush,
Thanks for your reply:)
I fixed that error with alias name and run my EPL pattern for infinite time, but my problem wasn't solved. In fact, I have one role that is match with condition once but I want to run match block for n time.
pre
{
var count:new Integer;
count:=0;
var set=Class.allInstances();
}
pattern test
elem: metamodel!Element
{
match : (elem.relations.name).excludes(set.at(count).name)
.......


According to above code and my model, there is one 'elem' (in my model) that satisfies match condition, so match is run once. But I want to run it for 'count' time.
If you have any idea about it, I'll be happy to hear it Wink
Re: do some process in the nomatch block of EPL [message #1386839 is a reply to message #1386630] Sat, 21 June 2014 11:18 Go to previous messageGo to next message
abdush mohd is currently offline abdush mohdFriend
Messages: 35
Registered: April 2014
Member
Hi Mahsa,

Sorry, I have no exact idea how to do that. I guess that match part invocation is handled by the language [EPL]. You can ofcourse have what you want to run multiple times in a loop inside the match part. If you check the Epsilon Book (CH11) the match part is like additional condition that is checked for the pattern.

Regards
Abdu

[Updated on: Sat, 21 June 2014 11:55]

Report message to a moderator

Re: do some process in the nomatch block of EPL [message #1386862 is a reply to message #1386839] Sat, 21 June 2014 20:50 Go to previous messageGo to next message
Mahsa P is currently offline Mahsa PFriend
Messages: 115
Registered: July 2013
Senior Member
Hi,
Thanks for your replies. I search more and try to solve it.
Re: do some process in the nomatch block of EPL [message #1387072 is a reply to message #1386862] Mon, 23 June 2014 21:45 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2163
Registered: July 2009
Location: York, UK
Senior Member

Hi Mahsa,

Apologies for the slow response - this somehow slipped my attention. Could you please put together a minimal example [1] I can use to reproduce this?

Cheers,
Dimitris

[1] https://www.eclipse.org/epsilon/doc/articles/minimal-examples/
Re: do some process in the nomatch block of EPL [message #1390543 is a reply to message #1387072] Sun, 29 June 2014 16:29 Go to previous messageGo to next message
Mahsa P is currently offline Mahsa PFriend
Messages: 115
Registered: July 2013
Senior Member
Dear Dimitris,
Thanks for your attention:)

I've prepared one simple example.
I have two meta-model: 1-UML.ecore 2-Class.ecore that these are so simply.
Their models are uml.model and class.model:
http://s200.uploadboy.com:8080/d/wjnfzvb3jdfx3pohiarxtvegxnvj3zrhey3b5ec5qn3p3ebbs6lcivxe/epl.png
In my EPL: I want to access the elements of 'class.model', so I've defined one set with name of 'sources' that contains elements of this model. But I access to first its element just!
The role in EPL is defined based on the 'UML.ecore' and according to the 'uml.model', I have one matched role (one UMLRoot).So I think match block run one time. Therefore I just access to the first element of 'source'.
I select "Repeat while matches are found" but my EPL run one time yet!

Excuse me for my talkativeness! I attach this simple example and I'll embrace your suggestion happily:)

[Updated on: Sun, 29 June 2014 16:30]

Report message to a moderator

Re: do some process in the nomatch block of EPL [message #1390997 is a reply to message #1390543] Mon, 30 June 2014 09:40 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2163
Registered: July 2009
Location: York, UK
Senior Member

Hi Mahsa,

The pattern runs twice. The first time (cont = 0) it matches, while the second (cont=1) it doesn't and as such the matching loop is interrupted - which is the expected behaviour.

Cheers,
Dimitris
Re: do some process in the nomatch block of EPL [message #1391075 is a reply to message #1390997] Mon, 30 June 2014 12:10 Go to previous messageGo to next message
Mahsa P is currently offline Mahsa PFriend
Messages: 115
Registered: July 2013
Senior Member
Hi Dimitris,
Thank you for your useful answer. You are correct, when I set "Repeat while matches are found" to "-1", this is run twice.
In these same cases, is there any way that running continues after the going to nomatch block? I want to be run match's condition for number of 0<=count<=size(source). If there isn't any way for continuing the execution after interrupted matching loop, where I do my processes that must be done in both of onmatch and nomatch condition?
Re: do some process in the nomatch block of EPL [message #1391363 is a reply to message #1391075] Mon, 30 June 2014 20:49 Go to previous messageGo to next message
Dimitris Kolovos is currently offline Dimitris KolovosFriend
Messages: 2163
Registered: July 2009
Location: York, UK
Senior Member

Hi Mahsa,

In every iteration, all patterns are evaluated. If after an iteration no matches are found for any of the patterns, the pattern matching process terminates. Does this answer your question?

Cheers,
Dimitris
Re: do some process in the nomatch block of EPL [message #1391375 is a reply to message #1391363] Mon, 30 June 2014 21:14 Go to previous message
Mahsa P is currently offline Mahsa PFriend
Messages: 115
Registered: July 2013
Senior Member
Hi,

Thanks for your practical answer, Dimitris.
Yes, I got the point:)
I think that I must use other language such as EOL for doing some processes and the control of loop execution.
Regards...

[Updated on: Mon, 30 June 2014 21:15]

Report message to a moderator

Previous Topic:[EOL] Type not found when using registered EPackage
Next Topic:[Flock] ecore:EStringToStringMapEntry
Goto Forum:
  


Current Time: Fri Apr 26 11:30:35 GMT 2024

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

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

Back to the top