Previous Table of Contents Next


8.12 Recommended Copy Semantics

   It is envisaged that some MOF mappings will provide APIs for copying metadata. The purpose of this sub clause is to recommend a semantic model for such copy operations. Suggested semantics are given for “shallow? and “deep? copying. (A shallow copy is one in which conceptual components of an object are copied and other connected objects are not. A deep copy is one in which both components and more loosely related objects are copied.)

   The following table details what objects should and should not be copied. The semantics are defined from the perspective of an object being copied.

   Table 8.1 - Copy semantics for different kinds of relationships

Construct

Target type

Aggregation

Shallow Copy

Deep Copy

Attribute Instance none The Attribute value in the copy will be the same Instance value as in the original. The Attribute value in the copy will be the same Instance value as in the original.
Attribute MOF data type none The Attribute value in the copy will be the same data value as in the original. Embedded Instance values will be the same as in the original. The Attribute value in the copy will be the same data value as in the original. Embedded Instance values will be the same as in the original.
Attribute Instance composite The Attribute value in the copy will be a shallow copy of the Instance value as in the original. The Attribute value in the copy will be a deep copy of the Instance value in the original.
Association Instance none No link is created. A link is created from the copy to the original link target.
Association Instance shared A link is created from the copy to the original link target. A link is created from the copy to a deep copy of the original link target.
Association Instance composite A link is created from the copy to a shallow copy of the original link target. A link is created from the copy to a deep copy of the original link target.

   Unless otherwise stated, copying of a group of Instances related by Association or Attributes should give a 1-to-1 mapping between original Instances and copied Instances, and their respective relationships.

   NOTE: The above suggested semantics do not cover copying of MOF values whose type is a native type. Those semantics will depend on whether or not the values in question are copyable.