On 18 Jul 2007, at 11:17 , Stéphane Ducasse wrote:
That is right
and wrong :)
System is the container for the meta-layers, however there is only
ONE meta-model and ONE meta-meta-model.
I can understand that we have only one MMModel but
I do not understand why I cannot have different MModel.
It seems completely hopeless then that we continue to work on
importing EMF metamodels in Moose.
To answer that, we have to distinguish between Meta and Moose. You
can load multiple Metamodels in Meta, but alas, not in Moose. Let me
elaborate that a bit more:
-------- Meta
Meta.System is a container for one set of Model, MModel and MMModel.
There can be as many System instances as you want, and they may share
all the same MMModel. Similar to a singelton, one selected system is
always the current reference system
System reference
which can be changed using a context oriented scheme
mySystem scopeWhile: [ .... ]
which will make mySystem the reference system within the context of
that block. Let's assume that you want to load two MModels, Famix and
Mushroom, sharing the same MMModel
| famix mushroom |
famix := System withEMOF.
mushroom := famix withSameMetaMetamodel.
famix scopeWhile: [ "...load Famix metamodel here..." ].
mushroom scopeWhile: [ "...load Mushroom metamodel here..." ].
and then you can access for example Mushroom's elements either direct
mushroom metamodel elements
or using the context oriented way
mushroom scopeWhile: [ System reference metamodel elements ]
the you can do the same for models, having multiple mushroom models
| mario luigi |
mario := mushroom withSameMetamodel.
luigi := mushroom withSameMetamodel.
mario scopeWhile: [ "... load a Mushroom model ..." ].
luigi scopeWhile: [ "... load another Mushroom model ...' ].
and again you can access elements direct or via context
mario elements.
mario scopeWhile: [ System reference model elements ].
--------- Moose
Alas, Moose does not use multiple System instances for multiple
Models or MModels. Moose does everything using the default reference
system. Hence all metamodels that you load into Moose are merged into
M2 layer of the default reference system! In other words, you can not
load Metamodels into Moose, you can only extend Moose's default
Metamodel with your custom elements.
By the way, for the models, Moose doesn't even use the default
reference system, but manages its "models" somewhere outside in
custom data containers not related to Meta.
cheers,
AA