[gme-users] attribute extraction using the UDM back end

Kevin Smyth ksmyth at isis.vanderbilt.edu
Fri Mar 9 07:31:04 CST 2012


Hi Sumit,

 

Attributes in Udm have the following type():

String, Boolean, Integer, Real, or Text (Text is the same thing as
String)

Attributes may be arrays:

bool attrArray = ((meta.max() != 0) && (meta.max() != 1));

 

UmlExt.h declares  the following functions, which I think address your
other questions 

 

UDM_DLL set<Attribute> AncestorAttributes(const Class &c)

{

                set<Attribute> attributes;

 

                set<Class> ancestors = AncestorClasses(c);

                set<Class>::iterator i = ancestors.begin();

                while( i != ancestors.end() )

                {

                                set<Attribute> a = i->attributes();

                                attributes.insert(a.begin(), a.end());

 

                                ++i;

                }

 

                return attributes;

}

 

 

UDM_DLL set<Class> AncestorClasses(const Class &c)

{

                set<Class> ret;

                ret.insert(c);

 

                set<Class> baseTypes = c.baseTypes();

                set<Class>::iterator i = baseTypes.begin();

                while( i != baseTypes.end() )

                {

                                set<Class> a = AncestorClasses(*i);

                                ret.insert(a.begin(), a.end());

 

                                ++i;

                }

 


                return ret;

}

 

Kevin

 

From: gme-users-bounces at list.isis.vanderbilt.edu
[mailto:gme-users-bounces at list.isis.vanderbilt.edu] On Behalf Of Ray,
Sumit (US SSA)
Sent: Thursday, March 08, 2012 6:38 PM
To: gme-users
Cc: Ray, Sumit (US SSA)
Subject: [gme-users] attribute extraction using the UDM back end

 

Hi,

 

I'm trying to access all of the attributes associated with a <model>
object as well as the types of the attributes using the UDM backend. In
tracing through the backend, I find that both of these methods in
Udm::Object only provide attributes described locally in the <model>
class. 

 


       set<Uml::Attribute> nodeAttr = [Udm::Object
instance].type().Attribute_kind_children();

       set<Uml::Attribute> nodeAttr = [Udm::Object
instance].type().attributes();

 

In particular, these methods do not provide the inherited attributes. I
did not see a method that allows programmatically traversing up the
meta-model inheritance hierarchy. Of course I can cast to the parent
object and then access the attributes, but I am looking for an approach
that is more reflective and allows discovery of the hierarchy at runtime
rather than requiring static knowledge of the hierarchy.

 

Also, the above "attribute retrieval" methods do not provide "type"
information. Is there an interface to get the type of an attribute or is
the recommended approach just calling the type specific attribute
accessor methods?

 

Any suggestions would be useful.

 

Thanks, 

Sumit

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://list.isis.vanderbilt.edu/pipermail/gme-users/attachments/20120309/b6faf5d1/attachment.html 


More information about the gme-users mailing list