|
@@ -112,6 +112,29 @@ String function conformance_scd(model : Element):
|
|
|
if (bool_not(is_nominal_instance(model, dst_model, dst_metamodel))):
|
|
|
return "Destination of model edge not typed by source of type: " + model_name
|
|
|
|
|
|
+ // Check multiplicities, if they are defined (optional)
|
|
|
+ Element metamodel_keys
|
|
|
+ String metamodel_element
|
|
|
+ Integer attr_value
|
|
|
+
|
|
|
+ metamodel_keys = dict_keys(metamodel["model"])
|
|
|
+ while (0 < list_len(metamodel_keys)):
|
|
|
+ metamodel_element = set_pop(metamodel_keys)
|
|
|
+
|
|
|
+ // Lower multiplicities
|
|
|
+ attr_value = read_attribute(metamodel, metamodel_element, "lower_multiplicity")
|
|
|
+ if (element_neq(attr_value, read_root())):
|
|
|
+ // We have defined a lower multiplicity, so check number of instances!
|
|
|
+ if (attr_value > list_len(allInstances(model, metamodel["model"][metamodel_element]))):
|
|
|
+ return "Lower multiplicity violated for class: " + metamodel_element
|
|
|
+
|
|
|
+ // Upper multiplicities
|
|
|
+ attr_value = read_attribute(metamodel, metamodel_element, "upper_multiplicity")
|
|
|
+ if (element_neq(attr_value, read_root())):
|
|
|
+ // We have defined a lower multiplicity, so check number of instances!
|
|
|
+ if (attr_value < list_len(allInstances(model, metamodel["model"][metamodel_element]))):
|
|
|
+ return "Upper multiplicity violated for class: " + metamodel_element
|
|
|
+
|
|
|
// Structure seems fine, now do static semantics
|
|
|
if (dict_in(metamodel, "constraints")):
|
|
|
Element constraint_function
|