Managing unresolved references to previously generated objects in model-to-model transformations
About this task
In UML metamodels, features of elements have a Boolean property named containment. If the containment property is set to true, objects are placed in the feature of an instance of the element. If the containment property is set to false, only a reference to the object is placed in that feature of an instance. The transformation resolves the reference during post-processing.
During post-processing, the transformation uses a rule named FinalizeRule to search each deferred reference record to find an object to resolve the reference. If the transformation finds an object, it creates the reference in the designated output feature of the instance. If the transformation authoring runtime finds a hash map that has the ID of the transformation, it uses the source object to find the target object in the hash map. If the runtime finds more than one candidate object, it calls the output filter, if defined, to select one. If the submap does not have an output filter defined, the transformation uses the first target object that it finds to resolve the reference. If no target object is found, the transformation logs an error and displays a message.