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
ok
| 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 ].
Is there a way to know all the loaded MModel beside System
allInstances :)
--------- 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.
hmmmmm
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.
Do you mean that it does not query System withEMOF metamodel elements
but query the metaclasses ?
Stef
cheers,
AA