<br><font size=2 face="sans-serif">Dear Tivadar,</font>
<br>
<br><font size=2 face="sans-serif">I don't know why the specific API is
failing but I was able to use the TOMI API to achieve the result you are
interested in.</font>
<br>
<br><font size=2 face="sans-serif">------</font>
<br><font size=2 face="sans-serif">OrderItem.name() = "1";</font>
<br>
<br><font size=2 face="sans-serif">HouseModel::House type = House.Archetype();</font>
<br>
<br><font size=2 face="sans-serif">Udm::Object::AssociationInfo inf(NULL);
</font>
<br><font size=2 face="sans-serif">inf.strSrcRoleName = "src";
</font>
<br><font size=2 face="sans-serif">inf.strDstRoleName = "dst";
</font>
<br><font size=2 face="sans-serif">House.CreateLink(type, inf);</font>
<br><font size=2 face="sans-serif">----</font>
<br>
<br><font size=2 face="sans-serif">Thanks,</font>
<br><font size=2 face="sans-serif">Adi</font>
<br>
<br><font size=2 face="sans-serif">-----------------------------------<br>
Aditya Agrawal<br>
Researcher<br>
IBM T. J. Watson<br>
mailto:aagrawa@us.ibm.com<br>
+1 (914) 784-6068 (TL 863)<br>
</font>
<br>
<br><font size=2><tt>great-users-bounces@list.isis.vanderbilt.edu wrote
on 04/11/2005 02:39:16 PM:<br>
<br>
> Dear All,<br>
> <br>
> Please consider the simple example attached, and tell me what should<br>
> I write into the AttributeMapping box in the 2nd rule so that the
<br>
> final rule matches.<br>
> The example uses the "HouseModel" and "Order"
metas supplied with GReAT.<br>
> <br>
> Please don't forget that in my "real" models the Instance
and <br>
> Archetype are in different folders therefore I don't think I can use<br>
> an association class (or can I?).<br>
> <br>
> Thanks,<br>
> Tivadar<br>
> <br>
> <br>
> -----Original Message-----<br>
> From: Endre Magyari <br>
> Sent: Sunday, April 10, 2005 2:33 PM<br>
> To: Tivadar Szemethy; great-users<br>
> Subject: Re: [great-dev] Re: [udm-users] RE: [great-users] "Com<br>
> exception: Object cannot bechanged"<br>
> <br>
> <br>
> <br>
> > 2) from the same guard/AttrMap create an association (defined
in<br>
> <br>
> > How do I create the association of step 2) ?<br>
> ><br>
> <br>
> From this point of view, an object's archetype has the same
type, so you <br>
> have to create an association between two objects of the same type.
(of <br>
> course- you must have such an association defined in your UML
meta)<br>
> <br>
> <br>
> <br>
> MyClass a; //MyClass is defined in MyClass.h and it is your custom
class<br>
> <br>
> // init. of a<br>
> <br>
> if (a.isInstance())<br>
> {<br>
> MyClass type = a.Archetype();<br>
> <br>
> // if it is a simple association<br>
> a.assoc_role_name() = type;<br>
> //type.assoc_other_role_name() = a; //it works either
way<br>
> <br>
> //if it is an assoc. class based association<br>
> <br>
> MyAssocClass mac;<br>
> //init. of mac<br>
> <br>
> mac.assoc_role_name_end() = a;<br>
> mac.assoc_other_role_name_end() = type;<br>
> <br>
> //a.assoc_other_role_name() = mac; type.assoc_role_name()
= a; //it works <br>
> either way<br>
> };<br>
> <br>
> <br>
> in any case, this works only if you have defined in your Uml meta
diagram <br>
> an association between a MyClass and itself. And if so, you have defined
<br>
> in the generated API, for class MyClass, the accessor functions for
<br>
> getting/setting associations.<br>
> <br>
> <br>
> If you don't have the generated API and you need to do this generically,
<br>
> you can use:<br>
> Udm::ObjectImpl::setAssociation<br>
> Udm::Object::setAssociation<br>
> Udm::Object::CreateLink<br>
> <br>
> functions. I can further help on that, if you don't have access to
the <br>
> domain specific API.<br>
> <br>
> Endre<br>
> <br>
> <br>
> ><br>
> > Endre Magyari wrote:<br>
> ><br>
> >><br>
> >> Then the code is:<br>
> >><br>
> >> Udm::Object o;<br>
> >><br>
> >> if (o.isInstance())<br>
> >> {<br>
> >> //o is an instance, only it's type can be modified<br>
> >> Udm::Object type = o.archetype();<br>
> >> //modify type<br>
> >> }<br>
> >> else<br>
> >> {<br>
> >> //o is not an instance, it's either an normal
object(model, fco,<br>
> >> atom) or a derived object, which can be modified.<br>
> >> //if it's a derived object, isSubtype() returns
true<br>
> >> };<br>
> >><br>
> >><br>
> >><br>
> >> Note that this is generic code, but since all generated types
are<br>
> >> inherited from Udm::Object, isInstance(), isSubtype()
works.<br>
> >> For the generated classes in UDM API there is also available
an<br>
> >> Archetype()call, which is typed, it returns with an object
of the<br>
> >> same type.<br>
> >><br>
> >><br>
> >> Endre<br>
> >><br>
> >><br>
> >><br>
> >> On Fri, 8 Apr 2005 10:20:39 -0500, Attila Vizhanyo<br>
> >> <viza@isis.vanderbilt.edu> wrote:<br>
> >><br>
> >>> Tivadar wants to (1) query if an object is instance or
not (2) if it <br>
> >>> is,<br>
> >>> get access to its type object, and modify the type object.<br>
> >>><br>
> >>><br>
> >>>> -----Original Message-----<br>
> >>>> From: Endre Magyari<br>
> >>>> Sent: Friday, April 08, 2005 2:06<br>
> >>>> To: udm-users<br>
> >>>> Cc: This is a list for GReAT developers to exchange<br>
> >>>> development related thoughts and ideas<br>
> >>>> Subject: [great-dev] Re: [udm-users] RE: [great-users]
"Com<br>
> >>>> exception: Object cannot bechanged"<br>
> >>>><br>
> >>>><br>
> >>>><br>
> >>>><br>
> >>>><br>
> >>>> Attila,<br>
> >>>><br>
> >>>> there is no UDM API which permits to
modify an instance<br>
> >>>> object - besides,<br>
> >>>> Tivadar is talking about a COM exception thrown by
MGA layer.<br>
> >>>> So, what kind of solution did you mean
?<br>
> >>>><br>
> >>>> Thanks,<br>
> >>>> Endre<br>
> >>>><br>
> >>>><br>
> >>>> On Thu, 7 Apr 2005 16:42:22 -0500, Attila Vizhanyo<br>
> >>>> <viza@isis.vanderbilt.edu> wrote:<br>
> >>>><br>
> >>>> > I believe these problems can be solved using
the UDM API<br>
> >>>> from Guard/<br>
> >>>> > AttributeMapping code. I'm forwarding your post
to the<br>
> >>>> udm-users list.<br>
> >>>> ><br>
> >>>> > Thanks,<br>
> >>>> > Attila<br>
> >>>> ><br>
> >>>> ><br>
> >>>> >> -----Original Message-----<br>
> >>>> >> From: Tivadar Szemethy<br>
> >>>> >> Sent: Thursday, April 07, 2005 16:28<br>
> >>>> >> To: great-users<br>
> >>>> >> Subject: [great-users] "Com exception:
Object cannot be changed"<br>
> >>>> >><br>
> >>>> >><br>
> >>>> >> Hello,<br>
> >>>> >><br>
> >>>> >> In a GReAT transformation, I have to make
temporary<br>
> >>>> modifications to<br>
> >>>> >> my src model in order to make further processing
easier. However,<br>
> >>>> >> some of the objects in the src are Instances
(as in General<br>
> >>>> >> Properties/Type in the Attribute Panel in
GME) of other objects<br>
> >>>> >> defined in a "Model Library" folder
in the src model.<br>
> >>>> >><br>
> >>>> >> As I understand, instances cannot be modified.<br>
> >>>> >> Therefore, I need to come up with a GReAT
rule, which:<br>
> >>>> >><br>
> >>>> >> a) checks whether the object in question
is an Instance or not<br>
> >>>> >> b) if it is, returns the corresponding "Template"
object<br>
> >>>> which can be<br>
> >>>> >> modified<br>
> >>>> >><br>
> >>>> >> How do I do this ?<br>
> >>>> >><br>
> >>>> >> Thanks,<br>
> >>>> >><br>
> >>>> >> Tivadar<br>
> >>>> >> _______________________________________________<br>
> >>>> >> great-users mailing list great-users@list.isis.vanderbilt.edu<br>
> >>>> >> http://list.isis.vanderbilt.edu/mailman/listinfo/great-users<br>
> >>>> >><br>
> >>>> > _______________________________________________<br>
> >>>> > udm-users mailing list<br>
> >>>> > udm-users@list.isis.vanderbilt.edu<br>
> >>>> > http://list.isis.vanderbilt.edu/mailman/listinfo/udm-users<br>
> >>>><br>
> >>>><br>
> >>>> _______________________________________________<br>
> >>>> great-dev mailing list<br>
> >>>> great-dev@list.isis.vanderbilt.edu<br>
> >>>> http://list.isis.vanderbilt.edu/mailman/listinfo/great-dev<br>
> >>>><br>
> >>> _______________________________________________<br>
> >>> great-dev mailing list<br>
> >>> great-dev@list.isis.vanderbilt.edu<br>
> >>> http://list.isis.vanderbilt.edu/mailman/listinfo/great-dev<br>
> >><br>
> >><br>
> >><br>
> ><br>
> ><br>
> <br>
> <br>
> [attachment "HouseEx.mga" deleted by Aditya Agrawal/Watson/IBM]
<br>
> [attachment "Transf.mga" deleted by Aditya Agrawal/Watson/IBM]
<br>
> _______________________________________________<br>
> great-users mailing list<br>
> great-users@list.isis.vanderbilt.edu<br>
> http://list.isis.vanderbilt.edu/mailman/listinfo/great-users<br>
</tt></font>