model.rst 2.1 KB

  1. Model representation
  2. ====================
  3. The internal structure of models is normally not exposed to modellers and language engineers, although this is necessary to operate on models.
  4. For example in the context of activities, there might be a need to operate on the model structure directly, although this should rarely be necessary.
  5. In essence, a model is stored as a dictionary containing at least three entries: *model*, *type_mapping*, and *metamodel*.
  6. We describe each next.
  7. Model
  8. -----
  9. The model entry is again a dictionary, but this time for the elements of the model.
  10. The identifier of each element is used as the key in the dictionary, with the value being the physical node or edge in the graph representing the data.
  11. As such, to resolve the actual node (e.g., to read out the value), the model dictionary must be read as a dictionary.
  12. Note that all parts of the model must have such a dictionary link, as otherwise the model is only partially stored, which could result in errors.
  13. Type Mapping
  14. ------------
  15. The type mapping is again a model, although this one stores the type mapping.
  16. The model has an element with ID *root*, which can be accessed as if it were a dictionary.
  17. This dictionary has keys equal to the elements of the model, and the value for each key represents the ID in the metamodel.
  18. Note that modifications to the type mapping should never be done directly, as the dictionary is itself completely contained in a model.
  19. For that reason, specific typing related operations are provided.
  20. The type mapping model can also be opened as if it were a normal model, conforming to the *formalisms/TypeMapping* metamodel.
  21. In this context, however, only the dictionary part is required and thus no metamodel is loaded for performance reasons.
  22. Metamodel
  23. ---------
  24. The metamodel in the dictionary merely links to another model, which is itself again a dictionary containing at least the *model*, *type_mapping*, and *metamodel* keys.
  25. This keeps going on, until eventually the *metamodel* link is actually a reference to the exact same dictionary.
  26. This thereby enables the meta-circular level.