space
Previous Page | Next Page

Using the SAS Metadata Model

Understanding Associations

An association is a relationship between two metadata types. In the SAS Metadata Model, every relationship is described by two association names. The names are defined from the perspective of each side of the relationship. For example, consider the relationship between a data table and its columns. The DataTable metadata type has an association named Columns defined to describe its relationship to the Column metadata type. Conversely, the Column metadata type has an association named Table defined to describe its relationship to the DataTable metadata type. The two names refer to the same relationship. However, each association has different characteristics, including the number of objects supported in the relationship and whether the relationship is required or optional.

Whether the relationship is required or optional and the number of objects supported in the relationship are expressed in the SAS Metadata Model by cardinality. The cardinality number specifies the number of related objects that can or must be associated with an object in a particular association. Cardinality is described in the following section.

An association that supports a relationship to a single object is referred to as a single association. The Table association is an example of a single association. A Column object can be associated with a single DataTable object. The Table association is also a required association. That is, a Column object cannot be created in a SAS Metadata Repository without a Table association to a new or existing DataTable object. Not all single associations are required associations.

An association that supports a relationship to multiple objects is referred to as a multiple association. The Columns association is an example of a multiple association. A DataTable object can have associations defined to many Column objects. Multiple associations are usually optional. A DataTable object can exist on the SAS Metadata Server whether it has none or many Column objects associated with it. The SAS Metadata Server does not guarantee ordering of multiple associations, with a few exceptions. For more information, see Association Ordering.


Cardinality

Cardinality defines an upper and a lower bound that is expressed with the notation lower..upper. In the SAS Metadata Model, the lower bound for an association is 0 or 1. If the lower bound is 0, then the association is optional. The upper bound is 1 or n. If the upper bound is 1, then the association is a single association. If the upper bound is n, then the association is a multiple association. Here is a summary of the cardinality combinations that are supported in the SAS Metadata Model:

0..1 Single, optional association
1..1 Single, required association
0..n Multiple, optional association
1..n Multiple, required association

Objects that have a 1..1 cardinality in an association are dependent objects. A dependent object cannot be created in a SAS Metadata Repository unless an association to another object is created. A dependent object cannot exist on the SAS Metadata Server without its partner object. If the partner object is deleted, the dependent object is automatically deleted as well. Column is an example of a dependent object. The Table association between a Column object and its DataTable subtype has a 1..1 cardinality. A Column object cannot be added to the SAS Metadata Server unless a Table association to a DataTable subtype is defined. If the Column object's partner DataTable object is deleted, then the Column object is automatically deleted as well. The DataTable object is not deleted when the associated Column object is deleted because the Columns association has a 0..n cardinality.

The association diagram illustrates cardinality:

[untitled graphic]

In the diagram, the labels preceded by a + are association names. The association name closest to a box describes the association defined for the object in the opposite box. That is, PhysicalTable has a 0..n Columns association to Column. Column has a 1..1 Table association to PhysicalTable.


Association Ordering

Multiple associations that are created in the same SAS Metadata Repository are stored and typically retrieved in the order in which they are defined. If the association list needs to be updated, the order of the associations in the list can be managed by using the SAS Open Metadata Interface UpdateMetadata Function directive. For information about the Function directive, see "Using the UpdateMetadata Method" in the SAS Open Metadata Interface: Reference and Usage.

The SAS Metadata Server does not guarantee the order of multiple associations when cross-repository references are defined, with a few exceptions. Exceptions are made for the following associations:

For these associations only, the SAS Metadata Server keeps internal numbering so that it can guarantee the order of the associations, regardless of whether the associations are in the same SAS Metadata Repository or not.

space
Previous Page | Next Page | Top of Page