[great-dev] Re: [udm-users] RE: [great-users] "Com exception: Object cannot bechanged"

Aditya Agrawal aagrawa at us.ibm.com
Mon Apr 11 17:54:49 CDT 2005


Dear Tivadar,

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.

------
OrderItem.name() = "1";

HouseModel::House type = House.Archetype();

Udm::Object::AssociationInfo inf(NULL); 
inf.strSrcRoleName = "src"; 
inf.strDstRoleName = "dst"; 
House.CreateLink(type, inf);
----

Thanks,
Adi

-----------------------------------
Aditya Agrawal
Researcher
IBM T. J. Watson
mailto:aagrawa at us.ibm.com
+1 (914) 784-6068 (TL 863)


great-users-bounces at list.isis.vanderbilt.edu wrote on 04/11/2005 02:39:16 
PM:

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


More information about the great-users mailing list