[great-users] Re: problem about running the transformation
Aditya Agrawal
aditya.agrawal at gmail.com
Mon Dec 5 09:44:45 CST 2005
Hi Adra,
We did not implement variable cardinality pattern matching because it could
be done using a sequence of rules.
If you want to convert diamonds with 2+ parents then the technique would be
to use three rules. In the first you identify the child grand parent pair
that has a diamond. In the second rule you match exactly one of the parents
and create the inheritance (this can be done by for all = false). In a
third rule you use the child and grand parent to match a parent that hasnt
already been dealt with and create composition and a new abstract class
based inheritance.
I hope that helps.
Adi
_____
From: great-users-bounces at list.isis.vanderbilt.edu
[mailto:great-users-bounces at list.isis.vanderbilt.edu] On Behalf Of Arda
Göknil
Sent: Monday, December 05, 2005 8:32 AM
To: A list for GReAT users to share bugs, fixes and ideas
Subject: RE: [great-users] Re: problem about running the transformation
Hi Aditya and Attila,
Thank you. It realy helped me very much. I changed my transformation
according to your advices. But I can not handle the transformation when the
number of the Parent classes is more than two because of the variable
cardinality constraint. Is there any trick to support the variable
cardinality?
Aditya Agrawal <aditya.agrawal at gmail.com> wrote:
Hi Arda,
As Attila has mentioned doing the entire transformation in one rule will
give you more matches as well create more classes than you would expect.
Some issues that I would like to point out.
You want to create one JClass for each Class there is in UML. This should be
done in a separate rul e. The reason is that diamond matching can give more
matches than the number of classes that are present.
Second, to get to the diamond the Child and the GrandParent should be unique
and the parents should not have two matches. This can be achieved in two
ways.
(1) have one rule that finds the diamond from the child and have a guard
that specifies that the name of parent1 is greater that parent2. This will
give you all unique diamonds.
(2) Have one rule that finds the diamond and it send out the child and
grandparent. Then a second rule uses For All = false this will also give
unique diamonds for a given pair.
Please look at the solution and let me know if you have any further issues.
Thanks,
Adi
_____
From: great-users-bounces at list.isis.vanderbilt.edu
[mailto:great-users-bounces at list.isis.vanderbilt.edu] On Behalf Of Arda
Göknil
Sent: Thursday, December 01, 2005 8:24 AM
To: A list for GReAT users to share bugs, fixes and ideas
Subject: RE: [great-users] Re: problem about run ning the transformation
Hi Aditya,
I got your example. It all works fine but I still could not find what is
wrong in my example. In fact, I am trying to transform diamond multiple
inheritance to single inheritance by using role aggregation (changing
inheritance with aggregation). I am sending my simple transformation and I
will be pleased if you can give an idea about my mistake in the
transformation. (The transformation file is MI2SI.mga)
In my example I have three rules and in the second and third rules I detect
the multiple inheritance in UML model and constitue an aggregation structure
in the Java model.
In the second rule I have two classes Parent Class and MyParent class. The
Pattern cardinality of Parent class is 1..*. Attila said that the current
version does not support the variable pattern cardinality but I have still
problems when the cardinality of Parent class is '1' althought I suppose
that the number of paren t classes in the diamond multiple inheritance is
only 2. If you look at my input model and output model in the 'model'
directory, you will see my problem.
Thanks,
Arda
Aditya Agrawal <aditya.agrawal at gmail.com> wrote:
Hi Arda,
I am attaching a great transfor m that will append _HasMultipleParents to
all the classes that have multiple inheritance.
The transformation file is SimpleUML_umt.mga.
Please let me know if it helps.
Thanks,
Adi
_____
From: great-users-bounces at list.isis.vanderbilt.edu
[mailto:great-users-bounces at list.isis.vanderbilt.edu] On Behalf Of Arda
Göknil
Sent: Tuesday, November 29, 2005 4:25 AM
To: A list for GReAT users to share bugs, fixes and ideas
Subject: Re: [great-users] Re: problem about running the transformation
>>For example, if you want to find out if a class 'Derived' has multiple
>>base classes, then you will specify one Derived pattern object, Derived,
>>and two Base pattern objects: Base1, and Base2. Next connect Base1 and
>>Derived, Base2 and Derived with pattern association representing the
>>inheritance association. Finally, set the 'for all' attribute to false.
>>This rule will find one match if class Derived has multiple base classes
>>of type Base, because each Base pattern object gets bound to a separate
>>unique Base class object in your input model. If Derived has 0 or 1 base
>>class, the rule will find no match.
I set the ForAll attribute to false. But when I have two or more multiple
inheritance cases, it still returns one match. I wa n t to get only one
match in one case. For example If I have two cases, I want to get two
matches. But if I set this attribute to false, I always get one match
although I get more than one multiple inheritance cases.
I think in the second match base2 object pattern binds the base class which
is binded by the base1 object pattern in the first match. And also in the
second match base1 object pattern binds the base class which is binded by
the base2 object pattern in the first match. Does the GReAt allows cross
binding in multiple matches???
Attila Vizhanyo <viza at isis.vanderbilt.edu> wrote:
The myHouse1.mga model contains 6 Room-s and 7 AdjacentTo connections, 5
of which has doors.
The rule effectively counts the number of AdjacentTo connections, and
discards those with attribute 'hasDoor' set to false (see the HasDoor
guard). Then for each match, the rule increments the Quantity counter in
OrderItem.
GReAT does not have any support for variable pattern cardinality, currently.
But you can get the effect of fixed multiple pattern cardinality by
using multiple pattern objects to specify the cardinality.
The GReAT execut ion engine binds each pattern variable to a unique
obj ect in the input model.
For example, if you want to find out if a class 'Derived' has multiple
base classes, then you will specify one Derived pattern object, Derived,
and two Base pattern objects: Base1, and Base2. Next connect Base1 and
Derived, Base2 and Derived with pattern association representing the
inheritance association. Finally, set the 'for all' attribute to false.
This rule will find one match if class Derived has multiple base classes
of type Base, because each Base pattern object gets bound to a separate
unique Base class object in your input model. If Derived has 0 or 1 base
class, the rule will find no match.
The limitation of this solution is that you cannot refer to the base
classes using pattern objects, except Base1 and Base2, which two are
selected in a non-deterministic manner.
However, you can write UDM code to fetch all bases of class Derive d in
an Attribute Mapping block, eg:
set< Base> b ases= Derived.super_classes();
subsitute super_classes with the role name of the inheritance association.
--Attila
Arda Göknil wrote:
> >>In the house2order example the MakeOrder3/MakeOrder rule has its
> >>attribute "For All?" set to false, which means that the pattern
> matching
> >>stops after it found the first match. This is why the MakeOrder rule
> >>will find only one room.
> I mean the third rule in the House2Order example. In the second rule
> the 'ForAll' attribute is set to false as you said. But in the third
> rule, the ForAll attribute is not set to fal se and the quantitiy
> attribute of Order is calculated according to the number of the
> matches and the attribute is five, not ten.
> In my model, I have one parent class and two sub classes. When I run
> my multiple inheritan ce pattern, I expected only one match but there
> are two different matches. When I specify the pattern cardinality of
> child classes as 2..* and the pattern cardinality of parent classes as
> 1, I expect one parent class and at least two child class in one
> match. If there is a second multiple inheritance case in the model, it
> will return in the second match. And in my case when the number of the
> child classes which are inherited from the same class increases, I
> expect the number of the matches not to increase but it also increases.
> Am I missing something?
>
> */Attila Vizhanyo /* wrote:
>
> The pattern cardinality att ribute of pattern objects in GReAT has the
> following semantics:
> - the cardinality attribute set to 0 means negative application
> condition, that is, the pattern matching returns true, if the
> specified
> pattern c ould not be found in the input graph.
> - any other valu e than 0 corresponds to 'positive' application
> condition, with no regard to pattern cardinality. The pattern
> matching
> returns true, if the specified pattern can be fou nd in the input
> graph.
>
> Therefore if you specify any non-zero pattern cardinality, the
> pattern
> matching will return with as many matches as many exists for the
> given
> input and pattern graph.
>
> In the house2order example the MakeOrder3/MakeOrder rule has its
> attribute "For All?" set to false, which means that the pattern
> matching
> stops after it found the first match. This is why the MakeOrder rule< BR>>
will find only one room.
>
> HTH,
> Attila
>
>
>
> Arda Göknil wrote:
>
> > Hi Daniel,
> > It helped me to fix my problem but now I have another problem. I am
> &g t; trying to implement a basic transformation between UML and Java
> models
> > based on very simple UML and Java meta models. In one of my
> rules, I
> > want to define the pattern of multiple inheritance. In my
> structure, I
> > have one class called parent class whose cardinality pattern is
> 2..*
> > and one class called child class whose cardinality pattern is 1.
> These
> > two classes are connected each other via an connection named
> > Inheritance. But in the match of the rule, I have two matches
> instead
> > of one appropriate match for only one multiple inheritance case.
> For
> > example if the model has a parent class and two subclasses, the
> engine
> > returns two matches.
> > I am not sure about the use of cardinality patterns but when I read
> > the Great User Manual, It does not include anything about the
> u se of
> > cardinality patterns. In the House2Order example, there is two Room
> > class in the House2Order example and there is only one match
> insted of
> > two matches if there is two room which have a room. Is it abour the
> > cross productions or something else?
> >
> > */Daniel Balasubramanian /* wrote:
> >
> > Hi Arda,
> >
> > That exception means that one of your input models cannot be
> > opened properly, perhap s because you created it with a certain
> > paradigm, and then somehow modified that paradigm. To correct the
> > error, simply open both of the input models in GME, and it will
> > give you a message s aying something like, "The model is not in the
> > current paradigm, would you like to upgrade?" - say "Yes", and the
> > model will be upgraded to the current paradigm. Save the model,
> > then close GME, and try re-running your transformation. (Be sure
> > to do this for all of your input models)
> >
> > Please let me know if this does not f ix the problem.
> >
> > Thanks,
> > Daniel
> >
> >
> >
> > -----Original Message-----
> > From: great-users-bounces at list.isis.vanderbilt.edu on behalf of
> > Arda Göknil
> > Sent: Thu 11/24/2005 6:27 AM
> > To: great-users
> > Cc:
> > Subject: [great-users] Re: problem about running the transformation
> > Hi,
> > I configure the path ("C:\Progra m Files\Microsoft Visual
> > Studio\VC98\Bin"). And I can run the samples in GREAT but when I
> & gt; try to invoke my example, I get an exception (Exception: Com
> > Exception: The paradigm is not registered). Now what should I do???
> >
> > Attila Vizhanyo wrote:
> >
> > Hi Arda,< BR>> >
> > We have a great-users list, so please direct your great-related
> > questions to great-users at list.isis.vanderbilt.edu.
> >
> > When you run the GReAT Master Interpreter make sure you have a
> > valid config file name (with absolute path) specified in the top
> > of the dialog.
> > Use the R button to generate a config file path that points to
> > the transformation folder.
> > < BR>The problem is not necessarily related to the config file
> > opening process.
> > If you use GReAT with VC6, make sure that the location of
> > vcvars32.bat is in path. (e.g. "C:\Program Files\Microsoft Visual
> > Studio\VC98\Bin")
> > If you use GReAT with VC71, make sure that the location of
> > vcvars32.bat is in path. (e.g. "C:\Program Files\Microsoft Visual
> > Studio .NET 2003\Common7\Tools)
> >
> > HTH,
> & gt; Attila
> >
> > -----Original Message-----
> > From: gme-users-bounces at list.isis.vanderbilt.edu
> > [mailto:gme-users-bounces at list.isis.vanderbilt.edu] On Behalf Of
> > Arda Göknil
> > Sent: Wednesday, November 23, 2005 3:34 AM
> > To: gme-users
> > Subject: [gme-users] problem about running the transformation
> >
> > Hi,
> > I am trying to develop a transformation from UML models to Java
> > models by using Great. (It is my first experience in GREAT.)
> > When I interpret the transformation by using GreAt Master
> > Interpreter, there is no problem. But when I try to invoke the
> > Graph Rewrite Engine, a message box appe ars and throws an
> > exception. (Exception: Com Exception: File co uld not be opened).
> > This exception is thrown when the engine is trying to load the
> > NewConfiguration.mga. How can I solve this problem?
> > And also when I try to to invoke the engine on the House2Order
> > sample of Great, there is an error which tells to add /Vc98/bin
> > directory to system path while the engine is trying to load the
> > config.mga file.
> >
> > Arda Goknil
> >
> >
> > _____
> >
> > To help you stay safe and secure online, we've developed the all
> > new Yahoo! Security Centre.
> >
> >
> >
> > _____
> >
> > Yahoo! Messenger NEW - crystal clear PC to PC calling worldwide
> > with voicemail
> >
> >
> > _______________________________________________
> > great-us ers mailing list
> > great-users at list.isis.vanderbilt.edu
> > http://list.isis.vanderbilt.edu/mailman/listinfo/great-users
> >
> >
> >
> ------------------------------------------------------------------------
> > Yahoo! Model Search
> >
> > - Could you be the next catwalk superstar? Check out the
> competition
> >
> > now
> >
> >------------------------------------------------------------------------
> >
> >_______________________________________________
> >great-users mailing list
> >great-users at list.isis.vanderbilt.edu
> >http://list.isis.vanderbilt.edu/mailman/listinfo/great-users
> >
> >
> _______________________________________________
> great-users mailing list
> great-users at list.isis.vanderbilt.edu
> http://list.isis.vanderbilt.edu/mailman/listinfo/great-users
>
>
> ------------------------------------------------------------------------
> How much free photo storage do you get? Store your holiday snaps for
> FREE wit h Yahoo! Photos. *Get Yahoo! Photos*
>
>
>
>------------------------------------------------------------------------
>
>_______________________________________________
>great-users mailing list
>great-users at list.isis.vanderbilt.edu
>http://list.isis.vanderbilt.edu/mailman/listinfo/great-users
>
>
_______________________________________________
great-users mailing list
great-users at list.isis.vanderbilt.edu
http://list.isis.vanderbilt.edu/mailman/listinfo/great-users
_____
Yahoo!
<http://us.rd.yahoo.com/mail/uk/taglines/default/messenger/*http:/uk.messeng
er.yahoo.com%20%0d%0a> Messenger NEW - crystal clear PC to PC calling
<http://us.rd.yahoo.com/mail/uk/taglines/default/messenger/*http:/uk.messeng
er.yahoo.com%20%0d%0a> worldwide with voicemail
_______________________________________________
great-users mailing list
great-users at list.isis.vanderbilt.edu
http://list.isis.vanderbilt.edu/mailman/listinfo/great-users
_____
Yahoo!
<http://us.rd.yahoo.com/mail/uk/taglines/default/modelsearch/*http:/uk.news.
yahoo.com/hot/model-search/> Model Search - Could you be the next catwalk
superstar? Check out the competition
<http://us.rd.yahoo.com/mail/uk/taglines/default/modelsearch/*http:/uk.news.
yahoo.com/hot/model-search/> now
_______________________________________________
great-users mailing list
great-users at list.isis.vanderbilt.edu
http://list.isis.vanderbilt.edu/mailman/listinfo/great-users
_____
Win
<http://us.rd.yahoo.com/mail/uk/taglines/default/cars/*http:/uk.cars.yahoo.c
om/features/competitions/vespa.html> a Yahoo! Vespa NEW - Yahoo! Cars has 3
Vespa LX125s to be won Enter
<http://us.rd.yahoo.com/mail/uk/taglines/default/cars/*http:/uk.cars.yahoo.c
om/features/competitions/vespa.html> Now!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://list.isis.vanderbilt.edu/pipermail/great-users/attachments/20051205/39ec9ba0/attachment.htm
More information about the great-users
mailing list