Browse Source

Add working LoLA code

Yentl Van Tendeloo 6 years ago
parent
commit
cd43244d48

+ 16 - 0
examples/analyze_LoLa.py

@@ -0,0 +1,16 @@
+import sys
+sys.path.append("wrappers/")
+from modelverse import *
+
+init()
+login("admin", "admin")
+
+model_add("formalisms/PetriNets", "formalisms/SimpleClassDiagrams", open("models/PetriNets/metamodels/PetriNets.mvc", 'r').read())
+model_add("formalisms/Query", "formalisms/SimpleClassDiagrams", open("models/SafetyQuery/metamodels/query.mvc", 'r').read())
+
+model_add("models/PN", "formalisms/PetriNets", open("models/PetriNets/models/critical_section_with_check.mvc", 'r').read())
+model_add("models/Query", "formalisms/Query", open("models/SafetyQuery/models/both_criticals_enabled.mvc", 'r').read())
+
+transformation_add_AL({"PN": "formalisms/PetriNets", "Query": "formalisms/Query"}, {}, "models/analyze_lola", open("models/PetriNets/transformations/analyze_lola.alc", 'r').read())
+
+transformation_execute_AL("models/analyze_lola", {"PN": "models/PN", "Query": "models/Query"}, {})

+ 1 - 0
models/PetriNets/transformations/analyze_lola.alc

@@ -18,6 +18,7 @@ Boolean function lola_format(model : Element):
 	String place_output
 	String marking_output
 	String transition_output
+	String outp
 
 	all_places = allInstances(model, "PN/Place")
 	log("ALL PLACES")

+ 1 - 1
models/SafetyQuery/models/both_criticals_enabled.mvc

@@ -1,4 +1,4 @@
-Query/Place error {
+Place error {
     name = "ERROR"
     tokens = 1
 }

+ 2 - 2
services/LoLA/main.py

@@ -12,7 +12,7 @@ def lola_service(port):
     print(input_data['petrinet'])
     print(input_data['query'])
     query_formula = "--formula=EF ("+ input_data['query']+")"
-    lola = Popen(["lola", "--path=path_output", query_formula, "--json=output.json"], stdin=PIPE, stdout=PIPE).communicate(input=input_data['petrinet'])
+    lola = Popen(["services/LoLA/lola", "--path=path_output", query_formula, "--json=output.json"], stdin=PIPE, stdout=PIPE).communicate(input=input_data['petrinet'])
     
     output_file = open('output.json', 'r')
     result = json.load(output_file)
@@ -30,7 +30,7 @@ def lola_service(port):
 
 try:
     init(sys.argv[1])
-    login("test_service", "my_password")
+    login("LoLA", "LoLA_password")
 
     service_register("lola", lola_service)
 

+ 1 - 1
wrappers/modelverse_SCCD.py

@@ -1,7 +1,7 @@
 """
 Generated by Statechart compiler by Glenn De Jonghe, Joeri Exelmans, Simon Van Mierlo, and Yentl Van Tendeloo (for the inspiration)
 
-Date:   Fri May 18 08:43:20 2018
+Date:   Fri May 18 11:45:13 2018
 
 Model author: Yentl Van Tendeloo
 Model name:   MvK Server