|
|
@@ -7,6 +7,7 @@ include "io.alh"
|
|
|
include "metamodels.alh"
|
|
|
include "modelling.alh"
|
|
|
|
|
|
+//helper function that returns the type of an attribute in string format
|
|
|
Element function find_attribute_type_s(model : Element, elem : String, name : String):
|
|
|
Element mm_elem
|
|
|
Element direct_type
|
|
|
@@ -19,9 +20,10 @@ Element function find_attribute_type_s(model : Element, elem : String, name : St
|
|
|
log("Undefined attribute!")
|
|
|
return read_root()
|
|
|
else:
|
|
|
- return getName(model["metamodel"], dict_read_edge(mm_elem, name))
|
|
|
+ return getName(model["metamodel"], read_edge_dst( dict_read_edge(mm_elem, name)))
|
|
|
|
|
|
-Element function tf_printNode(tf_pn_model: Element, tf_pn_node: Element):
|
|
|
+//function to print information about a node (attributes, type and name)
|
|
|
+Element function 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)
|
|
|
@@ -47,6 +49,7 @@ Element function tf_printNode(tf_pn_model: Element, tf_pn_node: Element):
|
|
|
log(read_attribute(tf_pn_model, tf_pn_node_name, tf_pn_attributename))
|
|
|
return 0
|
|
|
|
|
|
+// given a pattern, this function will return all matches in a model
|
|
|
Element function tf_matchAll(tf_ma_transformation: Element, tf_ma_pattern : Element, tf_ma_model: Element ):
|
|
|
Element tf_ma_metamodelTransf
|
|
|
tf_ma_metamodelTransf = dict_read(dict_read(tf_ma_transformation, "metamodel"), "model")
|
|
|
@@ -57,8 +60,8 @@ Element function tf_matchAll(tf_ma_transformation: Element, tf_ma_pattern : Elem
|
|
|
Element tf_ma_ramified_node
|
|
|
while (integer_lt(0, read_nr_out(tf_ma_pattern_nodes))):
|
|
|
tf_ma_ramified_node = read_edge_dst(set_pop(tf_ma_pattern_nodes))
|
|
|
- //tf_printNode(tf_ma_transformation, tf_ma_ramified_node)
|
|
|
- Element tf_ma_attrlist
|
|
|
+ printNode(tf_ma_transformation, tf_ma_ramified_node)
|
|
|
+ log(read_attribute(tf_ma_transformation, getName(tf_ma_transformation, tf_ma_ramified_node), "plabel"))
|
|
|
return 0
|
|
|
|
|
|
Element function tf_executeRule(tf_er_transformation: Element,tf_er_rule: Element, tf_er_model: Element):
|