[great-users] Abort a transformation

Daniel Balasubramanian daniel at isis.vanderbilt.edu
Wed Feb 23 13:32:13 CST 2011


Hi Achim,

> The following transformation might ignore these objects, but the programmer might wish to abort the transformation.

This implies that you have a way inside the transformation to test for the abort condition.
The semantics of GReAT are that if you have a Rule that produces no output packets, then the transformation terminates.  So to terminate the transformation upon a certain condition (like finding isolated cyclic structures) you could do this:

(1) Test for the termination condition in a Test/Case block that uses a Cut so that input packets are not passed to other Cases after a match.
(2) For a successful match (meaning that you do want to terminate) in this block, do not produce any outputs.  Because you have a block not producing any outputs, the transformation will stop.
(3) For a unsuccessful match (meaning that you do not want to terminate), pass the output to the rest of the transformation.

Would this work for you?

Thanks,
Daniel

-----Original Message-----
From: great-users-bounces at list.isis.vanderbilt.edu on behalf of Achim Gädke
Sent: Tue 2/22/2011 2:55 PM
To: great-users
Subject: Re: [great-users] Abort a transformation
 
On 23/02/11 05:07, Daniel Balasubramanian wrote:
> Hi Achim,
>
> If I understand correctly, what you're trying to do is exit the transformation based on some condition, such as a pattern match.  Is this correct?  If so, you could use Test/Case blocks.  Insert a Test block, and put a Case block first that tests the condition for termination.  If that Case is true, then don't have any output ports for that Case (use a "Cut" element, too).  Otherwise, control will fall through to the next Case block in which you could just pass the input straight through to the next rule.
>   
Hi Daniel!

Thanks for the answer. I use test blocks as desribed above frequently to
gain the complement of a match.

Unfortunately, this is not what I was aiming to.

Here is an example:
One might expect a forest structure given by a certain kind of
associations in a model. By labeling the objects successively from the
roots of the trees, one gains the tree-membership of each object. If
there are isolated cyclic structures, these objects have these
associations but won't get a label.

The following transformation might ignore these objects, but the
programmer might wish to abort the transformation - because the model
does not make sense.

Cheers, Achim
_______________________________________________
great-users mailing list
great-users at list.isis.vanderbilt.edu
http://list.isis.vanderbilt.edu/mailman/listinfo/great-users



More information about the great-users mailing list