|
@@ -19,15 +19,25 @@ Boolean function find_type_mapping(model : Element):
|
|
|
|
|
|
// 1) remove elements from type mapping that are not in the model or metamodel
|
|
|
elems = dict_keys(tm)
|
|
|
- while (set_len(elems) > 0):
|
|
|
- elem = set_pop(elems)
|
|
|
- if (bool_not(dict_in(model["model"], elem))):
|
|
|
- // Remove the key, as the model does not contain the element anymore
|
|
|
- dict_delete(tm, elem)
|
|
|
- else:
|
|
|
- if (bool_not(dict_in(model["metamodel"]["model"], tm[elem]))):
|
|
|
- // Remove the key, as the metamodel does not contain the type anymore
|
|
|
+
|
|
|
+ if (set_len(elems) > 1000):
|
|
|
+ // For now, we give up as this takes too much time...
|
|
|
+ return True!
|
|
|
+
|
|
|
+ if (bool_not(set_equality(elems, dict_keys(model["model"])))):
|
|
|
+ // First do a simplified check to see which ones are known to be there
|
|
|
+ while (set_len(elems) > 0):
|
|
|
+ log("Remaining " + cast_string(set_len(elems)))
|
|
|
+ elem = set_pop(elems)
|
|
|
+ if (bool_not(dict_in(model["model"], elem))):
|
|
|
+ // Remove the key, as the model does not contain the element anymore
|
|
|
dict_delete(tm, elem)
|
|
|
+ else:
|
|
|
+ if (bool_not(dict_in(model["metamodel"]["model"], tm[elem]))):
|
|
|
+ // Remove the key, as the metamodel does not contain the type anymore
|
|
|
+ dict_delete(tm, elem)
|
|
|
+ else:
|
|
|
+ log("Skipped " + cast_string(set_len(elems)))
|
|
|
|
|
|
// 2) find a mapping based on the current partial mapping, but only if it is not yet complete
|
|
|
// TODO this must be expanded for other things than trivial metamodels!
|