|
@@ -10,10 +10,6 @@ Boolean function main(model : Element):
|
|
|
// Thus only the check for multiple inheritance is being done, which checks for attributes.
|
|
|
// A full example is given in the Modelverse's internal conformance relation.
|
|
|
|
|
|
- // TODO should the incoming "model" be typed by conformance bottom all the time, as otherwise the mapping is already done beforehand?
|
|
|
- // TODO similarly for the metamodel: we can't be sure what comes out here
|
|
|
- // TODO only thing we are sure about is the type mapping
|
|
|
-
|
|
|
log("Performing conformance check!")
|
|
|
|
|
|
// Find all instances of classes
|
|
@@ -22,33 +18,33 @@ Boolean function main(model : Element):
|
|
|
classes = allInstances(model, "metamodel/Class")
|
|
|
log("Got classes: " + set_to_string(classes))
|
|
|
|
|
|
- // TODO maybe make the type mapping links resemble a traceability link more, such that it is automatically merged in?
|
|
|
- // TODO now the type_mapping is completely different and no relation can be inferred...
|
|
|
- // TODO other option: make the type mapping refer to names/IDs instead of identifiers, although this is problematic in case we connect to ourselves (self-conformance!)
|
|
|
Element links
|
|
|
String link
|
|
|
Element type_mapping
|
|
|
type_mapping = dict_create()
|
|
|
|
|
|
- links = allInstances(model, "type_mapping/TypeLink")
|
|
|
- while (set_len(links) > 0):
|
|
|
- link = set_pop(links)
|
|
|
- log("Association connects: " + readAssociationSource(model, link) + " --> " + readAssociationDestination(model, link))
|
|
|
- dict_add(type_mapping, "model/" + string_replace(readAssociationSource(model, link), "type_mapping/instance_", ""), "metamodel/" + string_replace(readAssociationDestination(model, link), "type_mapping/type_", ""))
|
|
|
-
|
|
|
- log("Found type mapping: " + dict_to_string(type_mapping))
|
|
|
-
|
|
|
- String class
|
|
|
Element instances
|
|
|
String instance
|
|
|
- while (set_len(classes) > 0):
|
|
|
- class = set_pop(classes)
|
|
|
- instances = allAssociationOrigins(model, class, "type_mapping/TypeLink")
|
|
|
- log("Got instances: " + set_to_string(instances))
|
|
|
-
|
|
|
- while (set_len(instances) > 0):
|
|
|
- instance = set_pop(instances)
|
|
|
+ instances = allInstances(model, "type_mapping/Instance")
|
|
|
+ while (set_len(instances) > 0):
|
|
|
+ instance = set_pop(instances)
|
|
|
+ log("Found instance: " + instance)
|
|
|
+ log(" Connects to: " + cast_string(set_pop(allAssociationDestinations(model, instance, "type_mapping/TypeLink"))))
|
|
|
+ log("Association connects: " + instance + " --> " + cast_string(set_pop(allAssociationDestinations(model, instance, "type_mapping/TypeLink"))))
|
|
|
+ //dict_add(type_mapping, "model/" + string_replace(readAssociationSource(model, link), "type_mapping/instance_", ""), "metamodel/" + string_replace(readAssociationDestination(model, link), "type_mapping/type_", ""))
|
|
|
+
|
|
|
+ log("Found type mapping: " + dict_to_string(type_mapping))
|
|
|
|
|
|
// Check if each attribute is there, and satisfies the constraints
|
|
|
+ instances = dict_keys(type_mapping)
|
|
|
+ while (set_len(instances) > 0):
|
|
|
+ instance = set_pop(instances)
|
|
|
+ log("Found type: " + read_type(model, type_mapping[instance]))
|
|
|
+ if (read_type(model, type_mapping[instance]) == "metamodel/Class"):
|
|
|
+ // Got an instance of a Class
|
|
|
+ log("Got a class instance: " + instance)
|
|
|
+
|
|
|
+ // Fetch a list of attributes that should be defined
|
|
|
+ // TODO
|
|
|
|
|
|
return True!
|