Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » VIATRA » Looping Structure
Looping Structure [message #1233995] Tue, 21 January 2014 01:29 Go to next message
Huseyin Ergin is currently offline Huseyin ErginFriend
Messages: 4
Registered: January 2014
Junior Member
Hi everyone
I checked some manuals and web pages of viatra2, but couldnt find. Do you know we can do a conditional execution or a loop like structure in viatra2?

Like: If ruleA.success; then apply ruleB, else apply ruleC.
OR: (Apply ruleA, then ruleB) -> do this sequence until one fails (or first one fail)?


By the way, I had a 2006 dated manual pdf, do you know a newer version?

[Updated on: Tue, 21 January 2014 01:30]

Report message to a moderator

Re: Looping Structure [message #1234269 is a reply to message #1233995] Tue, 21 January 2014 15:26 Go to previous message
Abel Hegedus is currently offline Abel HegedusFriend
Messages: 197
Registered: September 2015
Senior Member
There are two ASM functions related to repeated execution, forall and iterate. Combining them with try, if and choose will give you a quite powerful language.
Additionally, while GT rules are supported by VIATRA2, you may be better off using ASM rules instead.

For the example you mentioned:
rule ifAthenBelseC() = seq{
  try call AthenB(); // if AthenC fails, then C is executed
    else call C(); // if C fails, ifAthenBelseC fails as well
}

rule main() = seq{
  iterate call ifAthenBelseC(); // ifAthenBelseC is executed repeatedly, until it fails
}


Finally, for a more recent example set, see our Hello World solution for TTC 2011 in the case studies page.
Previous Topic:Can't Use 'iterate'
Next Topic:basic question on transformation of UML to colored petri net
Goto Forum:
  


Current Time: Thu Apr 25 09:38:07 GMT 2024

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

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

Back to the top