|
|
@@ -11,19 +11,19 @@ Element function tf_printNode(tf_pn_model: Element, tf_pn_node: Element):
|
|
|
//print header name
|
|
|
String tf_pn_node_name
|
|
|
tf_pn_node_name = getName(tf_pn_model, tf_pn_node)
|
|
|
- log("== NAME OF THE ELEMENT")
|
|
|
- log(tf_pn_node_name)
|
|
|
- //log(find_attribute_type(tf_pn_model, tf_pn_node_name, name : String)
|
|
|
- log("== ATTRIBUTELIST")
|
|
|
- // Get all outgoing "dictionary" links
|
|
|
+ log(string_join("name: ",tf_pn_node_name) )
|
|
|
+ log(string_join("type: ", getName(tf_pn_model["metamodel"], dict_read_node(tf_pn_model["type_mapping"], tf_pn_node)) ))
|
|
|
+ //log(getName(tf_pn_model["metamodel"], dict_read_node(tf_pn_model["type_mapping"], tf_pn_node)))
|
|
|
+ log("ATTRIBUTELIST:")
|
|
|
+ //get the list of attributes
|
|
|
Element tf_pn_attributelist
|
|
|
tf_pn_attributelist = dict_keys(getAttributeList(tf_pn_model, tf_pn_node_name))
|
|
|
String tf_pn_attributename
|
|
|
String tf_pn_attributetype
|
|
|
while (integer_lt(0, read_nr_out(tf_pn_attributelist))):
|
|
|
+ //print attribute name and its value
|
|
|
tf_pn_attributename = set_pop(tf_pn_attributelist)
|
|
|
tf_pn_attributetype = find_attribute_type(tf_pn_model, tf_pn_node_name, tf_pn_attributename)
|
|
|
- log( tf_pn_attributetype)
|
|
|
if( tf_pn_attributetype == "String"):
|
|
|
log(string_join(string_join(tf_pn_attributename, " : "),read_attribute(tf_pn_model, tf_pn_node_name, tf_pn_attributename)))
|
|
|
elif (tf_pn_attributetype == "Integer"):
|
|
|
@@ -92,7 +92,6 @@ Element function petrinet_transformation(root: Element):
|
|
|
// rule: find transitions
|
|
|
|
|
|
//rule: find_transitions
|
|
|
- log("find_transitions")
|
|
|
instantiate_node(my_model, "Rule", "find_transitions")
|
|
|
instantiate_attribute(my_model, "find_transitions", "name", "find_transitions")
|
|
|
instantiate_attribute(my_model, "find_transitions", "precedence", 1)
|
|
|
@@ -100,33 +99,28 @@ Element function petrinet_transformation(root: Element):
|
|
|
instantiate_link(my_model, "transformation_to_rule", "", "PetrinetFire", "find_transitions")
|
|
|
|
|
|
//precondition: lhs_precondition
|
|
|
- log("lhs_precondition")
|
|
|
instantiate_node(my_model, "Precondition","lhs_precondition")
|
|
|
//connect to rule
|
|
|
instantiate_link(my_model, "lhs", "", "find_transitions", "lhs_precondition")
|
|
|
|
|
|
//Transition_LHS: lhs_find_all
|
|
|
- log("lhs_find_all")
|
|
|
instantiate_node(my_model, "Transition_LHS","lhs_find_all")
|
|
|
instantiate_attribute(my_model, "lhs_find_all", "plabel", 1)
|
|
|
//connect to rule
|
|
|
instantiate_link(my_model, "pre2ram", "", "lhs_precondition", "lhs_find_all")
|
|
|
|
|
|
//precondition: nac_precondition
|
|
|
- log("nac_precondition")
|
|
|
instantiate_node(my_model, "Precondition","nac_precondition")
|
|
|
//connect to rule
|
|
|
instantiate_link(my_model, "nac", "", "find_transitions", "nac_precondition")
|
|
|
|
|
|
//Transition_LHS: nac_transition_place_before
|
|
|
- log("nac_transition_place_before")
|
|
|
instantiate_node(my_model, "Transition_LHS","nac_transition_place_before")
|
|
|
instantiate_attribute(my_model, "nac_transition_place_before", "plabel", 1)
|
|
|
//connect to rule
|
|
|
instantiate_link(my_model, "pre2ram", "", "nac_precondition", "nac_transition_place_before")
|
|
|
|
|
|
//Place_LHS: nac_place_before
|
|
|
- log("nac_place_before")
|
|
|
instantiate_node(my_model, "Place_LHS","nac_place_before")
|
|
|
instantiate_attribute(my_model, "nac_place_before", "plabel", 2)
|
|
|
instantiate_attribute(my_model, "nac_place_before", "tokens", "lambda x: sum([1 for i in x.out if i.weight<x.tokens]) == len(x.transition)")
|
|
|
@@ -134,7 +128,6 @@ Element function petrinet_transformation(root: Element):
|
|
|
instantiate_link(my_model, "pre2ram", "", "nac_precondition", "nac_place_before")
|
|
|
|
|
|
//P2T_LHS: nac_ft_p2t
|
|
|
- log("nac_transition_place_before")
|
|
|
instantiate_link(my_model, "P2T_LHS", "nac_p2tlhs_before", "nac_place_before", "nac_transition_place_before")
|
|
|
instantiate_attribute(my_model, "nac_p2tlhs_before", "plabel", 3)
|
|
|
instantiate_attribute(my_model, "nac_p2tlhs_before", "weight", "lambda x: True")
|
|
|
@@ -572,16 +565,16 @@ Element function initial_prompt():
|
|
|
Void function main():
|
|
|
//initial_prompt()
|
|
|
log("==========================================================================")
|
|
|
- log("creating metamodels")
|
|
|
+ log("=== creating metamodels")
|
|
|
Element root
|
|
|
root = create_metamodels()
|
|
|
- log("load instantiation of transformation metamodel")
|
|
|
+ log("=== load instantiation of transformation metamodel")
|
|
|
Element transf
|
|
|
transf = petrinet_transformation(root)
|
|
|
- log("check conformance of transformation")
|
|
|
+ log("=== check conformance of transformation")
|
|
|
log(conformance_scd(transf))
|
|
|
- log("run transform")
|
|
|
+ log("=== run transform")
|
|
|
tf_transform(transf, create_node())
|
|
|
- log("done")
|
|
|
+ log("=== done")
|
|
|
log("==========================================================================")
|
|
|
return
|