|
@@ -965,6 +965,68 @@ Functions
|
|
|
|
|
|
>>> user_name("user1", "user2")
|
|
|
|
|
|
+.. function:: alter_context(model_name, metamodel_name)
|
|
|
+
|
|
|
+ Registers the model *model_name* to be interpreted in the context of *metamodel_name* as its metamodel.
|
|
|
+ All future requests to the model will be made, using the assumption that the model is typed by the specified metamodel.
|
|
|
+ When this is not the case, the request will throw an exception.
|
|
|
+ Most of the time, this call must not be manually made, unless switching between metamodels, or when it is the first time using the model.
|
|
|
+ The context is automatically deduced from the previous commands: adding the model with a specific metamodel, automatically puts the model in that context.
|
|
|
+ When the model is opened for the first time, and it was not created by the client itself (e.g., by someone else, or through a model transformation), the metamodel needs to be specified.
|
|
|
+
|
|
|
+ Examples:
|
|
|
+
|
|
|
+ * To
|
|
|
+
|
|
|
+.. function:: allowed_metamodels(model_name)
|
|
|
+
|
|
|
+ Fetch a set of all metamodels that are registered for *model_name*.
|
|
|
+ This reads out the data in the Modelverse, and will not try to resolve new relations.
|
|
|
+ It is possible for this list to be empty, in case the relation to *Bottom* was removed previously.
|
|
|
+ Otherwise, every model will conform to at least *Bottom*.
|
|
|
+ Other metamodels are optional.
|
|
|
+
|
|
|
+ Examples:
|
|
|
+
|
|
|
+ * To fetch the metamodels to which a PetriNet model conforms, where it is explicitly set that it also conforms to PetriNets which use inhibitor arcs.
|
|
|
+
|
|
|
+ >>> allowed_metamodels("my_pn")
|
|
|
+ ["PetriNets", "Bottom", "PetriNets_Inhibitor"]
|
|
|
+
|
|
|
+ * When all typing relations were explicitly removed.
|
|
|
+
|
|
|
+ >>> allowed_metamodels("my_pn")
|
|
|
+ []
|
|
|
+
|
|
|
+ * Usual situation when there is no metamodel specified.
|
|
|
+
|
|
|
+ >>> allowed_metamodels("my_pn")
|
|
|
+ ["Bottom"]
|
|
|
+
|
|
|
+.. function:: remove_metamodel(model_name, metamodel_name)
|
|
|
+
|
|
|
+ Explicitly removes the conformance relation between *model_name* and *metamodel_name*.
|
|
|
+ It will prevent future uses of this model in the context of this metamodel, though does not prevent future operations from recreating this relation.
|
|
|
+
|
|
|
+ Examples:
|
|
|
+
|
|
|
+ * To remove the PetriNets_Inhibitor metamodel for my_pn.
|
|
|
+
|
|
|
+ >>> remove_metamodel("my_pn", "PetriNets_Inhibitor")
|
|
|
+
|
|
|
+.. function:: add_metamodel(model_name, metamodel_name, partial_type_mapping=None)
|
|
|
+
|
|
|
+ Explicitly add the conformance relation between *model_name* and *metamodel_name*.
|
|
|
+ It creates the relation, and will try to find a type mapping between them automatically.
|
|
|
+ A *partial_type_mapping* can be passed, which will be used as a starting point when searching for a conformance relation.
|
|
|
+ Multiple possible relations might be found, in which case an arbitrary type mapping is taken.
|
|
|
+
|
|
|
+ Examples:
|
|
|
+
|
|
|
+ * To try and make my_pn conform to PetriNets_Inhibitor again; this results in multiple options!
|
|
|
+
|
|
|
+ >>> add_metamodel("my_pn", "PetriNets_Inhibitor")
|
|
|
+
|
|
|
Exceptions
|
|
|
^^^^^^^^^^
|
|
|
|