When writing XMI by navigating the containment
hierarchy of a model, some objects are never written,
because they are not in the containment hierarchy.
This may seem obvious, but is a common problem due to a
couple of factors.
1. A bug in the XMI 1.2 spec treats attributes like
they were components, which followed literally would
lead to duplicate object specifications in the XMI.
2. There is a mismatch between XMI 1.2 and EMOF, for
which it was never intended. There is no concept of
attribute in EMOF, so there is no distinction between
attributes and non-composite references anyway.
The best solution for this is to recursively track
references as the initial hierarchy is output, then
output object hierarchies for any dangling objects at
the end.