Hi,
I have a Smalltalk code with meta description (metamodel* methods). My goal is to get the meta model associated to the code.
the problem: In my code, for each Class, only the attributes and the operations are meta-described (thanks to the class methods : metamodelAttribute1, metamodelOperation1 and so on....). But I have not found the way to obtain the EMOF Class that describes my class.
Is it possible to get a repository that contains all Emof entities that correspond to the elements of my smalltalk code?
Today, I tried to do this with FAMIXModel. e.g, I called the class methods 'metamodelAttribute' 'in FAMIXClass and I got an EMOF entity whose 'owner' was nil!
Moreover, in VisualLauncher class, you define the method mooseStrictFamixMetaModel. In this method, you do: 'package := (Meta.System reference metamodel elementNamed: 'FAMIX')' but it returns nil
thank you for your help!
sara
Hey Sara,
to get the EMOF associated with a Smalltalk class, just write
^Mushroom asMetaDescription
to get a Namespace with all classes, write
Namespace allClasses do: #asMetaDescription. ^Namespace asMetaDescription (the first line is necessary to make sure all classes are initialized and added to the namespace).
Today, I tried to do this with FAMIXModel. e.g, I called the class methods 'metamodelAttribute' 'in FAMIXClass and I got an EMOF entity whos 'owner' was nil!
Never call the metamodel* methods your self, these are callbacks for the Meta framework. For example to access the attribute name 'attribute' in FAMIXClass, just type
FAMIXClass asMetaDescription attributeNamed: 'attribute'
Moreover, in VisualLauncher class, you define the method mooseStrictFamixMetaModel. In this method, you do: 'package := (Meta.System reference metamodel elementNamed: 'FAMIX')' but it returns nil
That code smells, it should read
Meta.PackageLibrary packageNamed: 'FAMIX'
to ensure proper initialization. Hmm, I see there is yet another bug introduced by those $#&!* comments, I'll fix both Meta and Moose right now...
cheers, AA