|
@@ -36,10 +36,7 @@ Boolean function is_nominal_instance(model : Element, instance : String, type :
|
|
|
// doesn't even have a type
|
|
|
return False
|
|
|
|
|
|
- Boolean result
|
|
|
- result = is_nominal_subtype(model["metamodel"], reverseKeyLookup(model["metamodel"]["model"], dict_read_node(model["type_mapping"], model["model"][instance])), type)
|
|
|
-
|
|
|
- return result
|
|
|
+ return is_nominal_subtype(model["metamodel"], reverseKeyLookup(model["metamodel"]["model"], dict_read_node(model["type_mapping"], model["model"][instance])), type)
|
|
|
|
|
|
Boolean function is_nominal_subtype(metamodel : Element, subclass : String, superclass : String):
|
|
|
if (element_eq(metamodel["model"][subclass], metamodel["model"][superclass])):
|
|
@@ -51,18 +48,7 @@ Boolean function is_nominal_subtype(metamodel : Element, subclass : String, supe
|
|
|
if (bool_not(dict_in(metamodel["model"], superclass))):
|
|
|
return False
|
|
|
|
|
|
- Element superclasses
|
|
|
- Element new_superclass
|
|
|
- Element result
|
|
|
-
|
|
|
- superclasses = get_superclasses(metamodel, subclass)
|
|
|
-
|
|
|
- while (0 < list_len(superclasses)):
|
|
|
- new_superclass = set_pop(superclasses)
|
|
|
- if (is_nominal_subtype(metamodel, new_superclass, superclass)):
|
|
|
- return True
|
|
|
-
|
|
|
- return False
|
|
|
+ return set_in(get_superclasses(metamodel, subclass), superclass)
|
|
|
|
|
|
Element function precompute_cardinalities(model : Element):
|
|
|
Integer slc
|
|
@@ -171,7 +157,9 @@ String function conformance_scd(model : Element):
|
|
|
//
|
|
|
// First the incoming, so we are at B in the above figure
|
|
|
if (bool_not(dict_in(spo_cache, type_name))):
|
|
|
+ log("Fill SPO cache")
|
|
|
dict_add(spo_cache, type_name, selectPossibleOutgoing(metamodel, type_name, dict_keys(cardinalities)))
|
|
|
+ log("Filled SPO cache")
|
|
|
|
|
|
check_list = set_copy(spo_cache[type_name])
|
|
|
while (0 < list_len(check_list)):
|
|
@@ -197,7 +185,9 @@ String function conformance_scd(model : Element):
|
|
|
|
|
|
// Identical, but for outgoing, and thus for A in the figure
|
|
|
if (bool_not(dict_in(spi_cache, type_name))):
|
|
|
+ log("Fill SPI cache")
|
|
|
dict_add(spi_cache, type_name, selectPossibleIncoming(metamodel, type_name, dict_keys(cardinalities)))
|
|
|
+ log("Filled SPI cache")
|
|
|
|
|
|
check_list = set_copy(spi_cache[type_name])
|
|
|
while (0 < list_len(check_list)):
|