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