10.3 The Model
In essence a model is the totality of entities and their inter-relationships from a target system. A MooseModel is a special Group.
The simplest model is the empty one. You can get it by simply instantiating a MooseModel:
MooseModel new.
A model is also an entity, and thus, it can be stored in another model. By default, Moose offers a special root model object that is a singleton and that can be accessed via:
MooseModel root.
The root model is special because by convention it is used to store all other models. It acts as a repository, and its content are displayed in the MoosePanel user interface.
To add your model to the root model, you can simply do:
| myModel |
myModel := MooseModel new.
MooseModel root add: myModel.
Once an entity is placed in a model, it automatically stores the model in an instance variable accessible via mooseModel
. Thus, when a query requires information that is outside of the scope of the entity under study, you can obtain the information from the model.