123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- include "primitives.alh"
- include "object_operations.alh"
- include "modelling.alh"
- Boolean function main(model : Element):
- // Contains three types of models: model, metamodel, and type_mapping.
- // Each with the obvious meanings.
- // Note that this is only a placeholder that serves as a proof of concept.
- // 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.
- log("Performing conformance check!")
- // Find all instances of classes
- // First, find the class types
- Element classes
- classes = allInstances(model, "metamodel/Class")
- log("Got classes: " + set_to_string(classes))
- Element links
- String link
- Element type_mapping
- type_mapping = dict_create()
- Element instances
- String instance
- 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!
|