|
@@ -11,17 +11,21 @@ Element function allInstances(model : Element, type_name : String):
|
|
|
Element keys
|
|
|
|
|
|
keys = dict_keys(model["model"])
|
|
|
- type = model["metamodel"]["model"][type_name]
|
|
|
- result = create_node()
|
|
|
+ if (dict_in(model["metamodel"]["model"], type_name)):
|
|
|
+ type = model["metamodel"]["model"][type_name]
|
|
|
+ result = create_node()
|
|
|
|
|
|
- // TODO more efficient to work backwards: find all instances of an element through the type mapping directly
|
|
|
- // must then take into account all inheritance links ourselves...
|
|
|
- while (0 < list_len(keys)):
|
|
|
- key = set_pop(keys)
|
|
|
- if (is_nominal_instance(model, key, type_name)):
|
|
|
- set_add(result, key)
|
|
|
+ // TODO more efficient to work backwards: find all instances of an element through the type mapping directly
|
|
|
+ // must then take into account all inheritance links ourselves...
|
|
|
+ while (0 < list_len(keys)):
|
|
|
+ key = set_pop(keys)
|
|
|
+ if (is_nominal_instance(model, key, type_name)):
|
|
|
+ set_add(result, key)
|
|
|
|
|
|
- return result!
|
|
|
+ return result!
|
|
|
+ else:
|
|
|
+ log("No such type in the metamodel!")
|
|
|
+ return create_node()!
|
|
|
|
|
|
Element function selectPossibleIncoming(model : Element, target : String, limit_set : Element):
|
|
|
// Find all possible incoming link types for the target model
|