Browse Source

Some preliminary notes on multi-conformance

Yentl Van Tendeloo 7 years ago
parent
commit
19dd1433d7
1 changed files with 58 additions and 2 deletions
  1. 58 2
      doc/conformance.rst

+ 58 - 2
doc/conformance.rst

@@ -5,12 +5,68 @@ The conformance relation takes a central role in the Modelverse.
 In contrast to most other tools, the conformance relation is, as all other things, explicitly modelled.
 In contrast to most other tools, the conformance relation is, as all other things, explicitly modelled.
 As such, it can be altered quite easily and offers many degrees of flexibility not found in other tools.
 As such, it can be altered quite easily and offers many degrees of flexibility not found in other tools.
 
 
-Many of these dimensions, however, are still work in progres...
+The primary operation to use is *model_types*, which lists the types with which the model is typed::
+
+    >>> model_types("models/my_pn")
+    [("metamodels/PetriNets", "type_mappings/1234", None)]
+
+This operation returns a list containing tuples.
+In the tuple, the first entry denotes the metamodels location in the Modelverse.
+The second entry denotes the type mapping used to conform to this specific metamodel.
+The third and last entry denotes the conformance semantics that is used for this conformance, and will be discussed separately.
+
+The type mapping relation is itself a model, typed by the *formalisms/TypeMapping* metamodel.
+As such, it is possible to open the model denoted over there and even alter it, thereby directly altering the type mapping in the model.
+This is useful in a variety of scenarios, where direct access to the type mapping relation is required.
+
+Note that these conformance relations are the result of the stored links, which might be correct.
+Indeed, the local and global constraints might be invalidated later on, or even in the context of language evolution, where for example the metamodel changes, these relations can be out of date.
+To verify that the relation still holds, users can invoke the *verify* operation with the model and metamodel::
+
+    >>> verify("models/my_pn", "metamodels/PetriNets")
+    "OK"
+
+If the result is the string "OK", everything is fine.
+Otherwise, the string value denotes the error message, which contains the name of the element that violates conformance (e.g., which has no type anymore).
+While the metamodel has to be specified in the verify operation, the type mapping is automatically determined based on the stored information of the *model_types* operation.
 
 
 Multi-Conformance
 Multi-Conformance
 -----------------
 -----------------
 
 
-TODO
+As indicated by the fact that the *model_types* operation returns a list, 
+The Modelverse supports multiple conformance relations to hold simultaneously.
+Upon creation, every model is typed by the metamodel used for its instantiation.
+For example, when creating a PetriNets metamodel::
+
+    >>> model_add("formalisms/PetriNets", "models/my_pn")
+    >>> model_types("models/my_pn")
+    [("metamodels/PetriNets", "type_mappings/1234", None)]
+
+Additionally, different conformance relations can be defined.
+For example, if there is a new metamodel called *formalisms/PetriNets_inhibitor*, it is possible to force a conformance relation there as well::
+
+    >>> conformance_add("models/my_pn", "formalisms/PetriNets_inhibitor")
+    >>> model_types("models/my_pn")
+    [("metamodels/PetriNets", "type_mappings/1234", None),
+     ("metamodels/PetriNets_inhibitor", None, None)]
+
+Although the relation has been added, it cannot be guaranteed that this relation actually holds.
+Indeed, the type mapping model is undefined, meaning that there is no way to verify this relation in itself.
+Therefore, the *conformance_add* operation is only to be used to ensure that the necessary links are created and that it is possible to add a type mapping model or further specify it.
+
+Whenever an operation is being made that opens the model (e.g., instantiation of new elements), a metamodel has to be additionally specified, such that the model can be opened in the correct context.
+In the Python wrapper, this is abstracted to alleviate the user of constantly having to specify the metamodel every operations.
+When an operation is executed that gives information on the metamodel (e.g., *model_add*, *transformation_execute*), this information is stored and used behind the scenes.
+Nonetheless, it is possible that the user wants to switch the context manually.
+This can be done with the *alter_context* operation::
+
+    >>> alter_context("models/my_pn", "formalisms/PetriNets_inhibitor")
+
+Note that this operation executes locally, as it only alleviates the user from having to specify this all the time.
+As such, there is no error checking on the provided parameters.
+
+Tool Semantics
+--------------
 
 
 Metamodel Finding
 Metamodel Finding
 -----------------
 -----------------