|
@@ -79,15 +79,15 @@ Functions
|
|
|
|
|
|
* To create a new model called PetriNets, conforming to SimpleClassDiagrams, and load the model stored in models/PetriNets.mvc.
|
|
|
|
|
|
- >>> model_add("PetriNets", "SimpleClassDiagrams", open("models/PetriNets.mvc", "r").read())
|
|
|
+ >>> model_add("formalisms/PetriNets", "formalisms/SimpleClassDiagrams", open("models/PetriNets.mvc", "r").read())
|
|
|
|
|
|
* To create a minimal instance of the language afterwards, which only contains a single place (and no attributes).
|
|
|
|
|
|
- >>> model_add("my_pn", "PetriNets", "Place p1 {}")
|
|
|
+ >>> model_add("models/my_pn", "formalisms/PetriNets", "Place p1 {}")
|
|
|
|
|
|
* To create a less minimal instance of the language, stored in models/my_pn2.mvc.
|
|
|
|
|
|
- >>> model_add("my_pn2", "PetriNets", open("models/my_pn2.mvc", "r").read())
|
|
|
+ >>> model_add("models/my_pn2", "formalisms/PetriNets", open("models/my_pn2.mvc", "r").read())
|
|
|
|
|
|
.. function:: upload_code(code)
|
|
|
|
|
@@ -115,50 +115,60 @@ Functions
|
|
|
|
|
|
* To delete a previously created model.
|
|
|
|
|
|
- >>> model_delete("my_pn2")
|
|
|
+ >>> model_delete("models/my_pn2")
|
|
|
|
|
|
* Or to delete a metamodel, which is itself just a model.
|
|
|
|
|
|
- >>> model_delete("PetriNets")
|
|
|
+ >>> model_delete("formalisms/PetriNets")
|
|
|
|
|
|
-.. function:: model_list()
|
|
|
+ * To delete a full folder.
|
|
|
|
|
|
- Returns a list of all models existing in the Modelverse, together with their type.
|
|
|
+ >>> model_delete("formalisms")
|
|
|
+
|
|
|
+.. function:: model_list(location)
|
|
|
+
|
|
|
+ Returns a list of all models existing in the specified folder.
|
|
|
+ Sub-folders can be recognized because they have a trailing forward slash in their name.
|
|
|
|
|
|
Examples:
|
|
|
|
|
|
- * To get a list of all currently present models.
|
|
|
+ * To get a list of all models in the formalisms directory.
|
|
|
|
|
|
- >>> model_list()
|
|
|
- [("my_pn", "PetriNets"), ("my_pn2", "PetriNets"), ("PetriNets", "SimpleClassDiagrams"), ("SimpleClassDiagrams", "SimpleClassDiagrams")]
|
|
|
+ >>> model_list("formalisms")
|
|
|
+ ["PetriNets", "SimpleClassDiagrams", "Bottom", "Tracability", ...]
|
|
|
|
|
|
-.. function:: model_list_full()
|
|
|
+.. function:: model_list_full(location)
|
|
|
|
|
|
- Returns a detailed list of all models existing in the Modelverse.
|
|
|
+ Returns a detailed list of all models existing in the specified folder in the Modelverse.
|
|
|
This list includes information on permissions, owner, and group.
|
|
|
|
|
|
Examples:
|
|
|
|
|
|
* To get a detailed list of all currently present models.
|
|
|
|
|
|
- >>> model_list_full()
|
|
|
- [("my_pn", "PetriNets", "user1", "users", "200"), ("my_pn2", "PetriNets", "user1", "users", "200"), ("PetriNets", "SimpleClassDiagrams", "user1", "users", "211"), ("SimpleClassDiagrams", "SimpleClassDiagrams", "admin", "admin", "211")]
|
|
|
+ >>> model_list_full("models")
|
|
|
+ [("my_pn", "user1", "users", "200"), ("my_pn2", "user1", "users", "200"), ...]
|
|
|
|
|
|
-.. function:: verify(model_name)
|
|
|
+.. function:: verify(model_name, metamodel_name)
|
|
|
|
|
|
- Verify whether *model_name* conforms to its specified metamodel, as stored in the Modelverse.
|
|
|
+ Verify whether *model_name* conforms to *metammodel_name*, as both stored in the Modelverse.
|
|
|
Returns either "OK" if the model conforms, or a string specifying the reason for non-conformance.
|
|
|
|
|
|
Examples:
|
|
|
|
|
|
* Verifying a conforming model.
|
|
|
|
|
|
- >>> verify("PetriNets")
|
|
|
+ >>> verify("formalisms/PetriNets", "formalisms/SimpleClassDiagrams")
|
|
|
+ OK
|
|
|
+
|
|
|
+ * Or verify using the alternative conformance relation (conformance bottom).
|
|
|
+
|
|
|
+ >>> verify("formalisms/PetriNets", "formalisms/Bottom")
|
|
|
OK
|
|
|
|
|
|
* Verifying a non-conforming model.
|
|
|
|
|
|
- >>> verify("my_pn")
|
|
|
+ >>> verify("models/my_pn")
|
|
|
Lower cardinality violation for attribute "name" at Place p1.
|
|
|
|
|
|
.. function:: model_overwrite(model_name, new_model_code=None)
|
|
@@ -171,11 +181,11 @@ Functions
|
|
|
|
|
|
* To overwrite the PetriNets metamodel with a newer version, thereby also updating the metamodel of all existing instances ("my_pn" and "my_pn2").
|
|
|
|
|
|
- >>> model_overwrite("PetriNets", open("models/PetriNets2.mvc", "r").read())
|
|
|
+ >>> model_overwrite("formalisms/PetriNets", open("models/PetriNets2.mvc", "r").read())
|
|
|
|
|
|
* To overwrite an existing PetriNets instance.
|
|
|
|
|
|
- >>> model_overwrite("my_pn", """Place p2 {}""")
|
|
|
+ >>> model_overwrite("models/my_pn", """Place p2 {}""")
|
|
|
|
|
|
.. function:: user_logout()
|
|
|
|
|
@@ -213,7 +223,7 @@ Functions
|
|
|
|
|
|
* To render the PetriNets instance using the PetriNetsMapper.
|
|
|
|
|
|
- >>> model_render("my_pn", "PetriNetsMapper")
|
|
|
+ >>> model_render("models/my_pn", "formalisms/PetriNetsMapper")
|
|
|
[{"id": "__12345", "type": "Ellipse", "x": 100, "y": 150, "height": 20, "width: "20"}]
|
|
|
|
|
|
.. function:: transformation_between(source, target)
|
|
@@ -225,7 +235,7 @@ Functions
|
|
|
|
|
|
* To fetch all endogenous transformations on PetriNets, assuming that some were previously defined.
|
|
|
|
|
|
- >>> transformation_between("PetriNets", "PetriNets")
|
|
|
+ >>> transformation_between("formalisms/PetriNets", "formalisms/PetriNets")
|
|
|
["PN_simulate", "PN_optimize"]
|
|
|
|
|
|
* To fetch all transformations from a DSL to PetriNets, assuming that multiple people created different denotational semantics.
|
|
@@ -249,18 +259,18 @@ Functions
|
|
|
|
|
|
* To create a new model transformation for PetriNets simulation.
|
|
|
|
|
|
- >>> transformation_add_MT({"pn": "PetriNets"}, {"pn": "PetriNets"}, "pn_simulate", open("models/PN_simulate.mvc", "r").read())
|
|
|
+ >>> transformation_add_MT({"pn": "formalisms/PetriNets"}, {"pn": "formalisms/PetriNets"}, "models/pn_simulate", open("models/PN_simulate.mvc", "r").read())
|
|
|
|
|
|
* To create a model transformation from a DSL to PetriNets, which requires tracability links.
|
|
|
|
|
|
>>> def tracability_links():
|
|
|
... instantiate("Association", ID="Tile2Place", ("dsl/Tile", "pn/Place"))
|
|
|
... instantiate("Association", ID="Dirrection2Transition", ("dsl/Direction", "pn/Transition"))
|
|
|
- >>> transformation_add_MT({"dsl": "RPGame"}, {"pn": "PetriNets"}, "denotational_1", open("models/denotational_1.mvc", "r").read(), tracability_links)
|
|
|
+ >>> transformation_add_MT({"dsl": "formalisms/RPGame"}, {"pn": "formalisms/PetriNets"}, "models/denotational_1", open("models/denotational_1.mvc", "r").read(), tracability_links)
|
|
|
|
|
|
* To create a multi-input model transformation.
|
|
|
|
|
|
- >>> transformation_add_MT({"pn_1": "PetriNets", "pn_2": "PetriNets", "architecture: "Architecture"}, {"result": "PetriNets"}, "PN_merge", open("models/PN_merge.mvc", "r").read())
|
|
|
+ >>> transformation_add_MT({"pn_1": "formalisms/PetriNets", "pn_2": "formalisms/PetriNets", "architecture: "formalisms/Architecture"}, {"result": "formalisms/PetriNets"}, "models/PN_merge", open("models/PN_merge.mvc", "r").read())
|
|
|
|
|
|
.. function:: transformation_add_AL(source_metamodels, target_metamodels, operation_name, code, callback=lambda: None)
|
|
|
|
|
@@ -272,13 +282,13 @@ Functions
|
|
|
|
|
|
* To create a new action language operation for PetriNets reachability analysis.
|
|
|
|
|
|
- >>> transformation_add_AL({"pn": "PetriNets"}, {"graph": "ReachabilityGraph"}, "pn_analyze", open("models/PN_reachability.alc", "r").read())
|
|
|
+ >>> transformation_add_AL({"pn": "formalisms/PetriNets"}, {"graph": "formalisms/ReachabilityGraph"}, "models/pn_analyze", open("models/PN_reachability.alc", "r").read())
|
|
|
|
|
|
* To create an action language operation from a Scheduling DSL to a list, which requires tracability links.
|
|
|
|
|
|
>>> def tracability_links():
|
|
|
... instantiate("Association", ID="Task2Event", ("schedule/Task", "list/Event"))
|
|
|
- >>> transformation_add_AL({"schedule": "SchedulingDSL"}, {"list": "EventList"}, "sequentialize", open("models/sequentialize_schedule.alc", "r").read(), tracability_links)
|
|
|
+ >>> transformation_add_AL({"schedule": "formalisms/SchedulingDSL"}, {"list": "formalisms/EventList"}, "models/sequentialize", open("models/sequentialize_schedule.alc", "r").read(), tracability_links)
|
|
|
|
|
|
.. function:: transformation_add_MANUAL(source_metamodels, target_metamodels, operation_name, callback=lambda: None)
|
|
|
|
|
@@ -289,11 +299,11 @@ Functions
|
|
|
|
|
|
* To create a manual refinement operation on PetriNets.
|
|
|
|
|
|
- >>> transformation_add_MANUAL({"pn": "PetriNets"}, {"pn": "PetriNets"}, "pn_refine")
|
|
|
+ >>> transformation_add_MANUAL({"pn": "formalisms/PetriNets"}, {"pn": "formalisms/PetriNets"}, "models/pn_refine")
|
|
|
|
|
|
* To create a multi-input refinement operation on PetriNets.
|
|
|
|
|
|
- >>> transformation_add_MANUAL({"pn": "PetriNets", "requirements": "Requirements"}, {"pn": "PetriNets"}, "pn_refine_req")
|
|
|
+ >>> transformation_add_MANUAL({"pn": "formalisms/PetriNets", "requirements": "formalisms/Requirements"}, {"pn": "formalisms/PetriNets"}, "models/pn_refine_req")
|
|
|
|
|
|
.. function:: transformation_execute_AL(operation_name, input_models_dict, output_models_dict, callback=lambda i: None)
|
|
|
|
|
@@ -307,14 +317,14 @@ Functions
|
|
|
|
|
|
* To execute reachability analysis on an existing petri net.
|
|
|
|
|
|
- >>> transformation_execute_AL("pn_analyze", {"pn": "my_pn"}, {"graph": "my_pn_reachability"})
|
|
|
+ >>> transformation_execute_AL("models/pn_analyze", {"pn": "models/my_pn"}, {"graph": "models/my_pn_reachability"})
|
|
|
|
|
|
* To execute reachability analysis which prompts the user, for example because it is a debugging prompt.
|
|
|
|
|
|
>>> def callback(value):
|
|
|
... print(value) # Prints out the prompt of the execution of the Action Language fragment
|
|
|
... return raw_input() # Sends a raw request from the user to the Modelverse, consumed in the Action Language
|
|
|
- >>> transformation_execute_AL("pn_simulate", {"pn": "my_pn"}, {"graph": "my_pn_reachability"}, callback)
|
|
|
+ >>> transformation_execute_AL("models/pn_simulate", {"pn": "models/my_pn"}, {"graph": "models/my_pn_reachability"}, callback)
|
|
|
|
|
|
.. function:: transformation_execute_MANUAL(operation_name, input_models_dict, output_models_dict, callback=lambda i: None)
|
|
|
|
|
@@ -331,7 +341,7 @@ Functions
|
|
|
... p1 = instantiate(None, "pn/Place")
|
|
|
... t1 = instantiate(None, "pn/Transition")
|
|
|
... instantiate(None, "pn/P2T", (p1, t1))
|
|
|
- >>> transformation_execute_MANUAL("pn_refine", {"pn": "my_pn"}, {"pn": "my_pn"}, callback)
|
|
|
+ >>> transformation_execute_MANUAL("models/pn_refine", {"pn": "models/my_pn"}, {"pn": "models/my_pn"}, callback)
|
|
|
|
|
|
.. function:: transformation_execute_MT(operation_name, input_models_dict, output_models_dict, callback=lambda i: None)
|
|
|
|
|
@@ -342,25 +352,14 @@ Functions
|
|
|
|
|
|
* To execute a model transformation on a PetriNets instance, thereby putting the result in a different model.
|
|
|
|
|
|
- >>> transformation_execute_MT("pn_simulate", {"pn": "my_pn"}, {"pn": "my_simulated_pn"})
|
|
|
+ >>> transformation_execute_MT("models/pn_simulate", {"pn": "models/my_pn"}, {"pn": "models/my_simulated_pn"})
|
|
|
|
|
|
* To execute a model transformation which prompts the user.
|
|
|
|
|
|
>>> def callback(value):
|
|
|
... print(value)
|
|
|
... return raw_input()
|
|
|
- >>> transformation_execute_MT("pn_simulate_prompt", {"pn": "my_pn"}, {"pn": "my_simulated_pn"}, callback)
|
|
|
-
|
|
|
-.. function:: transformation_list()
|
|
|
-
|
|
|
- Returns a list of all operations specified in the Modelverse, together with their type.
|
|
|
-
|
|
|
- Examples:
|
|
|
-
|
|
|
- * To fetch a list of all transformations and their type of operation.
|
|
|
-
|
|
|
- >>> transformation_list()
|
|
|
- [("pn_simulate", "ModelTransformation"), ("pn_reachability", "ActionLanguage"), ("pn_simulate_prompt", "ModelTransformation"), ("pn_refine", "ManualOperation")]
|
|
|
+ >>> transformation_execute_MT("models/pn_simulate_prompt", {"pn": "models/my_pn"}, {"pn": "models/my_simulated_pn"}, callback)
|
|
|
|
|
|
.. function:: process_execute(process_name, prefix, callbacks)
|
|
|
|
|
@@ -374,7 +373,7 @@ Functions
|
|
|
|
|
|
* To execute a process model for the power window example.
|
|
|
|
|
|
- >>> process_execute("pm_powerwindow", "pw_")
|
|
|
+ >>> process_execute("models/pm_powerwindow", "pw_")
|
|
|
|
|
|
* To execute a process model for the power window example, which requires user input for some operations.
|
|
|
|
|
@@ -392,7 +391,7 @@ Functions
|
|
|
... # Do some operation on the safety query model here
|
|
|
... p1 = instantiate(None, "Place")
|
|
|
... attr_assign(None, p1, "tokens", 2)
|
|
|
- >>> process_execute("pm_powerwindow", "pw_", {"refine_plant": refine_plant, "refine_control": refine_control, "refine_query": refine_query})
|
|
|
+ >>> process_execute("models/pm_powerwindow", "pw_", {"models/refine_plant": refine_plant, "models/refine_control": refine_control, "models/refine_query": refine_query})
|
|
|
|
|
|
.. function:: permission_modify(model_name, permissions)
|
|
|
|
|
@@ -406,11 +405,11 @@ Functions
|
|
|
|
|
|
* To modify the permissions of the PetriNets metamodel, allowing only the owner to read and write to it.
|
|
|
|
|
|
- >>> permission_modify("PetriNets", "200")
|
|
|
+ >>> permission_modify("formalisms/PetriNets", "200")
|
|
|
|
|
|
* To modify the permissions of a PetriNets model, granting everyone read/write access.
|
|
|
|
|
|
- >>> permission_modify("PetriNets", "222")
|
|
|
+ >>> permission_modify("formalisms/PetriNets", "222")
|
|
|
|
|
|
.. function:: permission_owner(model_name, owner)
|
|
|
|
|
@@ -421,7 +420,7 @@ Functions
|
|
|
|
|
|
* To change the owning user of the PetriNets metamodel to user2.
|
|
|
|
|
|
- >>> permission_owner("PetriNets", "user2")
|
|
|
+ >>> permission_owner("formalisms/PetriNets", "user2")
|
|
|
|
|
|
.. function:: permission_group(model_name, group)
|
|
|
|
|
@@ -432,7 +431,7 @@ Functions
|
|
|
|
|
|
* To change the owning group of the PetriNets metamodel to group1.
|
|
|
|
|
|
- >>> permission_group("PetriNets", "group1")
|
|
|
+ >>> permission_group("formalisms/PetriNets", "group1")
|
|
|
|
|
|
.. function:: group_create(group_name)
|
|
|
|
|
@@ -530,7 +529,7 @@ Functions
|
|
|
|
|
|
* To get a list of all elements in the PetriNets metamodel.
|
|
|
|
|
|
- >>> element_list("PetriNets")
|
|
|
+ >>> element_list("formalisms/PetriNets")
|
|
|
[("Place", "Class"), ("Transition", "Class"), ("P2T", "Association"), ("T2P", "Association"), ...]
|
|
|
|
|
|
.. function:: types(model_name)
|
|
@@ -543,7 +542,7 @@ Functions
|
|
|
|
|
|
* To get a list of all types usable in the PetriNets metamodel (i.e., when altering the metamodel itself).
|
|
|
|
|
|
- >>> types("PetriNets")
|
|
|
+ >>> types("formalisms/PetriNets")
|
|
|
["Class", "Association", "SimpleAttribute", ...]
|
|
|
|
|
|
.. function:: types_full(model_name)
|
|
@@ -555,7 +554,7 @@ Functions
|
|
|
|
|
|
* To get a list of all types usable in the PetriNets metamodel (i.e., when altering the metamodel itself).
|
|
|
|
|
|
- >>> types("PetriNets")
|
|
|
+ >>> types("formalisms/PetriNets")
|
|
|
["Class", "Association", "SimpleAttribute", "__12345", ...]
|
|
|
|
|
|
.. function:: read(model_name, ID)
|
|
@@ -567,12 +566,12 @@ Functions
|
|
|
|
|
|
* To read out the P2T link in the PetriNets metamodel.
|
|
|
|
|
|
- >>> read("PetriNets", "P2T")
|
|
|
+ >>> read("formalisms/PetriNets", "P2T")
|
|
|
["Association", ("Place", "Transition")]
|
|
|
|
|
|
* To read out the Place node in the PetriNets metamodel.
|
|
|
|
|
|
- >>> read("PetriNets", "Place")
|
|
|
+ >>> read("formalisms/PetriNets", "Place")
|
|
|
["Class", None]
|
|
|
|
|
|
* To read out some P2T instance in a PetriNets model.
|
|
@@ -595,12 +594,12 @@ Functions
|
|
|
|
|
|
* To read out the attributes of the Place class.
|
|
|
|
|
|
- >>> read_attrs("PetriNets", "Place")
|
|
|
+ >>> read_attrs("formalisms/PetriNets", "Place")
|
|
|
{"lower_cardinality": None, "upper_cardinality": None}
|
|
|
|
|
|
* To read out the attributes of a Place instance.
|
|
|
|
|
|
- >>> read_attrs("my_pn", "p1")
|
|
|
+ >>> read_attrs("models/my_pn", "p1")
|
|
|
{"name": "critical_section", "tokens": 1}
|
|
|
|
|
|
.. function:: instantiate(model_name, typename, edge=None, ID="")
|
|
@@ -615,29 +614,29 @@ Functions
|
|
|
|
|
|
* To create a new Place instance in a PetriNets model.
|
|
|
|
|
|
- >>> instantiate("my_pn", "Place")
|
|
|
+ >>> instantiate("models/my_pn", "Place")
|
|
|
"__12345"
|
|
|
|
|
|
* To create a new Place instance with a preferred ID, which is granted.
|
|
|
|
|
|
- >>> instantiate("my_pn", "Place", ID="critical_section")
|
|
|
+ >>> instantiate("models/my_pn", "Place", ID="critical_section")
|
|
|
"critical_section"
|
|
|
|
|
|
* To create a new Place instance with a preferred ID, which is not granted.
|
|
|
|
|
|
- >>> instantiate("my_pn", "Place", ID="critical_section")
|
|
|
+ >>> instantiate("models/my_pn", "Place", ID="critical_section")
|
|
|
critical_section_12345"
|
|
|
|
|
|
* To create a new P2T instance in a PetriNets model.
|
|
|
|
|
|
- >>> instantiate("my_pn", "P2T", ("p1", "t1"))
|
|
|
+ >>> instantiate("models/my_pn", "P2T", ("p1", "t1"))
|
|
|
"__12345"
|
|
|
|
|
|
* To create a new concept in the PetriNets metamodel, which can later on be used in all instances immediately.
|
|
|
|
|
|
- >>> instantiate("PetriNets", "Association", ("Place", "Transition"), ID="InhibitorArc")
|
|
|
+ >>> instantiate("formalisms/PetriNets", "Association", ("Place", "Transition"), ID="InhibitorArc")
|
|
|
"InhibitorArc"
|
|
|
- >>> instantiate("my_pn", "InhibitorArc", ("p1", "t1"))
|
|
|
+ >>> instantiate("models/my_pn", "InhibitorArc", ("p1", "t1"))
|
|
|
"__12345"
|
|
|
|
|
|
.. function:: delete_element(model_name, ID)
|
|
@@ -649,16 +648,16 @@ Functions
|
|
|
|
|
|
* To delete an existing element in a PetriNets model.
|
|
|
|
|
|
- >>> delete_element("my_pn", "critical_section")
|
|
|
+ >>> delete_element("models/my_pn", "critical_section")
|
|
|
|
|
|
* To delete an existing exdge in a PetriNets model.
|
|
|
|
|
|
- >>> delete_element("my_pn", "p1_to_t1")
|
|
|
+ >>> delete_element("models/my_pn", "p1_to_t1")
|
|
|
|
|
|
* When deleting an element "p1", the arc "p1_to_t1" is also removed automatically.
|
|
|
|
|
|
- >>> delete_element("my_pn", "p1")
|
|
|
- >>> delete_element("my_pn", "p1_to_t1")
|
|
|
+ >>> delete_element("models/my_pn", "p1")
|
|
|
+ >>> delete_element("models/my_pn", "p1_to_t1")
|
|
|
UnknownIdentifierException("p1_to_t1")
|
|
|
|
|
|
.. function:: attr_assign(model_name, ID, attr, value)
|
|
@@ -670,12 +669,12 @@ Functions
|
|
|
|
|
|
* To assign some attributes to a Place instance.
|
|
|
|
|
|
- >>> attr_assign("my_pn", "p1", "name", "my first place")
|
|
|
- >>> attr_assign("my_pn", "p1", "tokens", 1)
|
|
|
+ >>> attr_assign("models/my_pn", "p1", "name", "my first place")
|
|
|
+ >>> attr_assign("models/my_pn", "p1", "tokens", 1)
|
|
|
|
|
|
* To assign some attributes to the Place class itself.
|
|
|
|
|
|
- >>> attr_assign("PetriNets", "Place", "upper_cardinality", 1)
|
|
|
+ >>> attr_assign("formalisms/PetriNets", "Place", "upper_cardinality", 1)
|
|
|
|
|
|
.. function:: attr_assign_code(model_name, ID, attr, code)
|
|
|
|
|
@@ -687,7 +686,7 @@ Functions
|
|
|
|
|
|
* To assign a piece of action code to a Statecharts transition, loaded from file.
|
|
|
|
|
|
- >>> attr_assign_code("my_sc", "t1", "script", open("models/t1_script", "r").read())
|
|
|
+ >>> attr_assign_code("models/my_sc", "t1", "script", open("models/t1_script", "r").read())
|
|
|
|
|
|
* To assign a piece of action code to a Statecharts transition, defined inline.
|
|
|
|
|
@@ -697,7 +696,7 @@ Functions
|
|
|
... dict_overwrite(attributes, "counter", 1)
|
|
|
... return!
|
|
|
... """
|
|
|
- >>> attr_assign_code("my_sc", "t1", "script", code)
|
|
|
+ >>> attr_assign_code("models/my_sc", "t1", "script", code)
|
|
|
|
|
|
.. function:: attr_delete(model_name, ID, attr)
|
|
|
|
|
@@ -709,7 +708,7 @@ Functions
|
|
|
|
|
|
* To unset the name attribute of a place.
|
|
|
|
|
|
- >>> attr_delete("my_pn", "p1", "name")
|
|
|
+ >>> attr_delete("models/my_pn", "p1", "name")
|
|
|
|
|
|
.. function:: read_outgoing(model_name, ID, typename)
|
|
|
|
|
@@ -721,12 +720,12 @@ Functions
|
|
|
|
|
|
* To get all arcs starting in place p1.
|
|
|
|
|
|
- >>> read_outgoing("my_pn", "p1", "P2T")
|
|
|
+ >>> read_outgoing("models/my_pn", "p1", "P2T")
|
|
|
["p1_to_t1"]
|
|
|
|
|
|
* To get all allowed connections starting in a Place.
|
|
|
|
|
|
- >>> read_outgoing("PetriNets", "Place", "Association")
|
|
|
+ >>> read_outgoing("formalisms/PetriNets", "Place", "Association")
|
|
|
["P2T", "InhibitorArc"]
|
|
|
|
|
|
.. function:: read_incoming(model_name, ID, typename)
|
|
@@ -739,12 +738,12 @@ Functions
|
|
|
|
|
|
* To get all arcs going to place p1.
|
|
|
|
|
|
- >>> read_incoming("my_pn", "p1", "T2P")
|
|
|
+ >>> read_incoming("models/my_pn", "p1", "T2P")
|
|
|
["t1_to_p1"]
|
|
|
|
|
|
* To get all allowed connections going to a Place.
|
|
|
|
|
|
- >>> read_incoming("PetriNets", "Place", "Association")
|
|
|
+ >>> read_incoming("formalisms/PetriNets", "Place", "Association")
|
|
|
["T2P"]
|
|
|
|
|
|
.. function:: read_association_source(model_name, ID)
|
|
@@ -755,12 +754,12 @@ Functions
|
|
|
|
|
|
* To read out the source of the P2T link.
|
|
|
|
|
|
- >>> read_association_source("PetriNets", "P2T")
|
|
|
+ >>> read_association_source("formalisms/PetriNets", "P2T")
|
|
|
"Place"
|
|
|
|
|
|
* To read out the source of an arc.
|
|
|
|
|
|
- >>> read_association_source("my_pn", "p1_to_t1")
|
|
|
+ >>> read_association_source("models/my_pn", "p1_to_t1")
|
|
|
"p1"
|
|
|
|
|
|
.. function:: read_association_destination(model_name, ID)
|
|
@@ -771,12 +770,12 @@ Functions
|
|
|
|
|
|
* To read out the target of the P2T link.
|
|
|
|
|
|
- >>> read_association_destination("PetriNets", "P2T")
|
|
|
+ >>> read_association_destination("formalisms/PetriNets", "P2T")
|
|
|
"Transition"
|
|
|
|
|
|
* To read out the target of an arc.
|
|
|
|
|
|
- >>> read_association_destination("my_pn", "p1_to_t1")
|
|
|
+ >>> read_association_destination("models/my_pn", "p1_to_t1")
|
|
|
"t1"
|
|
|
|
|
|
.. function:: service_register(name, function)
|
|
@@ -868,8 +867,8 @@ Functions
|
|
|
|
|
|
* To read out the signature of the "plant_refine" operation.
|
|
|
|
|
|
- >>> transformation_read_signature("plant_refine")
|
|
|
- ({"req": "Requirements", "plant": "Plant"}, {"plant": "Plant"})
|
|
|
+ >>> transformation_read_signature("models/plant_refine")
|
|
|
+ ({"req": "formalisms/Requirements", "plant": "formalisms/Plant"}, {"plant": "formalisms/Plant"})
|
|
|
|
|
|
.. function:: element_list_nice(model_name)
|
|
|
|
|
@@ -881,7 +880,7 @@ Functions
|
|
|
|
|
|
* To read out a list of a PetriNets instance model.
|
|
|
|
|
|
- >>> element_list_nice("my_pn")
|
|
|
+ >>> element_list_nice("models/my_pn")
|
|
|
[{"id": "p1", "name": "a place", "tokens": 1}, {"id": "t1", "name": "a transition"}, {"id": "p1_to_t1", "name": "transition", "__source": "p1", "__target": "t1", "weight": 1}]
|
|
|
|
|
|
.. function:: connections_between(model_name, source_element, target_element)
|
|
@@ -893,12 +892,12 @@ Functions
|
|
|
|
|
|
* To read out the allowed connections between elements "p1" and "t1".
|
|
|
|
|
|
- >>> connections_between("my_pn", "p1", "t1")
|
|
|
+ >>> connections_between("models/my_pn", "p1", "t1")
|
|
|
["P2T"]
|
|
|
|
|
|
* To read out the allowed connections from the Place class to itself.
|
|
|
|
|
|
- >>> connections_between("PetriNets", "Place", "Place")
|
|
|
+ >>> connections_between("formalisms/PetriNets", "Place", "Place")
|
|
|
["Association", "Inheritance"]
|
|
|
|
|
|
.. function:: define_attribute(model_name, node, attr_name, attr_type)
|
|
@@ -913,7 +912,7 @@ Functions
|
|
|
|
|
|
* To define a new attribute "tokens" on a PetriNet Place, which is of a Natural type.
|
|
|
|
|
|
- >>> define_attribute("PetriNets", "Place", "tokens", Natural)
|
|
|
+ >>> define_attribute("formalisms/PetriNets", "Place", "tokens", Natural)
|
|
|
|
|
|
.. function:: all_instances(model_name, type_name)
|
|
|
|
|
@@ -924,12 +923,12 @@ Functions
|
|
|
|
|
|
* To get all places in a PetriNet model.
|
|
|
|
|
|
- >>> all_instances("my_pn", "Place")
|
|
|
+ >>> all_instances("models/my_pn", "Place")
|
|
|
["p1", "__12345"]
|
|
|
|
|
|
* To get all nodes that can be instantiated directly for PetriNets.
|
|
|
|
|
|
- >>> all_instances("PetriNets", "Class")
|
|
|
+ >>> all_instances("formalisms/PetriNets", "Class")
|
|
|
["Place", "Transition", "P2T", "T2P"]
|
|
|
|
|
|
.. function:: service_poll(port)
|
|
@@ -976,7 +975,9 @@ Functions
|
|
|
|
|
|
Examples:
|
|
|
|
|
|
- * To
|
|
|
+ * To change the default metamodel of PetriNets to Bottom.
|
|
|
+
|
|
|
+ >>> alter_context("formalisms/PetriNets", "formalisms/Bottom")
|
|
|
|
|
|
.. function:: allowed_metamodels(model_name)
|
|
|
|
|
@@ -990,17 +991,17 @@ Functions
|
|
|
|
|
|
* 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"]
|
|
|
+ >>> allowed_metamodels("models/my_pn")
|
|
|
+ ["formalisms/PetriNets", "formalisms/Bottom", "formalisms/PetriNets_Inhibitor"]
|
|
|
|
|
|
* When all typing relations were explicitly removed.
|
|
|
|
|
|
- >>> allowed_metamodels("my_pn")
|
|
|
+ >>> allowed_metamodels("models/my_pn")
|
|
|
[]
|
|
|
|
|
|
* Usual situation when there is no metamodel specified.
|
|
|
|
|
|
- >>> allowed_metamodels("my_pn")
|
|
|
+ >>> allowed_metamodels("models/my_pn")
|
|
|
["Bottom"]
|
|
|
|
|
|
.. function:: remove_metamodel(model_name, metamodel_name)
|
|
@@ -1012,7 +1013,7 @@ Functions
|
|
|
|
|
|
* To remove the PetriNets_Inhibitor metamodel for my_pn.
|
|
|
|
|
|
- >>> remove_metamodel("my_pn", "PetriNets_Inhibitor")
|
|
|
+ >>> remove_metamodel("models/my_pn", "formalisms/PetriNets_Inhibitor")
|
|
|
|
|
|
.. function:: add_metamodel(model_name, metamodel_name, partial_type_mapping=None)
|
|
|
|
|
@@ -1020,12 +1021,14 @@ Functions
|
|
|
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.
|
|
|
+
|
|
|
+ TODO: allow for the partial type mapping
|
|
|
|
|
|
Examples:
|
|
|
|
|
|
* To try and make my_pn conform to PetriNets_Inhibitor again; this results in multiple options!
|
|
|
|
|
|
- >>> add_metamodel("my_pn", "PetriNets_Inhibitor")
|
|
|
+ >>> add_metamodel("models/my_pn", "formalisms/PetriNets_Inhibitor")
|
|
|
|
|
|
Exceptions
|
|
|
^^^^^^^^^^
|
|
@@ -1049,7 +1052,7 @@ Below is a list of all exceptions that the wrappers can raise, together with a s
|
|
|
|
|
|
* When the Modelverse is suddenly killed during execution, while there was an outstanding request.
|
|
|
|
|
|
- >>> element_list("PetriNets") # <-- Modelverse killed during execution
|
|
|
+ >>> element_list("formalisms/PetriNets") # <-- Modelverse killed during execution
|
|
|
UnknownError()
|
|
|
|
|
|
.. exception:: UnknownIdentifier
|
|
@@ -1061,22 +1064,22 @@ Below is a list of all exceptions that the wrappers can raise, together with a s
|
|
|
|
|
|
* When reading out a non-existing element in a PetriNets model.
|
|
|
|
|
|
- >>> read("my_pn", "p0")
|
|
|
+ >>> read("models/my_pn", "p0")
|
|
|
UnknownIdentifier("p0")
|
|
|
|
|
|
* When reading out the allowed connections between two elements, of which neither exists.
|
|
|
|
|
|
- >>> connections_between("my_pn", "p0", "t0")
|
|
|
+ >>> connections_between("models/my_pn", "p0", "t0")
|
|
|
UnkownIdentifier("p0")
|
|
|
|
|
|
* When reading out the allowed connections between two elements, of which the target doesn't exists.
|
|
|
|
|
|
- >>> connections_between("my_pn", "p1", "t0")
|
|
|
+ >>> connections_between("models/my_pn", "p1", "t0")
|
|
|
UnkownIdentifier("t0")
|
|
|
|
|
|
* When instantiating a non-existing element in the meta-model.
|
|
|
|
|
|
- >>> instantiate("my_pn", "CapacityConstrainedPlace")
|
|
|
+ >>> instantiate("models/my_pn", "CapacityConstrainedPlace")
|
|
|
UnkownIdentifier("CapacityConstrainedPlace")
|
|
|
|
|
|
.. exception:: UnsupportedValue
|
|
@@ -1088,12 +1091,12 @@ Below is a list of all exceptions that the wrappers can raise, together with a s
|
|
|
|
|
|
* When assigning a list as attribute.
|
|
|
|
|
|
- >>> attr_assign("my_pn", "p1", "tokens", [1, 2, 3])
|
|
|
+ >>> attr_assign("models/my_pn", "p1", "tokens", [1, 2, 3])
|
|
|
UnsupporteValue("[1, 2, 3] : list")
|
|
|
|
|
|
* When assigning a None value to an attribute.
|
|
|
|
|
|
- >>> attr_assign("my_pn", "p1", "name", None)
|
|
|
+ >>> attr_assign("models/my_pn", "p1", "name", None)
|
|
|
UnsupportedValue("None : NoneType")
|
|
|
|
|
|
.. exception:: CompilationError
|
|
@@ -1106,7 +1109,7 @@ Below is a list of all exceptions that the wrappers can raise, together with a s
|
|
|
|
|
|
* When assigning a code block which cannot be parsed as action language.
|
|
|
|
|
|
- >>> attr_assign_code("my_pn", "p1", "tokens", "1")
|
|
|
+ >>> attr_assign_code("models/my_pn", "p1", "tokens", "1")
|
|
|
CompilationError("Parsing error at line 1: ...")
|
|
|
|
|
|
.. exception:: NoSuchAttribute
|
|
@@ -1118,7 +1121,7 @@ Below is a list of all exceptions that the wrappers can raise, together with a s
|
|
|
|
|
|
* When assigning a non-existing attribute.
|
|
|
|
|
|
- >>> attr_assign("my_pn", "p1", "capacity", 2)
|
|
|
+ >>> attr_assign("models/my_pn", "p1", "capacity", 2)
|
|
|
NoSuchAttribute("capacity")
|
|
|
|
|
|
.. exception:: UnknownModel
|
|
@@ -1130,7 +1133,7 @@ Below is a list of all exceptions that the wrappers can raise, together with a s
|
|
|
|
|
|
* When trying to execute a non-existing transformation.
|
|
|
|
|
|
- >>> transformation_execute_MT("pn_optimize", {"pn": "my_pn"}, {"pn": "my_optimized_pn"})
|
|
|
+ >>> transformation_execute_MT("models/pn_optimize", {"pn": "models/my_pn"}, {"pn": "models/my_optimized_pn"})
|
|
|
UnknownModel("pn_optimize")
|
|
|
|
|
|
.. exception:: ConnectionError
|
|
@@ -1157,8 +1160,8 @@ Below is a list of all exceptions that the wrappers can raise, together with a s
|
|
|
|
|
|
* When the model "my_pn" already exists.
|
|
|
|
|
|
- >>> model_add("my_pn", "PetriNets")
|
|
|
- ModelExists("my_pn")
|
|
|
+ >>> model_add("models/my_pn", "PetriNets")
|
|
|
+ ModelExists("models/my_pn")
|
|
|
|
|
|
.. exception:: PermissionDenied
|
|
|
|
|
@@ -1174,13 +1177,13 @@ Below is a list of all exceptions that the wrappers can raise, together with a s
|
|
|
|
|
|
* When listing the elements of a model which we aren't allowed to read.
|
|
|
|
|
|
- >>> element_list("secret_model")
|
|
|
- PermissionDenied("secret_model")
|
|
|
+ >>> element_list("models/secret_model")
|
|
|
+ PermissionDenied("models/secret_model")
|
|
|
|
|
|
* When altering a model which we are only allowed to read.
|
|
|
|
|
|
- >>> instantiate("SimpleClassDiagrams", "NewClass")
|
|
|
- PermissionDenied("SimpleClassDiagrams")
|
|
|
+ >>> instantiate("formalisms/SimpleClassDiagrams", "NewClass")
|
|
|
+ PermissionDenied("formalisms/SimpleClassDiagrams")
|
|
|
|
|
|
.. exception:: InvalidMode
|
|
|
|
|
@@ -1194,7 +1197,7 @@ Below is a list of all exceptions that the wrappers can raise, together with a s
|
|
|
|
|
|
>>> login("admmin", "wrong_password")
|
|
|
PermissionDenied("admin")
|
|
|
- >>> element_list("SimpleClassDiagrams")
|
|
|
+ >>> element_list("formalisms/SimpleClassDiagrams")
|
|
|
InvalidMode()
|
|
|
|
|
|
.. exception:: InterfaceMismatch
|
|
@@ -1213,9 +1216,9 @@ Below is a list of all exceptions that the wrappers can raise, together with a s
|
|
|
|
|
|
* When erroneously trying to interpret a petrinet model as a Class Diagram.
|
|
|
|
|
|
- >>> alter_context("my_pn", "SimpleClassDiagrams")
|
|
|
+ >>> alter_context("models/my_pn", "formalisms/SimpleClassDiagrams")
|
|
|
>>> element_list()
|
|
|
- UnknownMetamodellingHierarchy("my_pn")
|
|
|
+ UnknownMetamodellingHierarchy("models/my_pn")
|
|
|
|
|
|
Custom
|
|
|
------
|